From fd68efec0c5e72210ac21d3ed8269ca0b0f4238d Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Wed, 25 Oct 2023 14:30:10 -0400 Subject: [PATCH 1/3] Remove async_jei option from 1.18 listing --- .../embeddedt/modernfix/core/config/ModernFixEarlyConfig.java | 1 - 1 file changed, 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 d12e426f..6b566557 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 @@ -156,7 +156,6 @@ public class ModernFixEarlyConfig { private static final ImmutableMap DEFAULT_SETTING_OVERRIDES = new DefaultSettingMapBuilder() .put("mixin.perf.dynamic_resources", false) - .putConditionally(() -> !isFabric, "mixin.perf.async_jei", false) .put("mixin.perf.dynamic_sounds", false) .put("mixin.perf.dynamic_block_codecs", false) .put("mixin.feature.direct_stack_trace", false) 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 2/3] 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]"); } From 77760d7dd20cef5e7948ebd46371ef43ad1bf3b1 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Wed, 25 Oct 2023 14:56:37 -0400 Subject: [PATCH 3/3] Remember previous scroll position on config screen --- .../embeddedt/modernfix/screen/ModernFixConfigScreen.java | 7 +++++++ .../java/org/embeddedt/modernfix/screen/OptionList.java | 1 + 2 files changed, 8 insertions(+) diff --git a/common/src/main/java/org/embeddedt/modernfix/screen/ModernFixConfigScreen.java b/common/src/main/java/org/embeddedt/modernfix/screen/ModernFixConfigScreen.java index a0cc441c..f6025cb3 100644 --- a/common/src/main/java/org/embeddedt/modernfix/screen/ModernFixConfigScreen.java +++ b/common/src/main/java/org/embeddedt/modernfix/screen/ModernFixConfigScreen.java @@ -13,6 +13,8 @@ public class ModernFixConfigScreen extends Screen { public boolean madeChanges = false; private Button doneButton, wikiButton; + private double lastScrollAmount = 0; + public ModernFixConfigScreen(Screen lastScreen) { super(new TranslatableComponent("modernfix.config")); this.lastScreen = lastScreen; @@ -21,6 +23,7 @@ public class ModernFixConfigScreen extends Screen { @Override protected void init() { this.optionList = new OptionList(this, this.minecraft); + this.optionList.setScrollAmount(lastScrollAmount); this.children.add(this.optionList); this.wikiButton = new Button(this.width / 2 - 155, this.height - 29, 150, 20, new TranslatableComponent("modernfix.config.wiki"), (arg) -> { Util.getPlatform().openUri("https://github.com/embeddedt/ModernFix/wiki/Summary-of-Patches"); @@ -50,4 +53,8 @@ public class ModernFixConfigScreen extends Screen { public void renderComponentHoverEffect(PoseStack matrixStack, @Nullable Style style, int mouseX, int mouseY) { super.renderComponentHoverEffect(matrixStack, style, mouseX, mouseY); } + + public void setLastScrollAmount(double d) { + this.lastScrollAmount = d; + } } diff --git a/common/src/main/java/org/embeddedt/modernfix/screen/OptionList.java b/common/src/main/java/org/embeddedt/modernfix/screen/OptionList.java index 4405aac8..7a876d86 100644 --- a/common/src/main/java/org/embeddedt/modernfix/screen/OptionList.java +++ b/common/src/main/java/org/embeddedt/modernfix/screen/OptionList.java @@ -158,6 +158,7 @@ public class OptionList extends ContainerObjectSelectionList { }); updateStatus(); this.helpButton = new Button(75, 0, 20, 20, new TextComponent("?"), (arg) -> { + mainScreen.setLastScrollAmount(getScrollAmount()); Minecraft.getInstance().setScreen(new ModernFixOptionInfoScreen(mainScreen, optionName)); }); if(!I18n.exists("modernfix.option." + optionName)) {