Merge 1.18 into 1.19.2

This commit is contained in:
embeddedt 2023-10-25 14:58:33 -04:00
commit b10e9de54c
3 changed files with 13 additions and 2 deletions

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;
@ -156,7 +157,6 @@ public class ModernFixEarlyConfig {
private static final ImmutableMap<String, Boolean> 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)
@ -236,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]");
}

View File

@ -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(Component.translatable("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.addWidget(this.optionList);
this.wikiButton = new Button(this.width / 2 - 155, this.height - 29, 150, 20, Component.translatable("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;
}
}

View File

@ -167,6 +167,7 @@ public class OptionList extends ContainerObjectSelectionList<OptionList.Entry> {
});
updateStatus();
this.helpButton = new Button(75, 0, 20, 20, Component.literal("?"), (arg) -> {
mainScreen.setLastScrollAmount(getScrollAmount());
Minecraft.getInstance().setScreen(new ModernFixOptionInfoScreen(mainScreen, optionName));
});
if(!I18n.exists("modernfix.option." + optionName)) {