mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-12 00:07:37 +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
@@ -79,7 +79,13 @@ public class SubmapManagerVoidstone extends SubmapManagerBase {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private RenderBlocksVoidstone rb;
|
||||
private static ThreadLocal<RenderBlocksVoidstone> renderBlocksThreadLocal;
|
||||
|
||||
private static void initStatics() {
|
||||
if (renderBlocksThreadLocal == null) {
|
||||
renderBlocksThreadLocal = new ThreadLocal<>();
|
||||
}
|
||||
}
|
||||
|
||||
private ISubmapManager overlay;
|
||||
private TextureSubmap base;
|
||||
@@ -123,8 +129,11 @@ public class SubmapManagerVoidstone extends SubmapManagerBase {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
initStatics();
|
||||
RenderBlocksVoidstone rb = renderBlocksThreadLocal.get();
|
||||
if (rb == null) {
|
||||
rb = new RenderBlocksVoidstone();
|
||||
renderBlocksThreadLocal.set(rb);
|
||||
}
|
||||
RenderBlocks ctx = overlay.createRenderContext(rendererOld, block, world);
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
|
||||
Reference in new issue
Block a user