mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-18 19:49:12 +00:00
Fix world client memory leaks caused by block renderers (#88)
* make threadlocals final * minor code fixes * fix custom block renderers leaking world * remove now useless threadlocal cleaning * fix memory leak from rendererOld by just deleting the field * fix ThreadLocals to work on dedicated server
This commit is contained in:
1 parent
2ae1f8ba93
commit
ec610dc876
17 files changed
+114
-203
No files matched your search
@@ -6,6 +6,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import team.chisel.ctmlib.RenderBlocksCTM;
|
||||
@@ -13,18 +14,12 @@ import team.chisel.ctmlib.TextureSubmap;
|
||||
|
||||
public class SubmapManagerCarpetFloor extends SubmapManagerBase {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static ThreadLocal<RenderBlocksCTM> renderBlocksThreadLocal;
|
||||
|
||||
private static void initStatics() {
|
||||
if (renderBlocksThreadLocal == null) {
|
||||
renderBlocksThreadLocal = ThreadLocal.withInitial(RenderBlocksCTM::new);
|
||||
}
|
||||
}
|
||||
private static final ThreadLocal<RenderBlocksCTM> renderBlocksThreadLocal = FMLLaunchHandler.side()
|
||||
.isClient() ? ThreadLocal.withInitial(RenderBlocksCTM::new) : null;
|
||||
|
||||
private TextureSubmap submap;
|
||||
private TextureSubmap submapSmall;
|
||||
private String color;
|
||||
private final String color;
|
||||
|
||||
public SubmapManagerCarpetFloor(String color) {
|
||||
this.color = color;
|
||||
@@ -51,7 +46,6 @@ public class SubmapManagerCarpetFloor extends SubmapManagerBase {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
initStatics();
|
||||
RenderBlocksCTM rb = renderBlocksThreadLocal.get();
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
rb.submap = submap;
|
||||
|
||||
Reference in new issue
Block a user