Fix some code holding client world references longer than needed (#4881)

This commit is contained in:
Ben Staddon authored and LexManos committed 2018-04-22 14:40:38 -07:00
1 parent bc545450e5
commit 90bf8dd95d
5 files changed
+38 -8

No files matched your search

@@ -100,7 +100,7 @@ public class MinecraftForgeClient
.build(new CacheLoader<Pair<World, BlockPos>, ChunkCache>()
{
@Override
public ChunkCache load(Pair<World, BlockPos> key) throws Exception
public ChunkCache load(Pair<World, BlockPos> key)
{
return new ChunkCache(key.getLeft(), key.getRight().add(-1, -1, -1), key.getRight().add(16, 16, 16), 1);
}
@@ -118,4 +118,10 @@ public class MinecraftForgeClient
int z = pos.getZ() & ~0xF;
return regionCache.getUnchecked(Pair.of(world, new BlockPos(x, y, z)));
}
public static void clearRenderCache()
{
regionCache.invalidateAll();
regionCache.cleanUp();
}
}
@@ -94,6 +94,16 @@ public class BlockInfo
shx = shy = shz = 0;
}
public void reset()
{
this.world = null;
this.state = null;
this.blockPos = null;
cachedTint = -1;
cachedMultiplier = -1;
shx = shy = shz = 0;
}
private float combine(int c, int s1, int s2, int s3, boolean t0, boolean t1, boolean t2, boolean t3)
{
if (c == 0 && !t0) c = Math.max(0, Math.max(s1, s2) - 1);
@@ -122,6 +122,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
}
}
}
lighter.resetBlockInfo();
return !empty;
}
}
@@ -302,6 +302,11 @@ public class VertexLighterFlat extends QuadGatheringTransformer
blockInfo.setBlockPos(blockPos);
}
public void resetBlockInfo()
{
blockInfo.reset();
}
public void updateBlockInfo()
{
blockInfo.updateShift();