Fix JEI search tree replacement on 1.19
This commit is contained in:
parent
ba82be7a89
commit
b988715c2c
|
|
@ -49,8 +49,7 @@ public class ModernFixEarlyConfig {
|
|||
/* off by default in 1.18 because it doesn't work as well */
|
||||
this.addMixinRule("perf.faster_singleplayer_load", false);
|
||||
/* Keep this off if JEI/REI isn't installed to prevent breaking vanilla gameplay */
|
||||
Optional<ModInfo> jeiMod = FMLLoader.getLoadingModList().getMods().stream().filter(mod -> mod.getModId().equals("jei")).findFirst();
|
||||
this.addMixinRule("perf.blast_search_trees", (jeiMod.isPresent() && jeiMod.get().getVersion().getMajorVersion() >= 10) || FMLLoader.getLoadingModList().getModFileById("roughlyenoughitems") != null);
|
||||
this.addMixinRule("perf.blast_search_trees", FMLLoader.getLoadingModList().getModFileById("jei") != null || FMLLoader.getLoadingModList().getModFileById("roughlyenoughitems") != null);
|
||||
this.addMixinRule("safety", true);
|
||||
this.addMixinRule("launch.transformer_cache", false);
|
||||
this.addMixinRule("launch.class_search_cache", true);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class MinecraftMixin {
|
|||
ModernFix.LOGGER.info("Replaced creative search logic with REI");
|
||||
this.searchRegistry.register(SearchRegistry.CREATIVE_NAMES, list -> new REIBackedSearchTree(false));
|
||||
this.searchRegistry.register(SearchRegistry.CREATIVE_TAGS, list -> new REIBackedSearchTree(true));
|
||||
} else if(jeiContainer.isPresent() && jeiContainer.get().getModInfo().getVersion().getMajorVersion() >= 10) {
|
||||
} else if(jeiContainer.isPresent()) {
|
||||
ModernFix.LOGGER.info("Replaced creative search logic with JEI");
|
||||
this.searchRegistry.register(SearchRegistry.CREATIVE_NAMES, list -> new JEIBackedSearchTree(false));
|
||||
this.searchRegistry.register(SearchRegistry.CREATIVE_TAGS, list -> new JEIBackedSearchTree(true));
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ import java.util.Optional;
|
|||
|
||||
@JeiPlugin
|
||||
public class JEIRuntimeCapturer implements IModPlugin {
|
||||
private static WeakReference<JeiRuntime> runtimeHandle = new WeakReference<>(null);
|
||||
private static JeiRuntime runtimeHandle = null;
|
||||
|
||||
public static Optional<JeiRuntime> runtime() {
|
||||
return Optional.ofNullable(runtimeHandle.get());
|
||||
return Optional.ofNullable(runtimeHandle);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -25,11 +25,11 @@ public class JEIRuntimeCapturer implements IModPlugin {
|
|||
|
||||
@Override
|
||||
public void onRuntimeAvailable(IJeiRuntime jeiRuntime) {
|
||||
runtimeHandle = new WeakReference<>((JeiRuntime)jeiRuntime);
|
||||
runtimeHandle = (JeiRuntime)jeiRuntime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRuntimeUnavailable() {
|
||||
runtimeHandle = new WeakReference<>(null);
|
||||
runtimeHandle = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user