From 829d0f6efbf85e07715d7a5224108b03b594a6a5 Mon Sep 17 00:00:00 2001 From: firenoo <49818773+firenoo@users.noreply.github.com> Date: Mon, 31 Jul 2023 01:09:00 -0700 Subject: [PATCH] Cache the models for the Arcane Enervation Emitter (#23) * Cache the models for the Arcane Enervation Emitter Could be the reason why there's a memory leak but I can't tell if it's actually been fixed by this change * spotlessApply (#24) Co-authored-by: GitHub GTNH Actions <> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../client/renderers/tile/RenderTileBlockProtector.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileBlockProtector.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileBlockProtector.java index 58f52d9..1ee85b2 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileBlockProtector.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileBlockProtector.java @@ -22,6 +22,9 @@ public class RenderTileBlockProtector extends TileJarRenderer { private static final ResourceLocation TEXTURE_OFF = new SimpleResourceLocation("models/block_protector_off.png"); private static final ResourceLocation TEXTURE_ON = new SimpleResourceLocation("models/block_protector_on.png"); + private static final ModelBlockProtector MODEL_BP = new ModelBlockProtector(); + private static final ModelJar MODEL_JAR = new ModelJar(); + @Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) { this.renderTileEntityAt((TileBlockProtector) tile, x, y, z, partialTicks); @@ -53,7 +56,7 @@ public class RenderTileBlockProtector extends TileJarRenderer { this.bindTexture( tile.getPowerLevel() > 0 ? RenderTileBlockProtector.TEXTURE_ON : RenderTileBlockProtector.TEXTURE_OFF); - new ModelBlockProtector().render(null, 0, 0, 0, 0, 0, 0.0625f); + MODEL_BP.render(null, 0, 0, 0, 0, 0, 0.0625f); GL11.glPopMatrix(); GL11.glTranslatef(0, -2 / 16f - 0.03f, 0); @@ -64,7 +67,7 @@ public class RenderTileBlockProtector extends TileJarRenderer { GL11.glTranslatef(-0.5f, 0, 0.5f); this.bindTexture(new ResourceLocation("thaumcraft", "textures/models/jar.png")); - new ModelJar().renderAll(); + MODEL_JAR.renderAll(); GL11.glPopMatrix(); }