Browse Source

Fix require restart

Signed-off-by: shedaniel <daniel@shedaniel.me>
shedaniel 5 years ago
parent
commit
9676ac8ce8

+ 1 - 1
gradle.properties

@@ -3,6 +3,6 @@ minecraft_version=20w18a
 yarn_mappings=20w18a+build.1
 loader_version=0.8.2+build.194
 fabric_version=0.7.1+build.331-1.16
-mod_version=4.0.8-unstable
+mod_version=4.0.9-unstable
 modmenu_version=1.11.2+build.6
 nec_version=1.2.3+1.15.1

+ 3 - 1
src/main/java/me/shedaniel/clothconfig2/gui/ClothConfigScreen.java

@@ -210,13 +210,13 @@ public abstract class ClothConfigScreen extends Screen {
                 entry.save();
         save();
         setEdited(false);
-        requiresRestart = false;
         if (openOtherScreens) {
             if (requiresRestart)
                 ClothConfigScreen.this.client.openScreen(new ClothRequiresRestartScreen(parent));
             else
                 ClothConfigScreen.this.client.openScreen(parent);
         }
+        requiresRestart = false;
     }
     
     @Override
@@ -265,6 +265,8 @@ public abstract class ClothConfigScreen extends Screen {
         addButton(applyButton = new AbstractPressableButtonWidget(25 + (6 + buttonWidths) * 2, height - 26, buttonWidths, 20, new TranslatableText("text.cloth-config.apply")) {
             @Override
             public void onPress() {
+                if (requiresRestart)
+                    ClothConfigScreen.this.client.openScreen(new ClothRequiresRestartScreen(ClothConfigScreen.this));
                 saveAll(false);
             }
             

+ 1 - 1
src/main/java/me/shedaniel/clothconfig2/gui/entries/TextFieldListEntry.java

@@ -42,7 +42,7 @@ public abstract class TextFieldListEntry<T> extends TooltipListEntry<T> {
     @ApiStatus.Internal
     @Deprecated
     protected TextFieldListEntry(Text fieldName, T original, Text resetButtonKey, Supplier<T> defaultValue, Supplier<Optional<Text[]>> tooltipSupplier, boolean requiresRestart) {
-        super(fieldName, tooltipSupplier);
+        super(fieldName, tooltipSupplier, requiresRestart);
         this.defaultValue = defaultValue;
         this.original = original;
         this.textFieldWidget = new TextFieldWidget(MinecraftClient.getInstance().textRenderer, 0, 0, 148, 18, NarratorManager.EMPTY) {