diff --git a/fabric/src/main/java/com/seibel/lod/fabric/mixins/server/MixinUtilBackgroundThread.java b/fabric/src/main/java/com/seibel/lod/fabric/mixins/server/MixinUtilBackgroundThread.java index 464ac14e6..a7e175dc2 100644 --- a/fabric/src/main/java/com/seibel/lod/fabric/mixins/server/MixinUtilBackgroundThread.java +++ b/fabric/src/main/java/com/seibel/lod/fabric/mixins/server/MixinUtilBackgroundThread.java @@ -35,10 +35,14 @@ import net.minecraft.Util; @Mixin(Util.class) public class MixinUtilBackgroundThread { + private static boolean shouldApplyOverride() { + return FabricServerProxy.isGenerationThreadChecker != null && FabricServerProxy.isGenerationThreadChecker.get(); + } + @Inject(method = "backgroundExecutor", at = @At("HEAD"), cancellable = true) private static void overrideUtil$backgroundExecutor(CallbackInfoReturnable ci) { - if (FabricServerProxy.isGenerationThreadChecker != null && FabricServerProxy.isGenerationThreadChecker.get()) + if (shouldApplyOverride()) { //ApiShared.LOGGER.info("util backgroundExecutor triggered"); ci.setReturnValue(new DummyRunExecutorService()); @@ -50,7 +54,7 @@ public class MixinUtilBackgroundThread at = @At("HEAD"), cancellable = true) private static void overrideUtil$wrapThreadWithTaskName(String string, Runnable r, CallbackInfoReturnable ci) { - if (FabricServerProxy.isGenerationThreadChecker != null && FabricServerProxy.isGenerationThreadChecker.get()) + if (shouldApplyOverride()) { //ApiShared.LOGGER.info("util wrapThreadWithTaskName(Runnable) triggered"); ci.setReturnValue(r); @@ -62,7 +66,7 @@ public class MixinUtilBackgroundThread at = @At("HEAD"), cancellable = true) private static void overrideUtil$wrapThreadWithTaskNameForSupplier(String string, Supplier r, CallbackInfoReturnable> ci) { - if (FabricServerProxy.isGenerationThreadChecker != null && FabricServerProxy.isGenerationThreadChecker.get()) + if (shouldApplyOverride()) { //ApiShared.LOGGER.info("util wrapThreadWithTaskName(Supplier) triggered"); ci.setReturnValue(r); diff --git a/forge/src/main/java/com/seibel/lod/forge/mixins/server/MixinUtilBackgroundThread.java b/forge/src/main/java/com/seibel/lod/forge/mixins/server/MixinUtilBackgroundThread.java index 405d8c8db..f77a15c81 100644 --- a/forge/src/main/java/com/seibel/lod/forge/mixins/server/MixinUtilBackgroundThread.java +++ b/forge/src/main/java/com/seibel/lod/forge/mixins/server/MixinUtilBackgroundThread.java @@ -35,15 +35,14 @@ import net.minecraft.Util; @Mixin(Util.class) public class MixinUtilBackgroundThread { - private static boolean shouldApplyOverride() { - return DependencySetupDoneCheck.getIsCurrentThreadDistantGeneratorThread.get(); + return DependencySetupDoneCheck.isDone && DependencySetupDoneCheck.getIsCurrentThreadDistantGeneratorThread.get(); } @Inject(method = "backgroundExecutor", at = @At("HEAD"), cancellable = true) private static void overrideUtil$backgroundExecutor(CallbackInfoReturnable ci) { - if (DependencySetupDoneCheck.isDone && shouldApplyOverride()) + if (shouldApplyOverride()) { //ApiShared.LOGGER.info("util backgroundExecutor triggered"); ci.setReturnValue(new DummyRunExecutorService()); @@ -55,7 +54,7 @@ public class MixinUtilBackgroundThread at = @At("HEAD"), cancellable = true) private static void overrideUtil$wrapThreadWithTaskName(String string, Runnable r, CallbackInfoReturnable ci) { - if (DependencySetupDoneCheck.isDone && shouldApplyOverride()) + if (shouldApplyOverride()) { //ApiShared.LOGGER.info("util wrapThreadWithTaskName(Runnable) triggered"); ci.setReturnValue(r); @@ -67,7 +66,7 @@ public class MixinUtilBackgroundThread at = @At("HEAD"), cancellable = true) private static void overrideUtil$wrapThreadWithTaskNameForSupplier(String string, Supplier r, CallbackInfoReturnable> ci) { - if (DependencySetupDoneCheck.isDone && shouldApplyOverride()) + if (shouldApplyOverride()) { //ApiShared.LOGGER.info("util wrapThreadWithTaskName(Supplier) triggered"); ci.setReturnValue(r);