mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-26 15:13:01 +00:00
remove boxing unboxing in RenderPassHelper
This commit is contained in:
1 parent
c8e50227fb
commit
b1e496f56d
1 file changed
+8
-3
+8
-3
@@ -4,19 +4,24 @@ import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
|
||||
public final class RenderPassHelper {
|
||||
private static final ThreadLocal<Integer> threadLocalPass = ThreadLocal.withInitial(() -> -1);
|
||||
|
||||
private static final class PassIntHolder {
|
||||
int pass = -1;
|
||||
}
|
||||
|
||||
private static final ThreadLocal<PassIntHolder> threadLocalPass = ThreadLocal.withInitial(PassIntHolder::new);
|
||||
|
||||
private RenderPassHelper() {}
|
||||
|
||||
public static int getWorldRenderPass() {
|
||||
return GLStateManager.isMainThread() ? ForgeHooksClient.worldRenderPass : threadLocalPass.get();
|
||||
return GLStateManager.isMainThread() ? ForgeHooksClient.worldRenderPass : threadLocalPass.get().pass;
|
||||
}
|
||||
|
||||
public static void setWorldRenderPass(int pass) {
|
||||
if (GLStateManager.isMainThread()) {
|
||||
ForgeHooksClient.worldRenderPass = pass;
|
||||
} else {
|
||||
threadLocalPass.set(pass);
|
||||
threadLocalPass.get().pass = pass;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user