Fixed memory leak, crash with Rats, now compatible with newer forge versions.

This commit is contained in:
Tschipp 2023-11-19 23:00:43 +01:00
parent be7c5e891e
commit 0d9e6cf32e
4 changed files with 13 additions and 11 deletions

View File

@ -35,6 +35,14 @@ import java.util.Optional;
public class CarriedObjectRender
{
private static Map<RenderType, BufferBuilder> builders = Map.of(
RenderType.glint(), new BufferBuilder(RenderType.glint().bufferSize()),
RenderType.glintDirect(), new BufferBuilder(RenderType.glintDirect().bufferSize()),
RenderType.glintTranslucent(), new BufferBuilder(RenderType.glintTranslucent().bufferSize()),
RenderType.entityGlint(), new BufferBuilder(RenderType.entityGlint().bufferSize()),
RenderType.entityGlintDirect(), new BufferBuilder(RenderType.entityGlintDirect().bufferSize())
);
public static boolean drawFirstPerson(Player player, MultiBufferSource buffer, PoseStack matrix, int light, float partialTicks)
{
if(Services.PLATFORM.isModLoaded("firstperson") || Services.PLATFORM.isModLoaded("firstpersonmod"))
@ -159,13 +167,7 @@ public class CarriedObjectRender
RenderSystem.enableBlend();
RenderSystem.disableCull();
RenderSystem.disableDepthTest();
Map<RenderType, BufferBuilder> builders = Map.of(
RenderType.glint(), new BufferBuilder(RenderType.glint().bufferSize()),
RenderType.glintDirect(), new BufferBuilder(RenderType.glintDirect().bufferSize()),
RenderType.glintTranslucent(), new BufferBuilder(RenderType.glintTranslucent().bufferSize()),
RenderType.entityGlint(), new BufferBuilder(RenderType.entityGlint().bufferSize()),
RenderType.entityGlintDirect(), new BufferBuilder(RenderType.entityGlintDirect().bufferSize())
);
BufferSource buffer = MultiBufferSource.immediateWithBuffers(builders, Tesselator.getInstance().getBuilder());
for (Player player : level.players())

View File

@ -248,7 +248,7 @@ public class CarryConfig
"mekanismgenerators:wind_generator", "cookingforblockheads:cabinet", "cookingforblockheads:corner", "cookingforblockheads:counter",
"cookingforblockheads:oven", "cookingforblockheads:toaster", "cookingforblockheads:milk_jar", "cookingforblockheads:cow_jar",
"cookingforblockheads:fruit_basket", "cookingforblockheads:cooking_table", "cookingforblockheads:fridge", "cookingforblockheads:sink",
"powah:*"
"powah:*", "advancementtrophies:trophy", "mekanismgenerators:heat_generator", "mna:filler_block"
};
@Property(
@ -261,7 +261,7 @@ public class CarryConfig
"minecraft:item_frame", "minecraft:painting", "minecraft:shulker_bullet",
"animania:hamster", "animania:ferret*", "animania:hedgehog*", "animania:cart",
"animania:wagon", "mynko:*", "pixelmon:*", "mocreatures:*", "quark:totem", "vehicle:*",
"securitycraft:*", "taterzens:npc", "easy_npc:*"
"securitycraft:*", "taterzens:npc", "easy_npc:*", "bodiesbodies:dead_body"
};
@Property(

View File

@ -77,7 +77,7 @@ public class CommonEvents
} else {
PlacementHandler.tryPlaceEntity((ServerPlayer) player, pos, event.getFace(), (pPos, toPlace) -> {
if (toPlace instanceof Mob mob) {
FinalizeSpawn checkSpawn = new FinalizeSpawn(mob, (ServerLevelAccessor) level, pPos.x, pPos.y, pPos.z, null, MobSpawnType.EVENT, null, null, null);
FinalizeSpawn checkSpawn = new FinalizeSpawn(mob, (ServerLevelAccessor) level, pPos.x, pPos.y, pPos.z, level.getCurrentDifficultyAt(new BlockPos((int) pPos.x, (int) pPos.y, (int) pPos.z)), MobSpawnType.EVENT, null, null, null);
MinecraftForge.EVENT_BUS.post(checkSpawn);
return event.getResult() != Result.DENY;
}

View File

@ -19,7 +19,7 @@ issueTrackerURL="https://github.com/Tschipp/CarryOn/issues"
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="[46,47.1.47]" #mandatory
versionRange="[46,47.1.3],[47.1.43,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER