hotfix: MidnightLib 1.7.5 compat

- Also fixes crashes when using the EMF mod
This commit is contained in:
Martin Prokoph
2025-07-15 17:34:49 +02:00
parent 07af46da3c
commit 2ddfe4bd25
3 changed files with 19 additions and 11 deletions

View File

@@ -20,10 +20,6 @@ public class EMFCompat {
public static void init() {
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("entity_model_features.title")));
EMFConfig emfConfig = EMF.config().getConfig();
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("entity_model_features.config.force_models"), (button) -> button.setMessage(emfConfig.attemptRevertingEntityModelsAlteredByAnotherMod ? YES : NO), (button) -> {
emfConfig.attemptRevertingEntityModelsAlteredByAnotherMod = !emfConfig.attemptRevertingEntityModelsAlteredByAnotherMod;
EMF.config().saveToFile();
}));
if (PlatformFunctions.isModLoaded("physicsmod")) {
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("entity_model_features.config.physics"), (button) -> button.setMessage(emfConfig.attemptPhysicsModPatch_2 != EMFConfig.PhysicsModCompatChoice.OFF ?
Text.translatable("entity_model_features.config." + (emfConfig.attemptPhysicsModPatch_2 == EMFConfig.PhysicsModCompatChoice.VANILLA ? "physics.1" : "physics.2")) : ScreenTexts.OFF), (button) -> {

View File

@@ -13,6 +13,7 @@ import net.minecraft.text.TranslatableTextContent;
import net.minecraft.util.Formatting;
import net.puzzlemc.gui.screen.PuzzleOptionsScreen;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.List;
@@ -32,7 +33,7 @@ public class PuzzleOptionListWidget extends MidnightConfig.MidnightConfigListWid
int buttonX = this.width - 160;
for (PuzzleWidget button : buttons) {
if (button.buttonType == ButtonType.TEXT)
this.addButton(List.of(), Text.literal(" ").append(button.descriptionText).formatted(Formatting.BOLD));
this.addButton(List.of(), Text.literal("").append(button.descriptionText).formatted(Formatting.BOLD));
else if (button.buttonType == ButtonType.BUTTON)
this.addButton(List.of(new PuzzleButtonWidget(buttonX, 0, 150, 20, button.buttonTextAction, button.onPress)), button.descriptionText);
else if (button.buttonType == ButtonType.SLIDER)
@@ -44,8 +45,19 @@ public class PuzzleOptionListWidget extends MidnightConfig.MidnightConfigListWid
}
}
public void addButton(List<ClickableWidget> buttons, Text text) {
var entry = new MidnightConfig.ButtonEntry(buttons, text, new MidnightConfig.EntryInfo());
entry.centered = buttons.isEmpty();
var info = new MidnightConfig.EntryInfo(null, "puzzle-gui");
info.comment = new MidnightConfig.Comment() {
@Override
public boolean centered() {
return buttons.isEmpty();
}
public Class<? extends Annotation> annotationType() {return null;}
public String category() {return "";}
public String name() {return "";}
public String url() {return "";}
public String requiredMod() {return "";}
};
var entry = new MidnightConfig.ButtonEntry(buttons, text, info);
this.addEntry(entry);
}
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {

View File

@@ -7,7 +7,7 @@ yarn_mappings=1.21+build.2
enabled_platforms=fabric,neoforge
# Mod Properties
mod_version = 2.0.1
mod_version = 2.0.1.1
maven_group = net.puzzlemc
archives_base_name = puzzle
release_type=release
@@ -22,7 +22,7 @@ neoforge_version=21.0.143
yarn_mappings_patch_neoforge_version = 1.21+build.4
# Libraries
midnightlib_version = 1.6.3
midnightlib_version = 1.7.5+1.21.1
modmenu_version = 11.0.2
# Mod Integrations
@@ -39,8 +39,8 @@ toml4j_version = 0.7.2
cit_resewn_version = 1.1.3+1.20
complete_config_version = 2.3.0
spruceui_version=5.0.0+1.20
emf_version=2.2.3
etf_version=6.2.2
emf_version=2.4.1
etf_version=6.2.9
exordium_version=1.2.1-1.20.2
# Required for LBG
quilt_loader_version=0.19.0-beta.18