mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-18 03:35:07 +00:00
Angelica Thread Safety
This commit is contained in:
1 parent
e9e63d6fc5
commit
06ec360694
15 files changed
+82
-38
No files matched your search
@@ -100,7 +100,8 @@ public enum TextureType {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world, Object cachedObject) {
|
||||
RenderBlocksColumn ret = theRenderBlocksColumn;
|
||||
TextureType.initStatics();
|
||||
RenderBlocksColumn ret = theRenderBlocksColumn.get();
|
||||
Pair<TextureSubmap, IIcon> data = (Pair<TextureSubmap, IIcon>) cachedObject;
|
||||
|
||||
ret.blockAccess = world;
|
||||
@@ -205,7 +206,7 @@ public enum TextureType {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world, Object cachedObject) {
|
||||
RenderBlocksCTM ret = theRenderBlocksCTM;
|
||||
RenderBlocksCTM ret = theRenderBlocksCTM.get();
|
||||
Triple<?, TextureSubmap, TextureSubmap> data = (Triple<?, TextureSubmap, TextureSubmap>) cachedObject;
|
||||
ret.blockAccess = world;
|
||||
|
||||
@@ -325,9 +326,9 @@ public enum TextureType {
|
||||
private static final CTM ctm = CTM.getInstance();
|
||||
private static final Random rand = new Random();
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static RenderBlocksCTM theRenderBlocksCTM;
|
||||
private static ThreadLocal<RenderBlocksCTM> theRenderBlocksCTM;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static RenderBlocksColumn theRenderBlocksColumn;
|
||||
private static ThreadLocal<RenderBlocksColumn> theRenderBlocksColumn;
|
||||
|
||||
private String[] suffixes;
|
||||
static {
|
||||
@@ -338,16 +339,17 @@ public enum TextureType {
|
||||
this.suffixes = suffixes.length == 0 ? new String[] { "" } : suffixes;
|
||||
}
|
||||
|
||||
private static void initStatics() {
|
||||
if (theRenderBlocksCTM == null) {
|
||||
theRenderBlocksCTM = new RenderBlocksCTM();
|
||||
theRenderBlocksColumn = new RenderBlocksColumn();
|
||||
}
|
||||
}
|
||||
private static void initStatics() {
|
||||
if (theRenderBlocksCTM == null) {
|
||||
theRenderBlocksCTM = ThreadLocal.withInitial(RenderBlocksCTM::new);
|
||||
theRenderBlocksColumn = ThreadLocal.withInitial(RenderBlocksColumn::new);
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void clearStatics() {
|
||||
theRenderBlocksCTM = null;
|
||||
theRenderBlocksColumn = null;
|
||||
theRenderBlocksCTM.remove();
|
||||
theRenderBlocksColumn.remove();
|
||||
}
|
||||
|
||||
public ISubmapManager createManagerFor(ICarvingVariation variation, String texturePath) {
|
||||
@@ -428,7 +430,6 @@ public enum TextureType {
|
||||
|
||||
@Override
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
initStatics();
|
||||
RenderBlocks rb = type.createRenderContext(rendererOld, world, cachedObject);
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
return rb;
|
||||
|
||||
Reference in new issue
Block a user