Clear render block instances on world unload to not leak the world

This commit is contained in:
Pelotrio authored and Jason Mitchell committed 2023-11-10 18:11:53 -08:00
1 parent df216f68b4
commit 966fad56ca
2 files changed
+15

No files matched your search

@@ -84,4 +84,9 @@ public class SubmapManagerSpecialMaterial extends SubmapManagerBase {
renderBlocksFullbright.submapSmall = submapSmall;
return renderBlocksFullbright;
}
public static void clearRenderBlocksInstance() {
renderBlocksFullbright = null;
}
}
@@ -11,6 +11,7 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.oredict.OreDictionary;
import com.cricketcraft.chisel.api.IChiselItem;
@@ -25,6 +26,7 @@ import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent;
import team.chisel.Chisel;
import team.chisel.carving.Carving;
import team.chisel.client.render.SubmapManagerSpecialMaterial;
import team.chisel.utils.General;
public final class ChiselController {
@@ -160,4 +162,12 @@ public final class ChiselController {
}
}
}
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
if (event.world.isRemote) {
SubmapManagerSpecialMaterial.clearRenderBlocksInstance();
}
}
}