From bd1ca9ce94ed717a69cecf48c25862e6817f521c Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Sun, 17 Sep 2023 13:00:54 -0400 Subject: [PATCH] Disable reduce_blockstate_cache_rebuilds if dev env is not Mojmap This is simpler than implementing remapping Closes #229 --- .../core/config/ModernFixEarlyConfig.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/common/src/main/java/org/embeddedt/modernfix/core/config/ModernFixEarlyConfig.java b/common/src/main/java/org/embeddedt/modernfix/core/config/ModernFixEarlyConfig.java index c1eed340..67af3710 100644 --- a/common/src/main/java/org/embeddedt/modernfix/core/config/ModernFixEarlyConfig.java +++ b/common/src/main/java/org/embeddedt/modernfix/core/config/ModernFixEarlyConfig.java @@ -229,6 +229,21 @@ public class ModernFixEarlyConfig { if(isFabric) { disableIfModPresent("mixin.bugfix.packet_leak", "memoryleakfix"); } + + checkBlockstateCacheRebuilds(); + } + + private void checkBlockstateCacheRebuilds() { + if(!ModernFixPlatformHooks.INSTANCE.isDevEnv()) + return; + try { + if(ModernFixEarlyConfig.class.getResource("/net/minecraft/world/level/Level.class") == null) { + LOGGER.warn("We are in a non-Mojmap dev environment. Disabling blockstate cache patch"); + this.options.get("mixin.perf.reduce_blockstate_cache_rebuilds").addModOverride(false, "[not mojmap]"); + } + } catch(Throwable e) { + e.printStackTrace(); + } } private void disableIfModPresent(String configName, String... ids) {