From f391e97a628e8cdd92bd801daffecb7bb0c77b74 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Wed, 25 Oct 2023 14:34:45 -0400 Subject: [PATCH] Handle Knot behaving differently from FML with getResource --- .../modernfix/core/config/ModernFixEarlyConfig.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 6b566557..44cbedcb 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 @@ -20,6 +20,7 @@ import org.objectweb.asm.tree.ClassNode; import org.spongepowered.asm.mixin.Mixin; import java.io.*; +import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.function.BooleanSupplier; @@ -235,7 +236,10 @@ public class ModernFixEarlyConfig { if(!ModernFixPlatformHooks.INSTANCE.isDevEnv()) return; try { - if(ModernFixEarlyConfig.class.getClassLoader().getResource("/net/minecraft/world/level/Level.class") == null) { + URL deobfClass = isFabric ? + ModernFixEarlyConfig.class.getResource("/net/minecraft/world/level/Level.class") : + ModernFixEarlyConfig.class.getClassLoader().getResource("/net/minecraft/world/level/Level.class"); + if(deobfClass == 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]"); }