mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-25 06:34:35 +00:00
Make rendering blocks thread safe with Angelica (#65)
This commit is contained in:
1 parent
4ce0134bed
commit
40144a0fa5
6 files changed
+57
-18
No files matched your search
@@ -99,7 +99,13 @@ public class SubmapManagerCombinedCTM extends SubmapManagerBase {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private RenderBlocksCTM rb;
|
||||
private static ThreadLocal<RenderBlocksCombinedCTM> renderBlocksThreadLocal;
|
||||
|
||||
private static void initStatics() {
|
||||
if (renderBlocksThreadLocal == null) {
|
||||
renderBlocksThreadLocal = new ThreadLocal<>();
|
||||
}
|
||||
}
|
||||
|
||||
private TextureSubmap submap, smallSubmap;
|
||||
private int size;
|
||||
@@ -133,8 +139,11 @@ public class SubmapManagerCombinedCTM extends SubmapManagerBase {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
initStatics();
|
||||
RenderBlocksCombinedCTM rb = renderBlocksThreadLocal.get();
|
||||
if (rb == null) {
|
||||
rb = new RenderBlocksCombinedCTM();
|
||||
renderBlocksThreadLocal.set(rb);
|
||||
}
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
return rb;
|
||||
|
||||
Reference in new issue
Block a user