From 5748ba1e3e532cd451ee7ce6cfb3af32dca11e0e Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Sun, 18 Sep 2022 16:39:48 +0800 Subject: migrate to new survival autoplace api (#1382) * migrate to new survival autoplace api * reduce type of blocks autoplace will use this does not prevent those blocks from not being accepted into the structures though * implement getBlocksToPlace * fix survivalConstruct code for assline and DT i hate variable size multi :( * fix AIOBE * allow disabling machine block updates on a per-thread basis * make a sensible guess at what texture to use on server side * spotless * implement hologram support for bbf * spotless --- .../gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/main/java/gregtech/api/threads') diff --git a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java index 371c3316f3..5e2cc08475 100644 --- a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java +++ b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java @@ -55,10 +55,19 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable { GT_Runnable_MachineBlockUpdate.isEnabled = isEnabled; } + public static boolean isCurrentThreadEnabled() { + return perThreadEnable.get(); + } + + public static void setCurrentThreadEnabled(boolean perThreadEnable) { + GT_Runnable_MachineBlockUpdate.perThreadEnable.set(perThreadEnable); + } + protected static boolean isEnabled = true; + protected static final ThreadLocal perThreadEnable = ThreadLocal.withInitial(() -> true); public static void setMachineUpdateValues(World aWorld, ChunkCoordinates aCoords) { - if (isEnabled) { + if (isEnabled() && isCurrentThreadEnabled()) { EXECUTOR_SERVICE.submit(new GT_Runnable_MachineBlockUpdate(aWorld, aCoords)); } } -- cgit