Handle Knot behaving differently from FML with getResource

This commit is contained in:
embeddedt 2023-10-25 14:34:45 -04:00
parent fd68efec0c
commit f391e97a62

View File

@ -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]");
}