shedaniel 5 rokov pred
rodič
commit
d9ec435b09
49 zmenil súbory, kde vykonal 672 pridanie a 773 odobranie
  1. 1 1
      gradle.properties
  2. 31 43
      src/main/java/me/shedaniel/clothconfig2/ClothConfigInitializer.java
  3. 16 16
      src/main/java/me/shedaniel/clothconfig2/api/Modifier.java
  4. 16 16
      src/main/java/me/shedaniel/clothconfig2/api/ModifierKeyCode.java
  5. 8 10
      src/main/java/me/shedaniel/clothconfig2/gui/ClothConfigScreen.java
  6. 14 27
      src/main/java/me/shedaniel/clothconfig2/gui/entries/AbstractListListEntry.java
  7. 15 29
      src/main/java/me/shedaniel/clothconfig2/gui/entries/AbstractTextFieldListListEntry.java
  8. 35 45
      src/main/java/me/shedaniel/clothconfig2/gui/entries/BaseListEntry.java
  9. 1 1
      src/main/java/me/shedaniel/clothconfig2/gui/entries/DoubleListEntry.java
  10. 16 27
      src/main/java/me/shedaniel/clothconfig2/gui/entries/DoubleListListEntry.java
  11. 119 137
      src/main/java/me/shedaniel/clothconfig2/gui/entries/DropdownBoxEntry.java
  12. 1 1
      src/main/java/me/shedaniel/clothconfig2/gui/entries/FloatListEntry.java
  13. 14 25
      src/main/java/me/shedaniel/clothconfig2/gui/entries/FloatListListEntry.java
  14. 1 1
      src/main/java/me/shedaniel/clothconfig2/gui/entries/IntegerListEntry.java
  15. 15 26
      src/main/java/me/shedaniel/clothconfig2/gui/entries/IntegerListListEntry.java
  16. 14 14
      src/main/java/me/shedaniel/clothconfig2/gui/entries/KeyCodeEntry.java
  17. 1 1
      src/main/java/me/shedaniel/clothconfig2/gui/entries/LongListEntry.java
  18. 14 14
      src/main/java/me/shedaniel/clothconfig2/gui/entries/LongListListEntry.java
  19. 19 23
      src/main/java/me/shedaniel/clothconfig2/gui/entries/MultiElementListEntry.java
  20. 16 39
      src/main/java/me/shedaniel/clothconfig2/gui/entries/NestedListListEntry.java
  21. 1 2
      src/main/java/me/shedaniel/clothconfig2/gui/entries/SelectionListEntry.java
  22. 12 12
      src/main/java/me/shedaniel/clothconfig2/gui/entries/StringListListEntry.java
  23. 5 5
      src/main/java/me/shedaniel/clothconfig2/gui/entries/SubCategoryListEntry.java
  24. 4 4
      src/main/java/me/shedaniel/clothconfig2/gui/entries/TextFieldListEntry.java
  25. 5 7
      src/main/java/me/shedaniel/clothconfig2/gui/entries/TooltipListEntry.java
  26. 7 7
      src/main/java/me/shedaniel/clothconfig2/gui/widget/DynamicEntryListWidget.java
  27. 1 1
      src/main/java/me/shedaniel/clothconfig2/gui/widget/DynamicSmoothScrollingEntryListWidget.java
  28. 10 11
      src/main/java/me/shedaniel/clothconfig2/impl/ScissorsHandlerImpl.java
  29. 18 21
      src/main/java/me/shedaniel/clothconfig2/impl/builders/BooleanToggleBuilder.java
  30. 3 3
      src/main/java/me/shedaniel/clothconfig2/impl/builders/DoubleFieldBuilder.java
  31. 32 25
      src/main/java/me/shedaniel/clothconfig2/impl/builders/DoubleListBuilder.java
  32. 5 5
      src/main/java/me/shedaniel/clothconfig2/impl/builders/DropdownMenuBuilder.java
  33. 4 4
      src/main/java/me/shedaniel/clothconfig2/impl/builders/EnumSelectorBuilder.java
  34. 13 17
      src/main/java/me/shedaniel/clothconfig2/impl/builders/FieldBuilder.java
  35. 3 3
      src/main/java/me/shedaniel/clothconfig2/impl/builders/FloatFieldBuilder.java
  36. 32 25
      src/main/java/me/shedaniel/clothconfig2/impl/builders/FloatListBuilder.java
  37. 3 3
      src/main/java/me/shedaniel/clothconfig2/impl/builders/IntFieldBuilder.java
  38. 32 25
      src/main/java/me/shedaniel/clothconfig2/impl/builders/IntListBuilder.java
  39. 3 3
      src/main/java/me/shedaniel/clothconfig2/impl/builders/IntSliderBuilder.java
  40. 13 15
      src/main/java/me/shedaniel/clothconfig2/impl/builders/KeyCodeBuilder.java
  41. 3 3
      src/main/java/me/shedaniel/clothconfig2/impl/builders/LongFieldBuilder.java
  42. 32 25
      src/main/java/me/shedaniel/clothconfig2/impl/builders/LongListBuilder.java
  43. 4 4
      src/main/java/me/shedaniel/clothconfig2/impl/builders/LongSliderBuilder.java
  44. 4 4
      src/main/java/me/shedaniel/clothconfig2/impl/builders/SelectorBuilder.java
  45. 4 4
      src/main/java/me/shedaniel/clothconfig2/impl/builders/StringFieldBuilder.java
  46. 28 21
      src/main/java/me/shedaniel/clothconfig2/impl/builders/StringListBuilder.java
  47. 12 5
      src/main/java/me/shedaniel/clothconfig2/impl/builders/SubCategoryBuilder.java
  48. 8 9
      src/main/java/me/shedaniel/clothconfig2/impl/builders/TextDescriptionBuilder.java
  49. 4 4
      src/main/java/me/shedaniel/clothconfig2/impl/builders/TextFieldBuilder.java

+ 1 - 1
gradle.properties

@@ -2,6 +2,6 @@ minecraft_version=1.15.1
 yarn_mappings=1.15.1+build.37
 loader_version=0.7.4+build.177
 fabric_version=0.4.28+build.288-1.15
-mod_version=2.9
+mod_version=2.9.1
 modmenu_version=1.8.4+build.20
 nec_version=1.2.3+1.15.1

+ 31 - 43
src/main/java/me/shedaniel/clothconfig2/ClothConfigInitializer.java

@@ -37,13 +37,13 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 public class ClothConfigInitializer implements ClientModInitializer {
-
+    
     public static final Logger LOGGER = LogManager.getFormatterLogger("ClothConfig");
     private static EasingMethod easingMethod = EasingMethodImpl.LINEAR;
     private static long scrollDuration = 600;
     private static double scrollStep = 19;
     private static double bounceBackMultiplier = .24;
-
+    
     public static double handleScrollingPosition(double[] target, double scroll, double maxScroll, float delta, double start, double duration) {
         if (getBounceBackMultiplier() >= 0) {
             target[0] = clamp(target[0], maxScroll);
@@ -59,35 +59,35 @@ public class ClothConfigInitializer implements ClientModInitializer {
         else
             return target[0];
     }
-
+    
     public static double expoEase(double start, double end, double amount) {
         return start + (end - start) * getEasingMethod().apply(amount);
     }
-
+    
     public static double clamp(double v, double maxScroll) {
         return clamp(v, maxScroll, DynamicEntryListWidget.SmoothScrollingSettings.CLAMP_EXTENSION);
     }
-
+    
     public static double clamp(double v, double maxScroll, double clampExtension) {
         return MathHelper.clamp(v, -clampExtension, maxScroll + clampExtension);
     }
-
+    
     public static EasingMethod getEasingMethod() {
         return easingMethod;
     }
-
+    
     public static long getScrollDuration() {
         return scrollDuration;
     }
-
+    
     public static double getScrollStep() {
         return scrollStep;
     }
-
+    
     public static double getBounceBackMultiplier() {
         return bounceBackMultiplier;
     }
-
+    
     private static void loadConfig() {
         File file = new File(FabricLoader.getInstance().getConfigDirectory(), "cloth-config2/config.properties");
         try {
@@ -125,7 +125,7 @@ public class ClothConfigInitializer implements ClientModInitializer {
         }
         saveConfig();
     }
-
+    
     private static void saveConfig() {
         File file = new File(FabricLoader.getInstance().getConfigDirectory(), "cloth-config2/config.properties");
         try {
@@ -145,7 +145,7 @@ public class ClothConfigInitializer implements ClientModInitializer {
             bounceBackMultiplier = .24;
         }
     }
-
+    
     @Override
     public void onInitializeClient() {
         loadConfig();
@@ -168,7 +168,7 @@ public class ClothConfigInitializer implements ClientModInitializer {
                         LongSliderEntry scrollDurationEntry = entryBuilder.startLongSlider("option.cloth-config.scrollDuration", scrollDuration, 0, 5000).setTextGetter(integer -> integer <= 0 ? "Value: Disabled" : (integer > 1500 ? String.format("Value: %.1fs", integer / 1000f) : "Value: " + integer + "ms")).setDefaultValue(600).setSaveConsumer(i -> scrollDuration = i).build();
                         DoubleListEntry scrollStepEntry = entryBuilder.startDoubleField("option.cloth-config.scrollStep", scrollStep).setDefaultValue(19).setSaveConsumer(i -> scrollStep = i).build();
                         LongSliderEntry bounceMultiplierEntry = entryBuilder.startLongSlider("option.cloth-config.bounceBackMultiplier", (long) (bounceBackMultiplier * 1000), -10, 750).setTextGetter(integer -> integer < 0 ? "Value: Disabled" : String.format("Value: %s", integer / 1000d)).setDefaultValue(240).setSaveConsumer(i -> bounceBackMultiplier = i / 1000d).build();
-
+                        
                         scrolling.addEntry(new TooltipListEntry<Object>(I18n.translate("option.cloth-config.setDefaultSmoothScroll"), null) {
                             int width = 220;
                             private AbstractButtonWidget buttonWidget = new AbstractPressableButtonWidget(0, 0, 0, 20, getFieldName()) {
@@ -182,26 +182,26 @@ public class ClothConfigInitializer implements ClientModInitializer {
                                 }
                             };
                             private List<AbstractButtonWidget> children = ImmutableList.of(buttonWidget);
-
+                            
                             @Override
                             public Object getValue() {
                                 return null;
                             }
-
+                            
                             @Override
                             public Optional<Object> getDefaultValue() {
                                 return Optional.empty();
                             }
-
+                            
                             @Override
                             public void save() {
                             }
-
+                            
                             @Override
                             public List<? extends Element> children() {
                                 return children;
                             }
-
+                            
                             @Override
                             public void render(int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isSelected, float delta) {
                                 super.render(index, y, x, entryWidth, entryHeight, mouseX, mouseY, isSelected, delta);
@@ -213,7 +213,7 @@ public class ClothConfigInitializer implements ClientModInitializer {
                                 this.buttonWidget.render(mouseX, mouseY, delta);
                             }
                         });
-
+                        
                         scrolling.addEntry(new TooltipListEntry<Object>(I18n.translate("option.cloth-config.disableSmoothScroll"), null) {
                             int width = 220;
                             private AbstractButtonWidget buttonWidget = new AbstractPressableButtonWidget(0, 0, 0, 20, getFieldName()) {
@@ -227,26 +227,26 @@ public class ClothConfigInitializer implements ClientModInitializer {
                                 }
                             };
                             private List<AbstractButtonWidget> children = ImmutableList.of(buttonWidget);
-
+                            
                             @Override
                             public Object getValue() {
                                 return null;
                             }
-
+                            
                             @Override
                             public Optional<Object> getDefaultValue() {
                                 return Optional.empty();
                             }
-
+                            
                             @Override
                             public void save() {
                             }
-
+                            
                             @Override
                             public List<? extends Element> children() {
                                 return children;
                             }
-
+                            
                             @Override
                             public void render(int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isSelected, float delta) {
                                 super.render(index, y, x, entryWidth, entryHeight, mouseX, mouseY, isSelected, delta);
@@ -266,21 +266,9 @@ public class ClothConfigInitializer implements ClientModInitializer {
                         testing.addEntry(entryBuilder.startDropdownMenu("lol apple", DropdownMenuBuilder.TopCellElementBuilder.ofItemObject(Items.APPLE), DropdownMenuBuilder.CellCreatorBuilder.ofItemObject()).setDefaultValue(Items.APPLE).setSelections(Registry.ITEM.stream().sorted(Comparator.comparing(Item::toString)).collect(Collectors.toCollection(LinkedHashSet::new))).setSaveConsumer(item -> System.out.println("save this " + item)).build());
                         testing.addEntry(entryBuilder.startKeyCodeField("Cool Key", InputUtil.UNKNOWN_KEYCODE).setDefaultValue(InputUtil.UNKNOWN_KEYCODE).build());
                         testing.addEntry(entryBuilder.startModifierKeyCodeField("Cool Modifier Key", ModifierKeyCode.of(InputUtil.Type.KEYSYM.createFromCode(79), Modifier.of(false, true, false))).setDefaultValue(ModifierKeyCode.of(InputUtil.Type.KEYSYM.createFromCode(79), Modifier.of(false, true, false))).build());
-                        testing.addEntry(
-                                entryBuilder.startDoubleList("A list of Doubles", Arrays.asList(1d, 2d, 3d))
-                                        .setDefaultValue(Arrays.asList(1d, 2d, 3d))
-                                        .build()
-                        );
-                        testing.addEntry(
-                                entryBuilder.startLongList("A list of Longs", Arrays.asList(1L, 2L, 3L))
-                                        .setDefaultValue(Arrays.asList(1L, 2L, 3L))
-                                        .build()
-                        );
-                        testing.addEntry(
-                                entryBuilder.startStrList("A list of Strings", Arrays.asList("abc", "xyz"))
-                                        .setDefaultValue(Arrays.asList("abc", "xyz"))
-                                        .build()
-                        );
+                        testing.addEntry(entryBuilder.startDoubleList("A list of Doubles", Arrays.asList(1d, 2d, 3d)).setDefaultValue(Arrays.asList(1d, 2d, 3d)).build());
+                        testing.addEntry(entryBuilder.startLongList("A list of Longs", Arrays.asList(1L, 2L, 3L)).setDefaultValue(Arrays.asList(1L, 2L, 3L)).build());
+                        testing.addEntry(entryBuilder.startStrList("A list of Strings", Arrays.asList("abc", "xyz")).setDefaultValue(Arrays.asList("abc", "xyz")).build());
                         builder.setSavingRunnable(ClothConfigInitializer::saveConfig);
                         builder.transparentBackground();
                         MinecraftClient.getInstance().openScreen(builder.build());
@@ -297,18 +285,18 @@ public class ClothConfigInitializer implements ClientModInitializer {
             //            });
         }
     }
-
+    
     public static class Precision {
         public static final float FLOAT_EPSILON = 1e-3f;
         public static final double DOUBLE_EPSILON = 1e-7;
-
+        
         public static boolean almostEquals(float value1, float value2, float acceptableDifference) {
             return Math.abs(value1 - value2) <= acceptableDifference;
         }
-
+        
         public static boolean almostEquals(double value1, double value2, double acceptableDifference) {
             return Math.abs(value1 - value2) <= acceptableDifference;
         }
     }
-
+    
 }

+ 16 - 16
src/main/java/me/shedaniel/clothconfig2/api/Modifier.java

@@ -48,6 +48,22 @@ public class Modifier {
         return Modifier.of(Screen.hasAltDown(), Screen.hasControlDown(), Screen.hasShiftDown());
     }
     
+    private static short setFlag(short base, short flag, boolean val) {
+        return val ? setFlag(base, flag) : removeFlag(base, flag);
+    }
+    
+    private static short setFlag(short base, short flag) {
+        return (short) (base | flag);
+    }
+    
+    private static short removeFlag(short base, short flag) {
+        return (short) (base & (~flag));
+    }
+    
+    private static boolean getFlag(short base, short flag) {
+        return (base & flag) != 0;
+    }
+    
     /**
      * Compares this object with the current pressed keys
      *
@@ -122,20 +138,4 @@ public class Modifier {
         return Objects.hash(value);
     }
     
-    private static short setFlag(short base, short flag, boolean val) {
-        return val ? setFlag(base, flag) : removeFlag(base, flag);
-    }
-    
-    private static short setFlag(short base, short flag) {
-        return (short) (base | flag);
-    }
-    
-    private static short removeFlag(short base, short flag) {
-        return (short) (base & (~flag));
-    }
-    
-    private static boolean getFlag(short base, short flag) {
-        return (base & flag) != 0;
-    }
-    
 }

+ 16 - 16
src/main/java/me/shedaniel/clothconfig2/api/ModifierKeyCode.java

@@ -6,14 +6,30 @@ import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.util.InputUtil;
 
 public interface ModifierKeyCode {
+    static ModifierKeyCode of(InputUtil.KeyCode keyCode, Modifier modifier) {
+        return new ModifierKeyCodeImpl().setKeyCodeAndModifier(keyCode, modifier);
+    }
+    
+    static ModifierKeyCode copyOf(ModifierKeyCode code) {
+        return of(code.getKeyCode(), code.getModifier());
+    }
+    
+    static ModifierKeyCode unknown() {
+        return of(InputUtil.UNKNOWN_KEYCODE, Modifier.none());
+    }
+    
     InputUtil.KeyCode getKeyCode();
     
+    ModifierKeyCode setKeyCode(InputUtil.KeyCode keyCode);
+    
     default InputUtil.Type getType() {
         return getKeyCode().getCategory();
     }
     
     Modifier getModifier();
     
+    ModifierKeyCode setModifier(Modifier modifier);
+    
     default boolean matchesMouse(int button) {
         return !isUnknown() && getType() == InputUtil.Type.MOUSE && getKeyCode().getKeyCode() == button && getModifier().matchesCurrent();
     }
@@ -46,10 +62,6 @@ public interface ModifierKeyCode {
         return !isUnknown() && getType() == InputUtil.Type.KEYSYM && getModifier().matchesCurrent() && InputUtil.isKeyPressed(MinecraftClient.getInstance().getWindow().getHandle(), getKeyCode().getKeyCode());
     }
     
-    ModifierKeyCode setKeyCode(InputUtil.KeyCode keyCode);
-    
-    ModifierKeyCode setModifier(Modifier modifier);
-    
     default ModifierKeyCode setKeyCodeAndModifier(InputUtil.KeyCode keyCode, Modifier modifier) {
         setKeyCode(keyCode);
         setModifier(modifier);
@@ -60,18 +72,6 @@ public interface ModifierKeyCode {
         return setModifier(Modifier.none());
     }
     
-    static ModifierKeyCode of(InputUtil.KeyCode keyCode, Modifier modifier) {
-        return new ModifierKeyCodeImpl().setKeyCodeAndModifier(keyCode, modifier);
-    }
-    
-    static ModifierKeyCode copyOf(ModifierKeyCode code) {
-        return of(code.getKeyCode(), code.getModifier());
-    }
-    
-    static ModifierKeyCode unknown() {
-        return of(InputUtil.UNKNOWN_KEYCODE, Modifier.none());
-    }
-    
     String toString();
     
     default String getLocalizedName() {

+ 8 - 10
src/main/java/me/shedaniel/clothconfig2/gui/ClothConfigScreen.java

@@ -41,12 +41,12 @@ public abstract class ClothConfigScreen extends Screen {
     
     private static final Identifier CONFIG_TEX = new Identifier("cloth-config2", "textures/gui/cloth_config.png");
     private final List<QueuedTooltip> queuedTooltips = Lists.newArrayList();
-    private KeyCodeEntry focusedBinding;
     public int nextTabIndex;
     public int selectedTabIndex;
     public double tabsScrollVelocity = 0d;
     public double tabsScrollProgress = 0d;
     public ListWidget<AbstractConfigEntry<AbstractConfigEntry>> listWidget;
+    private KeyCodeEntry focusedBinding;
     private Screen parent;
     private LinkedHashMap<String, List<AbstractConfigEntry>> tabbedEntries;
     private List<Pair<String, Integer>> tabs;
@@ -65,10 +65,10 @@ public abstract class ClothConfigScreen extends Screen {
     private Map<String, Identifier> categoryBackgroundLocation;
     private boolean transparentBackground = false;
     private boolean editable = true;
-    @Nullable
-    private String defaultFallbackCategory = null;
+    @Nullable private String defaultFallbackCategory = null;
     private boolean alwaysShowTabs = false;
-
+    private ModifierKeyCode startedKeyCode = null;
+    
     @Deprecated
     public ClothConfigScreen(Screen parent, String title, Map<String, List<Pair<String, Object>>> o, boolean confirmSave, boolean displayErrors, boolean smoothScrollingList, Identifier defaultBackgroundLocation, Map<String, Identifier> categoryBackgroundLocation) {
         super(new LiteralText(""));
@@ -472,6 +472,10 @@ public abstract class ClothConfigScreen extends Screen {
         tessellator.draw();
     }
     
+    public KeyCodeEntry getFocusedBinding() {
+        return focusedBinding;
+    }
+    
     public void setFocusedBinding(KeyCodeEntry focusedBinding) {
         this.focusedBinding = focusedBinding;
         if (focusedBinding != null) {
@@ -481,12 +485,6 @@ public abstract class ClothConfigScreen extends Screen {
             startedKeyCode = null;
     }
     
-    public KeyCodeEntry getFocusedBinding() {
-        return focusedBinding;
-    }
-    
-    private ModifierKeyCode startedKeyCode = null;
-    
     @Override
     public boolean mouseReleased(double double_1, double double_2, int int_1) {
         if (this.focusedBinding != null && this.startedKeyCode != null && !this.startedKeyCode.isUnknown() && focusedBinding.isAllowMouse()) {

+ 14 - 27
src/main/java/me/shedaniel/clothconfig2/gui/entries/AbstractListListEntry.java

@@ -18,24 +18,12 @@ import java.util.stream.Collectors;
  * @see BaseListEntry
  */
 @ApiStatus.Internal
-public abstract class AbstractListListEntry<T, C extends AbstractListListEntry.AbstractListCell<T, C, SELF>, SELF extends AbstractListListEntry<T, C, SELF>>
-        extends BaseListEntry<T, C, SELF> {
-
+public abstract class AbstractListListEntry<T, C extends AbstractListListEntry.AbstractListCell<T, C, SELF>, SELF extends AbstractListListEntry<T, C, SELF>> extends BaseListEntry<T, C, SELF> {
+    
     protected final BiFunction<T, SELF, C> createNewCell;
     protected Function<T, Optional<String>> cellErrorSupplier;
-
-    public AbstractListListEntry(
-            String fieldName,
-            List<T> value,
-            boolean defaultExpanded,
-            Supplier<Optional<String[]>> tooltipSupplier,
-            Consumer<List<T>> saveConsumer,
-            Supplier<List<T>> defaultValue,
-            String resetButtonKey,
-            boolean requiresRestart,
-            boolean deleteButtonEnabled,
-            boolean insertInFront,
-            BiFunction<T, SELF, C> createNewCell) {
+    
+    public AbstractListListEntry(String fieldName, List<T> value, boolean defaultExpanded, Supplier<Optional<String[]>> tooltipSupplier, Consumer<List<T>> saveConsumer, Supplier<List<T>> defaultValue, String resetButtonKey, boolean requiresRestart, boolean deleteButtonEnabled, boolean insertInFront, BiFunction<T, SELF, C> createNewCell) {
         super(fieldName, tooltipSupplier, defaultValue, abstractListListEntry -> createNewCell.apply(null, abstractListListEntry), saveConsumer, resetButtonKey, requiresRestart, deleteButtonEnabled, insertInFront);
         this.createNewCell = createNewCell;
         for (T f : value)
@@ -43,25 +31,25 @@ public abstract class AbstractListListEntry<T, C extends AbstractListListEntry.A
         this.widgets.addAll(cells);
         expanded = defaultExpanded;
     }
-
+    
     public Function<T, Optional<String>> getCellErrorSupplier() {
         return cellErrorSupplier;
     }
-
+    
     public void setCellErrorSupplier(Function<T, Optional<String>> cellErrorSupplier) {
         this.cellErrorSupplier = cellErrorSupplier;
     }
-
+    
     @Override
     public List<T> getValue() {
         return cells.stream().map(C::getValue).collect(Collectors.toList());
     }
-
+    
     @Override
     protected C getFromValue(T value) {
         return createNewCell.apply(value, this.self());
     }
-
+    
     /**
      * @param <T>           the configuration object type
      * @param <SELF>        the "curiously recurring template pattern" type parameter for this class
@@ -69,17 +57,16 @@ public abstract class AbstractListListEntry<T, C extends AbstractListListEntry.A
      * @see AbstractListListEntry
      */
     @ApiStatus.Internal
-    public static abstract class AbstractListCell<T, SELF extends AbstractListCell<T, SELF, OUTER_SELF>, OUTER_SELF extends AbstractListListEntry<T, SELF, OUTER_SELF>>
-            extends BaseListCell {
+    public static abstract class AbstractListCell<T, SELF extends AbstractListCell<T, SELF, OUTER_SELF>, OUTER_SELF extends AbstractListListEntry<T, SELF, OUTER_SELF>> extends BaseListCell {
         protected final OUTER_SELF listListEntry;
-
+        
         public AbstractListCell(@Nullable T value, OUTER_SELF listListEntry) {
             this.listListEntry = listListEntry;
             this.setErrorSupplier(() -> Optional.ofNullable(listListEntry.cellErrorSupplier).flatMap(cellErrorFn -> cellErrorFn.apply(this.getValue())));
         }
-
+        
         public abstract T getValue();
-
+        
     }
-
+    
 }

+ 15 - 29
src/main/java/me/shedaniel/clothconfig2/gui/entries/AbstractTextFieldListListEntry.java

@@ -24,25 +24,12 @@ import java.util.function.Supplier;
  * @see AbstractListListEntry
  */
 @ApiStatus.Internal
-public abstract class AbstractTextFieldListListEntry<T, C extends AbstractTextFieldListListEntry.AbstractTextFieldListCell<T, C, SELF>, SELF extends AbstractTextFieldListListEntry<T, C, SELF>>
-        extends AbstractListListEntry<T, C, SELF> {
-
-    public AbstractTextFieldListListEntry(
-            String fieldName,
-            List<T> value,
-            boolean defaultExpanded,
-            Supplier<Optional<String[]>> tooltipSupplier,
-            Consumer<List<T>> saveConsumer,
-            Supplier<List<T>> defaultValue,
-            String resetButtonKey,
-            boolean requiresRestart,
-            boolean deleteButtonEnabled,
-            boolean insertInFront,
-            BiFunction<T, SELF, C> createNewCell
-    ) {
+public abstract class AbstractTextFieldListListEntry<T, C extends AbstractTextFieldListListEntry.AbstractTextFieldListCell<T, C, SELF>, SELF extends AbstractTextFieldListListEntry<T, C, SELF>> extends AbstractListListEntry<T, C, SELF> {
+    
+    public AbstractTextFieldListListEntry(String fieldName, List<T> value, boolean defaultExpanded, Supplier<Optional<String[]>> tooltipSupplier, Consumer<List<T>> saveConsumer, Supplier<List<T>> defaultValue, String resetButtonKey, boolean requiresRestart, boolean deleteButtonEnabled, boolean insertInFront, BiFunction<T, SELF, C> createNewCell) {
         super(fieldName, value, defaultExpanded, tooltipSupplier, saveConsumer, defaultValue, resetButtonKey, requiresRestart, deleteButtonEnabled, insertInFront, createNewCell);
     }
-
+    
     /**
      * @param <T>           the configuration object type
      * @param <SELF>        the "curiously recurring template pattern" type parameter for this class
@@ -50,16 +37,15 @@ public abstract class AbstractTextFieldListListEntry<T, C extends AbstractTextFi
      * @see AbstractTextFieldListListEntry
      */
     @ApiStatus.Internal
-    public static abstract class AbstractTextFieldListCell<T, SELF extends AbstractTextFieldListCell<T, SELF, OUTER_SELF>, OUTER_SELF extends AbstractTextFieldListListEntry<T, SELF, OUTER_SELF>>
-            extends AbstractListListEntry.AbstractListCell<T, SELF, OUTER_SELF> {
-
+    public static abstract class AbstractTextFieldListCell<T, SELF extends AbstractTextFieldListCell<T, SELF, OUTER_SELF>, OUTER_SELF extends AbstractTextFieldListListEntry<T, SELF, OUTER_SELF>> extends AbstractListListEntry.AbstractListCell<T, SELF, OUTER_SELF> {
+        
         protected TextFieldWidget widget;
-
+        
         public AbstractTextFieldListCell(@Nullable T value, OUTER_SELF listListEntry) {
             super(value, listListEntry);
-
+            
             final T finalValue = substituteDefault(value);
-
+            
             widget = new TextFieldWidget(MinecraftClient.getInstance().textRenderer, 0, 0, 100, 18, "");
             widget.setTextPredicate(this::isValidText);
             widget.setMaxLength(Integer.MAX_VALUE);
@@ -72,7 +58,7 @@ public abstract class AbstractTextFieldListListEntry<T, C extends AbstractTextFi
                 }
             });
         }
-
+        
         /**
          * Allows subclasses to substitute default values.
          *
@@ -81,7 +67,7 @@ public abstract class AbstractTextFieldListListEntry<T, C extends AbstractTextFi
          */
         @Nullable
         protected abstract T substituteDefault(@Nullable T value);
-
+        
         /**
          * Tests if the text entered is valid. If not, the text is not changed.
          *
@@ -89,12 +75,12 @@ public abstract class AbstractTextFieldListListEntry<T, C extends AbstractTextFi
          * @return {@code true} if the text may be changed, {@code false} to prevent the change
          */
         protected abstract boolean isValidText(@NotNull String text);
-
+        
         @Override
         public int getCellHeight() {
             return 20;
         }
-
+        
         @Override
         public void render(int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isSelected, float delta) {
             widget.setWidth(entryWidth - 12);
@@ -105,11 +91,11 @@ public abstract class AbstractTextFieldListListEntry<T, C extends AbstractTextFi
             if (isSelected && listListEntry.isEditable())
                 fill(x, y + 12, x + entryWidth - 12, y + 13, getConfigError().isPresent() ? 0xffff5555 : 0xffe0e0e0);
         }
-
+        
         @Override
         public List<? extends Element> children() {
             return Collections.singletonList(widget);
         }
     }
-
+    
 }

+ 35 - 45
src/main/java/me/shedaniel/clothconfig2/gui/entries/BaseListEntry.java

@@ -33,36 +33,30 @@ import java.util.stream.Collectors;
  */
 @ApiStatus.Internal
 public abstract class BaseListEntry<T, C extends BaseListCell, SELF extends BaseListEntry<T, C, SELF>> extends TooltipListEntry<List<T>> {
-
+    
     protected static final Identifier CONFIG_TEX = new Identifier("cloth-config2", "textures/gui/cloth_config.png");
-    @NotNull
-    protected final List<C> cells;
-    @NotNull
-    protected final List<Element> widgets;
+    @NotNull protected final List<C> cells;
+    @NotNull protected final List<Element> widgets;
     protected boolean expanded;
     protected boolean deleteButtonEnabled;
     protected boolean insertInFront;
-    @Nullable
-    protected Consumer<List<T>> saveConsumer;
+    @Nullable protected Consumer<List<T>> saveConsumer;
     protected ListLabelWidget labelWidget;
     protected AbstractButtonWidget resetWidget;
-    @NotNull
-    protected Function<SELF, C> createNewInstance;
-    @NotNull
-    protected Supplier<List<T>> defaultValue;
-    @Nullable
-    protected String addTooltip = I18n.translate("text.cloth-config.list.add"), removeTooltip = I18n.translate("text.cloth-config.list.remove");
-
+    @NotNull protected Function<SELF, C> createNewInstance;
+    @NotNull protected Supplier<List<T>> defaultValue;
+    @Nullable protected String addTooltip = I18n.translate("text.cloth-config.list.add"), removeTooltip = I18n.translate("text.cloth-config.list.remove");
+    
     @Deprecated
     public BaseListEntry(@NotNull String fieldName, @Nullable Supplier<Optional<String[]>> tooltipSupplier, @NotNull Supplier<List<T>> defaultValue, @NotNull Function<SELF, C> createNewInstance, @Nullable Consumer<List<T>> saveConsumer, String resetButtonKey) {
         this(fieldName, tooltipSupplier, defaultValue, createNewInstance, saveConsumer, resetButtonKey, false);
     }
-
+    
     @Deprecated
     public BaseListEntry(@NotNull String fieldName, @Nullable Supplier<Optional<String[]>> tooltipSupplier, @NotNull Supplier<List<T>> defaultValue, @NotNull Function<SELF, C> createNewInstance, @Nullable Consumer<List<T>> saveConsumer, String resetButtonKey, boolean requiresRestart) {
         this(fieldName, tooltipSupplier, defaultValue, createNewInstance, saveConsumer, resetButtonKey, requiresRestart, true, true);
     }
-
+    
     @Deprecated
     public BaseListEntry(@NotNull String fieldName, @Nullable Supplier<Optional<String[]>> tooltipSupplier, @NotNull Supplier<List<T>> defaultValue, @NotNull Function<SELF, C> createNewInstance, @Nullable Consumer<List<T>> saveConsumer, String resetButtonKey, boolean requiresRestart, boolean deleteButtonEnabled, boolean insertInFront) {
         super(fieldName, tooltipSupplier, requiresRestart);
@@ -83,47 +77,47 @@ public abstract class BaseListEntry<T, C extends BaseListCell, SELF extends Base
         this.createNewInstance = createNewInstance;
         this.defaultValue = defaultValue;
     }
-
+    
     public abstract SELF self();
-
+    
     public boolean isDeleteButtonEnabled() {
         return deleteButtonEnabled;
     }
-
+    
     protected abstract C getFromValue(T value);
-
+    
     @NotNull
     public Function<SELF, C> getCreateNewInstance() {
         return createNewInstance;
     }
-
+    
     public void setCreateNewInstance(@NotNull Function<SELF, C> createNewInstance) {
         this.createNewInstance = createNewInstance;
     }
-
+    
     @Nullable
     public String getAddTooltip() {
         return addTooltip;
     }
-
+    
     public void setAddTooltip(@Nullable String addTooltip) {
         this.addTooltip = addTooltip;
     }
-
+    
     @Nullable
     public String getRemoveTooltip() {
         return removeTooltip;
     }
-
+    
     public void setRemoveTooltip(@Nullable String removeTooltip) {
         this.removeTooltip = removeTooltip;
     }
-
+    
     @Override
     public Optional<List<T>> getDefaultValue() {
         return Optional.ofNullable(defaultValue.get());
     }
-
+    
     @Override
     public int getItemHeight() {
         if (expanded) {
@@ -134,32 +128,28 @@ public abstract class BaseListEntry<T, C extends BaseListCell, SELF extends Base
         }
         return 24;
     }
-
+    
     @Override
     public List<? extends Element> children() {
         return widgets;
     }
-
+    
     @Override
     public Optional<String> getError() {
-        List<String> errors = cells.stream()
-                .map(C::getConfigError)
-                .filter(Optional::isPresent)
-                .map(Optional::get)
-                .collect(Collectors.toList());
-
+        List<String> errors = cells.stream().map(C::getConfigError).filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList());
+        
         if (errors.size() > 1)
             return Optional.of(I18n.translate("text.cloth-config.multi_error"));
         else
             return errors.stream().findFirst();
     }
-
+    
     @Override
     public void save() {
         if (saveConsumer != null)
             saveConsumer.accept(getValue());
     }
-
+    
     @Override
     public boolean isMouseInside(int mouseX, int mouseY, int x, int y, int entryWidth, int entryHeight) {
         labelWidget.rectangle.x = x - 15;
@@ -168,15 +158,15 @@ public abstract class BaseListEntry<T, C extends BaseListCell, SELF extends Base
         labelWidget.rectangle.height = 24;
         return labelWidget.rectangle.contains(mouseX, mouseY) && getParent().isMouseOver(mouseX, mouseY) && !resetWidget.isMouseOver(mouseX, mouseY);
     }
-
+    
     protected boolean isInsideCreateNew(double mouseX, double mouseY) {
         return mouseX >= labelWidget.rectangle.x + 12 && mouseY >= labelWidget.rectangle.y + 3 && mouseX <= labelWidget.rectangle.x + 12 + 11 && mouseY <= labelWidget.rectangle.y + 3 + 11;
     }
-
+    
     protected boolean isInsideDelete(double mouseX, double mouseY) {
         return isDeleteButtonEnabled() && mouseX >= labelWidget.rectangle.x + 25 && mouseY >= labelWidget.rectangle.y + 3 && mouseX <= labelWidget.rectangle.x + 25 + 11 && mouseY <= labelWidget.rectangle.y + 3 + 11;
     }
-
+    
     public Optional<String[]> getTooltip(int mouseX, int mouseY) {
         if (addTooltip != null && isInsideCreateNew(mouseX, mouseY))
             return Optional.of(new String[]{addTooltip});
@@ -186,7 +176,7 @@ public abstract class BaseListEntry<T, C extends BaseListCell, SELF extends Base
             return getTooltipSupplier().get();
         return Optional.empty();
     }
-
+    
     @Override
     public void render(int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isSelected, float delta) {
         labelWidget.rectangle.x = x - 19;
@@ -221,14 +211,14 @@ public abstract class BaseListEntry<T, C extends BaseListCell, SELF extends Base
             }
         }
     }
-
+    
     public boolean insertInFront() {
         return insertInFront;
     }
-
+    
     public class ListLabelWidget implements Element {
         protected Rectangle rectangle = new Rectangle();
-
+        
         @Override
         public boolean mouseClicked(double double_1, double double_2, int int_1) {
             if (resetWidget.isMouseOver(double_1, double_2)) {
@@ -264,5 +254,5 @@ public abstract class BaseListEntry<T, C extends BaseListCell, SELF extends Base
             return false;
         }
     }
-
+    
 }

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

@@ -15,7 +15,7 @@ public class DoubleListEntry extends TextFieldListEntry<Double> {
         char[] var2 = s.toCharArray();
         int var3 = var2.length;
         
-        for(int var4 = 0; var4 < var3; ++var4)
+        for (int var4 = 0; var4 < var3; ++var4)
             if (Character.isDigit(var2[var4]) || var2[var4] == '-' || var2[var4] == '.')
                 stringBuilder_1.append(var2[var4]);
         

+ 16 - 27
src/main/java/me/shedaniel/clothconfig2/gui/entries/DoubleListListEntry.java

@@ -12,57 +12,46 @@ import java.util.function.Supplier;
 
 @ApiStatus.Internal
 public class DoubleListListEntry extends AbstractTextFieldListListEntry<Double, DoubleListListEntry.DoubleListCell, DoubleListListEntry> {
-
+    
     private double minimum, maximum;
-
+    
     @Deprecated
     public DoubleListListEntry(String fieldName, List<Double> value, boolean defaultExpanded, Supplier<Optional<String[]>> tooltipSupplier, Consumer<List<Double>> saveConsumer, Supplier<List<Double>> defaultValue, String resetButtonKey) {
         this(fieldName, value, defaultExpanded, tooltipSupplier, saveConsumer, defaultValue, resetButtonKey, false);
     }
-
+    
     @Deprecated
     public DoubleListListEntry(String fieldName, List<Double> value, boolean defaultExpanded, Supplier<Optional<String[]>> tooltipSupplier, Consumer<List<Double>> saveConsumer, Supplier<List<Double>> defaultValue, String resetButtonKey, boolean requiresRestart) {
         this(fieldName, value, defaultExpanded, tooltipSupplier, saveConsumer, defaultValue, resetButtonKey, requiresRestart, true, true);
     }
-
-    public DoubleListListEntry(
-            String fieldName,
-            List<Double> value,
-            boolean defaultExpanded,
-            Supplier<Optional<String[]>> tooltipSupplier,
-            Consumer<List<Double>> saveConsumer,
-            Supplier<List<Double>> defaultValue,
-            String resetButtonKey,
-            boolean requiresRestart,
-            boolean deleteButtonEnabled,
-            boolean insertInFront
-    ) {
+    
+    public DoubleListListEntry(String fieldName, List<Double> value, boolean defaultExpanded, Supplier<Optional<String[]>> tooltipSupplier, Consumer<List<Double>> saveConsumer, Supplier<List<Double>> defaultValue, String resetButtonKey, boolean requiresRestart, boolean deleteButtonEnabled, boolean insertInFront) {
         super(fieldName, value, defaultExpanded, tooltipSupplier, saveConsumer, defaultValue, resetButtonKey, requiresRestart, deleteButtonEnabled, insertInFront, DoubleListCell::new);
         this.minimum = Double.NEGATIVE_INFINITY;
         this.maximum = Double.POSITIVE_INFINITY;
     }
-
+    
     public DoubleListListEntry setMaximum(Double maximum) {
         this.maximum = maximum;
         return this;
     }
-
+    
     public DoubleListListEntry setMinimum(Double minimum) {
         this.minimum = minimum;
         return this;
     }
-
+    
     @Override
     public DoubleListListEntry self() {
         return this;
     }
-
+    
     public static class DoubleListCell extends AbstractTextFieldListListEntry.AbstractTextFieldListCell<Double, DoubleListCell, DoubleListListEntry> {
-
+        
         public DoubleListCell(Double value, final DoubleListListEntry listListEntry) {
             super(value, listListEntry);
         }
-
+        
         @Nullable
         @Override
         protected Double substituteDefault(@Nullable Double value) {
@@ -71,12 +60,12 @@ public class DoubleListListEntry extends AbstractTextFieldListListEntry<Double,
             else
                 return value;
         }
-
+        
         @Override
         protected boolean isValidText(@NotNull String text) {
             return text.chars().allMatch(c -> Character.isDigit(c) || c == '-' || c == '.');
         }
-
+        
         public Double getValue() {
             try {
                 return Double.valueOf(widget.getText());
@@ -84,7 +73,7 @@ public class DoubleListListEntry extends AbstractTextFieldListListEntry<Double,
                 return 0d;
             }
         }
-
+        
         @Override
         public Optional<String> getError() {
             try {
@@ -98,7 +87,7 @@ public class DoubleListListEntry extends AbstractTextFieldListListEntry<Double,
             }
             return Optional.empty();
         }
-
+        
     }
-
+    
 }

+ 119 - 137
src/main/java/me/shedaniel/clothconfig2/gui/entries/DropdownBoxEntry.java

@@ -33,22 +33,14 @@ import java.util.function.Supplier;
 
 @SuppressWarnings("deprecation")
 public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
-
+    
     protected ButtonWidget resetButton;
     protected SelectionElement<T> selectionElement;
-    @NotNull
-    private Supplier<T> defaultValue;
-    @Nullable
-    private Consumer<T> saveConsumer;
-
+    @NotNull private Supplier<T> defaultValue;
+    @Nullable private Consumer<T> saveConsumer;
+    
     @Deprecated
-    public DropdownBoxEntry(String fieldName,
-                            @NotNull String resetButtonKey,
-                            @Nullable Supplier<Optional<String[]>> tooltipSupplier, boolean requiresRestart,
-                            @Nullable Supplier<T> defaultValue,
-                            @Nullable Consumer<T> saveConsumer,
-                            @Nullable Iterable<T> selections,
-                            @NotNull SelectionTopCellElement<T> topRenderer, @NotNull SelectionCellCreator<T> cellCreator) {
+    public DropdownBoxEntry(String fieldName, @NotNull String resetButtonKey, @Nullable Supplier<Optional<String[]>> tooltipSupplier, boolean requiresRestart, @Nullable Supplier<T> defaultValue, @Nullable Consumer<T> saveConsumer, @Nullable Iterable<T> selections, @NotNull SelectionTopCellElement<T> topRenderer, @NotNull SelectionCellCreator<T> cellCreator) {
         super(I18n.translate(fieldName), tooltipSupplier, requiresRestart);
         this.defaultValue = defaultValue;
         this.saveConsumer = saveConsumer;
@@ -58,7 +50,7 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
         });
         this.selectionElement = new SelectionElement(this, new Rectangle(0, 0, 150, 20), new DefaultDropdownMenuElement(selections == null ? ImmutableList.of() : ImmutableList.copyOf(selections)), topRenderer, cellCreator);
     }
-
+    
     @Override
     public void render(int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isSelected, float delta) {
         super.render(index, y, x, entryWidth, entryHeight, mouseX, mouseY, isSelected, delta);
@@ -80,58 +72,58 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
         resetButton.render(mouseX, mouseY, delta);
         selectionElement.render(mouseX, mouseY, delta);
     }
-
+    
     @NotNull
     public ImmutableList<T> getSelections() {
         return selectionElement.menu.getSelections();
     }
-
+    
     @Override
     public T getValue() {
         return selectionElement.getValue();
     }
-
+    
     @Deprecated
     public SelectionElement<T> getSelectionElement() {
         return selectionElement;
     }
-
+    
     @Override
     public Optional<T> getDefaultValue() {
         return defaultValue == null ? Optional.empty() : Optional.ofNullable(defaultValue.get());
     }
-
+    
     @Override
     public void save() {
         if (saveConsumer != null)
             saveConsumer.accept(getValue());
     }
-
+    
     @Override
     public List<? extends Element> children() {
         return Lists.newArrayList(selectionElement, resetButton);
     }
-
+    
     @Override
     public Optional<String> getError() {
         return selectionElement.topRenderer.getError();
     }
-
+    
     @Override
     public void lateRender(int mouseX, int mouseY, float delta) {
         selectionElement.lateRender(mouseX, mouseY, delta);
     }
-
+    
     @Override
     public int getMorePossibleHeight() {
         return selectionElement.getMorePossibleHeight();
     }
-
+    
     @Override
     public boolean mouseScrolled(double double_1, double double_2, double double_3) {
         return selectionElement.mouseScrolled(double_1, double_2, double_3);
     }
-
+    
     public static class SelectionElement<R> extends AbstractParentElement implements Drawable {
         protected Rectangle bounds;
         protected boolean active;
@@ -139,7 +131,7 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
         protected DropdownBoxEntry<R> entry;
         protected DropdownMenuElement<R> menu;
         protected boolean dontReFocus = false;
-
+        
         public SelectionElement(DropdownBoxEntry<R> entry, Rectangle bounds, DropdownMenuElement<R> menu, SelectionTopCellElement<R> topRenderer, SelectionCellCreator<R> cellCreator) {
             this.bounds = bounds;
             this.entry = entry;
@@ -150,7 +142,7 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
             this.topRenderer = Objects.requireNonNull(topRenderer);
             this.topRenderer.entry = entry;
         }
-
+        
         @Override
         public void render(int mouseX, int mouseY, float delta) {
             fill(bounds.x, bounds.y, bounds.x + bounds.width, bounds.y + bounds.height, -6250336);
@@ -159,39 +151,39 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
             if (menu.isExpanded())
                 menu.render(mouseX, mouseY, bounds, delta);
         }
-
+        
         @Deprecated
         public SelectionTopCellElement<R> getTopRenderer() {
             return topRenderer;
         }
-
+        
         @Override
         public boolean mouseScrolled(double double_1, double double_2, double double_3) {
             if (menu.isExpanded())
                 return menu.mouseScrolled(double_1, double_2, double_3);
             return false;
         }
-
+        
         public void lateRender(int mouseX, int mouseY, float delta) {
             if (menu.isExpanded())
                 menu.lateRender(mouseX, mouseY, delta);
         }
-
+        
         public int getMorePossibleHeight() {
             if (menu.isExpanded())
                 return menu.getHeight();
             return -1;
         }
-
+        
         public R getValue() {
             return topRenderer.getValue();
         }
-
+        
         @Override
         public List<? extends Element> children() {
             return Lists.newArrayList(topRenderer, menu);
         }
-
+        
         @Override
         public boolean mouseClicked(double double_1, double double_2, int int_1) {
             dontReFocus = false;
@@ -203,82 +195,75 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
             return b;
         }
     }
-
+    
     public static abstract class DropdownMenuElement<R> extends AbstractParentElement {
-        @Deprecated
-        @NotNull
-        private SelectionCellCreator<R> cellCreator;
-        @Deprecated
-        @NotNull
-        private DropdownBoxEntry<R> entry;
-
+        @Deprecated @NotNull private SelectionCellCreator<R> cellCreator;
+        @Deprecated @NotNull private DropdownBoxEntry<R> entry;
+        
         @NotNull
         public SelectionCellCreator<R> getCellCreator() {
             return cellCreator;
         }
-
+        
         @NotNull
         public final DropdownBoxEntry<R> getEntry() {
             return entry;
         }
-
+        
         @NotNull
         public abstract ImmutableList<R> getSelections();
-
+        
         public abstract void initCells();
-
+        
         public abstract void render(int mouseX, int mouseY, Rectangle rectangle, float delta);
-
+        
         public abstract void lateRender(int mouseX, int mouseY, float delta);
-
+        
         public abstract int getHeight();
-
+        
         public final boolean isExpanded() {
             return (getEntry().selectionElement.getFocused() == getEntry().selectionElement.topRenderer || getEntry().selectionElement.getFocused() == getEntry().selectionElement.menu) && getEntry().getFocused() == getEntry().selectionElement && getEntry().getParent().getFocused() == getEntry();
         }
-
+        
         @Override
         public abstract List<SelectionCellElement<R>> children();
     }
-
+    
     public static class DefaultDropdownMenuElement<R> extends DropdownMenuElement<R> {
-        @NotNull
-        protected ImmutableList<R> selections;
-        @NotNull
-        protected List<SelectionCellElement<R>> cells;
-        @NotNull
-        protected List<SelectionCellElement<R>> currentElements;
+        @NotNull protected ImmutableList<R> selections;
+        @NotNull protected List<SelectionCellElement<R>> cells;
+        @NotNull protected List<SelectionCellElement<R>> currentElements;
         protected String lastSearchKeyword = "";
         protected Rectangle lastRectangle;
         protected boolean scrolling;
         protected double scroll, target;
         protected long start;
         protected long duration;
-
+        
         public DefaultDropdownMenuElement(@NotNull ImmutableList<R> selections) {
             this.selections = selections;
             this.cells = Lists.newArrayList();
             this.currentElements = Lists.newArrayList();
         }
-
+        
         public final double clamp(double v) {
             return MathHelper.clamp(v, -SmoothScrollingSettings.CLAMP_EXTENSION, getMaxScrollPosition() + SmoothScrollingSettings.CLAMP_EXTENSION);
         }
-
+        
         public double getMaxScroll() {
             return getCellCreator().getCellHeight() * currentElements.size();
         }
-
+        
         protected double getMaxScrollPosition() {
             return Math.max(0, this.getMaxScroll() - (getHeight()));
         }
-
+        
         @Override
         @NotNull
         public ImmutableList<R> getSelections() {
             return selections;
         }
-
+        
         @Override
         public void initCells() {
             for (R selection : getSelections()) {
@@ -289,7 +274,7 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
             }
             search();
         }
-
+        
         public void search() {
             currentElements.clear();
             String keyword = this.lastSearchKeyword.toLowerCase();
@@ -304,11 +289,11 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
             }
             scrollTo(0, false);
         }
-
+        
         protected int editDistance(String s1, String s2) {
             s1 = s1.toLowerCase();
             s2 = s2.toLowerCase();
-
+            
             int[] costs = new int[s2.length() + 1];
             for (int i = 0; i <= s1.length(); i++) {
                 int lastValue = i;
@@ -330,7 +315,7 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
             }
             return costs[s2.length()];
         }
-
+        
         protected double similarity(String s1, String s2) {
             String longer = s1, shorter = s2;
             if (s1.length() < s2.length()) { // longer should always have greater length
@@ -343,7 +328,7 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
             }
             return (longerLength - editDistance(longer, shorter)) / (double) longerLength;
         }
-
+        
         @Override
         public void render(int mouseX, int mouseY, Rectangle rectangle, float delta) {
             if (!getEntry().selectionElement.topRenderer.getSearchTerm().equals(lastSearchKeyword)) {
@@ -354,7 +339,7 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
             lastRectangle = rectangle.clone();
             lastRectangle.translate(0, -1);
         }
-
+        
         private void updatePosition(float delta) {
             target = clamp(target);
             if (target < 0) {
@@ -367,7 +352,7 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
             else
                 scroll = target;
         }
-
+        
         @Override
         public void lateRender(int mouseX, int mouseY, float delta) {
             int last10Height = getHeight();
@@ -376,7 +361,7 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
             fill(lastRectangle.x + 1, lastRectangle.y + lastRectangle.height + 1, lastRectangle.x + cWidth - 1, lastRectangle.y + lastRectangle.height + last10Height, -16777216);
             RenderSystem.pushMatrix();
             RenderSystem.translatef(0, 0, 300f);
-
+            
             ScissorsHandler.INSTANCE.scissor(new Rectangle(lastRectangle.x, lastRectangle.y + lastRectangle.height + 1, cWidth - 6, last10Height - 1));
             double yy = lastRectangle.y + lastRectangle.height - scroll;
             for (SelectionCellElement<R> cell : currentElements) {
@@ -387,13 +372,13 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
                 yy += getCellCreator().getCellHeight();
             }
             ScissorsHandler.INSTANCE.removeLastScissor();
-
+            
             if (currentElements.isEmpty()) {
                 TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
                 String s = I18n.translate("text.cloth-config.dropdown.value.unknown");
                 textRenderer.drawWithShadow(s, lastRectangle.x + getCellCreator().getCellWidth() / 2f - textRenderer.getStringWidth(s) / 2f, lastRectangle.y + lastRectangle.height + 3, -1);
             }
-
+            
             if (getMaxScrollPosition() > 6) {
                 RenderSystem.disableTexture();
                 int scrollbarPositionMinX = lastRectangle.x + getCellCreator().getCellWidth() - 6;
@@ -403,13 +388,13 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
                 height -= Math.min((scroll < 0 ? (int) -scroll : scroll > getMaxScrollPosition() ? (int) scroll - getMaxScrollPosition() : 0), height * .95);
                 height = Math.max(10, height);
                 int minY = (int) Math.min(Math.max((int) scroll * (last10Height - height) / getMaxScrollPosition() + (lastRectangle.y + lastRectangle.height + 1), (lastRectangle.y + lastRectangle.height + 1)), (lastRectangle.y + lastRectangle.height + 1 + last10Height) - height);
-
+                
                 int bottomc = new Rectangle(scrollbarPositionMinX, minY, scrollbarPositionMaxX - scrollbarPositionMinX, height).contains(PointHelper.fromMouse()) ? 168 : 128;
                 int topc = new Rectangle(scrollbarPositionMinX, minY, scrollbarPositionMaxX - scrollbarPositionMinX, height).contains(PointHelper.fromMouse()) ? 222 : 172;
-
+                
                 Tessellator tessellator = Tessellator.getInstance();
                 BufferBuilder buffer = tessellator.getBuffer();
-
+                
                 // Bottom
                 buffer.begin(7, VertexFormats.POSITION_TEXTURE_COLOR);
                 buffer.vertex(scrollbarPositionMinX, minY + height, 0.0D).texture(0, 1).color(bottomc, bottomc, bottomc, 255).next();
@@ -417,7 +402,7 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
                 buffer.vertex(scrollbarPositionMaxX, minY, 0.0D).texture(1, 0).color(bottomc, bottomc, bottomc, 255).next();
                 buffer.vertex(scrollbarPositionMinX, minY, 0.0D).texture(0, 0).color(bottomc, bottomc, bottomc, 255).next();
                 tessellator.draw();
-
+                
                 // Top
                 buffer.begin(7, VertexFormats.POSITION_TEXTURE_COLOR);
                 buffer.vertex(scrollbarPositionMinX, (minY + height - 1), 0.0D).texture(0, 1).color(topc, topc, topc, 255).next();
@@ -430,17 +415,17 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
             RenderSystem.translatef(0, 0, -300f);
             RenderSystem.popMatrix();
         }
-
+        
         @Override
         public int getHeight() {
             return Math.max(Math.min(getCellCreator().getDropBoxMaxHeight(), (int) getMaxScroll()), 14);
         }
-
+        
         @Override
         public boolean isMouseOver(double mouseX, double mouseY) {
             return isExpanded() && mouseX >= lastRectangle.x && mouseX <= lastRectangle.x + getCellCreator().getCellWidth() && mouseY >= lastRectangle.y + lastRectangle.height && mouseY <= lastRectangle.y + lastRectangle.height + getHeight() + 1;
         }
-
+        
         @Override
         public boolean mouseDragged(double double_1, double double_2, int int_1, double double_3, double double_4) {
             if (!isExpanded())
@@ -462,7 +447,7 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
             }
             return false;
         }
-
+        
         @Override
         public boolean mouseScrolled(double mouseX, double mouseY, double double_3) {
             if (isMouseOver(mouseX, mouseY)) {
@@ -471,11 +456,11 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
             }
             return false;
         }
-
+        
         protected void updateScrollingState(double double_1, double double_2, int int_1) {
             this.scrolling = isExpanded() && lastRectangle != null && int_1 == 0 && double_1 >= (double) lastRectangle.x + getCellCreator().getCellWidth() - 6 && double_1 < (double) (lastRectangle.x + getCellCreator().getCellWidth());
         }
-
+        
         @Override
         public boolean mouseClicked(double double_1, double double_2, int int_1) {
             if (!isExpanded())
@@ -483,91 +468,89 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
             updateScrollingState(double_1, double_2, int_1);
             return super.mouseClicked(double_1, double_2, int_1) || scrolling;
         }
-
+        
         public void offset(double value, boolean animated) {
             scrollTo(target + value, animated);
         }
-
+        
         public void scrollTo(double value, boolean animated) {
             scrollTo(value, animated, ClothConfigInitializer.getScrollDuration());
         }
-
+        
         public void scrollTo(double value, boolean animated, long duration) {
             target = clamp(value);
-
+            
             if (animated) {
                 start = System.currentTimeMillis();
                 this.duration = duration;
             } else
                 scroll = target;
         }
-
+        
         @Override
         public List<SelectionCellElement<R>> children() {
             return currentElements;
         }
     }
-
+    
     public static abstract class SelectionCellCreator<R> {
         public abstract SelectionCellElement<R> create(R selection);
-
+        
         public abstract int getCellHeight();
-
+        
         public abstract int getDropBoxMaxHeight();
-
+        
         public int getCellWidth() {
             return 132;
         }
     }
-
+    
     public static class DefaultSelectionCellCreator<R> extends SelectionCellCreator<R> {
         protected Function<R, String> toStringFunction;
-
+        
         public DefaultSelectionCellCreator(Function<R, String> toStringFunction) {
             this.toStringFunction = toStringFunction;
         }
-
+        
         public DefaultSelectionCellCreator() {
             this(Object::toString);
         }
-
+        
         @Override
         public SelectionCellElement<R> create(R selection) {
             return new DefaultSelectionCellElement<>(selection, toStringFunction);
         }
-
+        
         @Override
         public int getCellHeight() {
             return 14;
         }
-
+        
         @Override
         public int getDropBoxMaxHeight() {
             return getCellHeight() * 7;
         }
     }
-
+    
     public static abstract class SelectionCellElement<R> extends AbstractParentElement {
-        @Deprecated
-        @NotNull
-        private DropdownBoxEntry<R> entry;
-
+        @Deprecated @NotNull private DropdownBoxEntry<R> entry;
+        
         @NotNull
         public final DropdownBoxEntry<R> getEntry() {
             return entry;
         }
-
+        
         public abstract void render(int mouseX, int mouseY, int x, int y, int width, int height, float delta);
-
+        
         public abstract void dontRender(float delta);
-
+        
         @Nullable
         public abstract String getSearchKey();
-
+        
         @Nullable
         public abstract R getSelection();
     }
-
+    
     public static class DefaultSelectionCellElement<R> extends SelectionCellElement<R> {
         protected R r;
         protected int x;
@@ -576,12 +559,12 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
         protected int height;
         protected boolean rendering;
         protected Function<R, String> toStringFunction;
-
+        
         public DefaultSelectionCellElement(R r, Function<R, String> toStringFunction) {
             this.r = r;
             this.toStringFunction = toStringFunction;
         }
-
+        
         @Override
         public void render(int mouseX, int mouseY, int x, int y, int width, int height, float delta) {
             rendering = true;
@@ -594,29 +577,29 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
                 fill(x + 1, y + 1, x + width - 1, y + height - 1, -15132391);
             MinecraftClient.getInstance().textRenderer.drawWithShadow(toStringFunction.apply(r), x + 6, y + 3, b ? 16777215 : 8947848);
         }
-
+        
         @Override
         public void dontRender(float delta) {
             rendering = false;
         }
-
+        
         @Nullable
         @Override
         public String getSearchKey() {
             return toStringFunction.apply(r);
         }
-
+        
         @Nullable
         @Override
         public R getSelection() {
             return r;
         }
-
+        
         @Override
         public List<? extends Element> children() {
             return Collections.emptyList();
         }
-
+        
         @Override
         public boolean mouseClicked(double mouseX, double mouseY, int int_1) {
             boolean b = rendering && mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + height;
@@ -629,35 +612,34 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
             return false;
         }
     }
-
+    
     public static abstract class SelectionTopCellElement<R> extends AbstractParentElement {
-        @Deprecated
-        private DropdownBoxEntry<R> entry;
-
+        @Deprecated private DropdownBoxEntry<R> entry;
+        
         public abstract R getValue();
-
+        
         public abstract void setValue(R value);
-
+        
         public abstract String getSearchTerm();
-
+        
         public abstract Optional<String> getError();
-
+        
         public final Optional<String> getConfigError() {
             return entry.getConfigError();
         }
-
+        
         public DropdownBoxEntry<R> getParent() {
             return entry;
         }
-
+        
         public final boolean hasConfigError() {
             return getConfigError().isPresent();
         }
-
+        
         public final int getPreferredTextColor() {
             return getConfigError().isPresent() ? 16733525 : 16777215;
         }
-
+        
         public void selectFirstRecommendation() {
             List<SelectionCellElement<R>> children = getParent().selectionElement.menu.children();
             for (SelectionCellElement<R> child : children) {
@@ -668,16 +650,16 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
                 }
             }
         }
-
+        
         public abstract void render(int mouseX, int mouseY, int x, int y, int width, int height, float delta);
     }
-
+    
     public static class DefaultSelectionTopCellElement<R> extends SelectionTopCellElement<R> {
         protected TextFieldWidget textFieldWidget;
         protected Function<String, R> toObjectFunction;
         protected Function<R, String> toStringFunction;
         protected R value;
-
+        
         public DefaultSelectionTopCellElement(R value, Function<String, R> toObjectFunction, Function<R, String> toStringFunction) {
             this.value = Objects.requireNonNull(value);
             this.toObjectFunction = Objects.requireNonNull(toObjectFunction);
@@ -690,7 +672,7 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
                     super.render(int_1, int_2, float_1);
                     setFocused(f);
                 }
-
+                
                 @Override
                 public boolean keyPressed(int int_1, int int_2, int int_3) {
                     if (int_1 == 257 || int_1 == 335) {
@@ -708,7 +690,7 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
                     getParent().getScreen().setEdited(true, getParent().isRequiresRestart());
             });
         }
-
+        
         @Override
         public void render(int mouseX, int mouseY, int x, int y, int width, int height, float delta) {
             textFieldWidget.x = x + 4;
@@ -718,32 +700,32 @@ public class DropdownBoxEntry<T> extends TooltipListEntry<T> {
             textFieldWidget.setEditableColor(getPreferredTextColor());
             textFieldWidget.render(mouseX, mouseY, delta);
         }
-
+        
         @Override
         public R getValue() {
             if (hasConfigError())
                 return value;
             return toObjectFunction.apply(textFieldWidget.getText());
         }
-
+        
         @Override
         public void setValue(R value) {
             textFieldWidget.setText(toStringFunction.apply(value));
             textFieldWidget.setCursor(0);
         }
-
+        
         @Override
         public String getSearchTerm() {
             return textFieldWidget.getText();
         }
-
+        
         @Override
         public Optional<String> getError() {
             if (toObjectFunction.apply(textFieldWidget.getText()) != null)
                 return Optional.empty();
             return Optional.of("Invalid Value!");
         }
-
+        
         @Override
         public List<? extends Element> children() {
             return Collections.singletonList(textFieldWidget);

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

@@ -14,7 +14,7 @@ public class FloatListEntry extends TextFieldListEntry<Float> {
         StringBuilder stringBuilder_1 = new StringBuilder();
         char[] var2 = s.toCharArray();
         int var3 = var2.length;
-    
+        
         for (char c : var2)
             if (Character.isDigit(c) || c == '-' || c == '.')
                 stringBuilder_1.append(c);

+ 14 - 25
src/main/java/me/shedaniel/clothconfig2/gui/entries/FloatListListEntry.java

@@ -12,57 +12,46 @@ import java.util.function.Supplier;
 
 @ApiStatus.Internal
 public class FloatListListEntry extends AbstractTextFieldListListEntry<Float, FloatListListEntry.FloatListCell, FloatListListEntry> {
-
+    
     private float minimum, maximum;
-
+    
     @Deprecated
     public FloatListListEntry(String fieldName, List<Float> value, boolean defaultExpanded, Supplier<Optional<String[]>> tooltipSupplier, Consumer<List<Float>> saveConsumer, Supplier<List<Float>> defaultValue, String resetButtonKey) {
         this(fieldName, value, defaultExpanded, tooltipSupplier, saveConsumer, defaultValue, resetButtonKey, false);
     }
-
+    
     @Deprecated
     public FloatListListEntry(String fieldName, List<Float> value, boolean defaultExpanded, Supplier<Optional<String[]>> tooltipSupplier, Consumer<List<Float>> saveConsumer, Supplier<List<Float>> defaultValue, String resetButtonKey, boolean requiresRestart) {
         this(fieldName, value, defaultExpanded, tooltipSupplier, saveConsumer, defaultValue, resetButtonKey, requiresRestart, true, true);
     }
-
-    public FloatListListEntry(
-            String fieldName,
-            List<Float> value,
-            boolean defaultExpanded,
-            Supplier<Optional<String[]>> tooltipSupplier,
-            Consumer<List<Float>> saveConsumer,
-            Supplier<List<Float>> defaultValue,
-            String resetButtonKey,
-            boolean requiresRestart,
-            boolean deleteButtonEnabled,
-            boolean insertInFront
-    ) {
+    
+    public FloatListListEntry(String fieldName, List<Float> value, boolean defaultExpanded, Supplier<Optional<String[]>> tooltipSupplier, Consumer<List<Float>> saveConsumer, Supplier<List<Float>> defaultValue, String resetButtonKey, boolean requiresRestart, boolean deleteButtonEnabled, boolean insertInFront) {
         super(fieldName, value, defaultExpanded, tooltipSupplier, saveConsumer, defaultValue, resetButtonKey, requiresRestart, deleteButtonEnabled, insertInFront, FloatListCell::new);
         this.minimum = Float.NEGATIVE_INFINITY;
         this.maximum = Float.POSITIVE_INFINITY;
     }
-
+    
     public FloatListListEntry setMaximum(float maximum) {
         this.maximum = maximum;
         return this;
     }
-
+    
     public FloatListListEntry setMinimum(float minimum) {
         this.minimum = minimum;
         return this;
     }
-
+    
     @Override
     public FloatListListEntry self() {
         return this;
     }
-
+    
     public static class FloatListCell extends AbstractTextFieldListListEntry.AbstractTextFieldListCell<Float, FloatListCell, FloatListListEntry> {
-
+        
         public FloatListCell(Float value, FloatListListEntry listListEntry) {
             super(value, listListEntry);
         }
-
+        
         @Nullable
         @Override
         protected Float substituteDefault(@Nullable Float value) {
@@ -71,12 +60,12 @@ public class FloatListListEntry extends AbstractTextFieldListListEntry<Float, Fl
             else
                 return value;
         }
-
+        
         @Override
         protected boolean isValidText(@NotNull String text) {
             return text.chars().allMatch(c -> Character.isDigit(c) || c == '-' || c == '.');
         }
-
+        
         public Float getValue() {
             try {
                 return Float.valueOf(widget.getText());
@@ -84,7 +73,7 @@ public class FloatListListEntry extends AbstractTextFieldListListEntry<Float, Fl
                 return 0f;
             }
         }
-
+        
         @Override
         public Optional<String> getError() {
             try {

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

@@ -14,7 +14,7 @@ public class IntegerListEntry extends TextFieldListEntry<Integer> {
         StringBuilder stringBuilder_1 = new StringBuilder();
         char[] var2 = s.toCharArray();
         int var3 = var2.length;
-    
+        
         for (char c : var2)
             if (Character.isDigit(c) || c == '-')
                 stringBuilder_1.append(c);

+ 15 - 26
src/main/java/me/shedaniel/clothconfig2/gui/entries/IntegerListListEntry.java

@@ -12,57 +12,46 @@ import java.util.function.Supplier;
 
 @ApiStatus.Internal
 public class IntegerListListEntry extends AbstractTextFieldListListEntry<Integer, IntegerListListEntry.IntegerListCell, IntegerListListEntry> {
-
+    
     private int minimum, maximum;
-
+    
     @Deprecated
     public IntegerListListEntry(String fieldName, List<Integer> value, boolean defaultExpanded, Supplier<Optional<String[]>> tooltipSupplier, Consumer<List<Integer>> saveConsumer, Supplier<List<Integer>> defaultValue, String resetButtonKey) {
         this(fieldName, value, defaultExpanded, tooltipSupplier, saveConsumer, defaultValue, resetButtonKey, false);
     }
-
+    
     @Deprecated
     public IntegerListListEntry(String fieldName, List<Integer> value, boolean defaultExpanded, Supplier<Optional<String[]>> tooltipSupplier, Consumer<List<Integer>> saveConsumer, Supplier<List<Integer>> defaultValue, String resetButtonKey, boolean requiresRestart) {
         this(fieldName, value, defaultExpanded, tooltipSupplier, saveConsumer, defaultValue, resetButtonKey, requiresRestart, true, true);
     }
-
-    public IntegerListListEntry(
-            String fieldName,
-            List<Integer> value,
-            boolean defaultExpanded,
-            Supplier<Optional<String[]>> tooltipSupplier,
-            Consumer<List<Integer>> saveConsumer,
-            Supplier<List<Integer>> defaultValue,
-            String resetButtonKey,
-            boolean requiresRestart,
-            boolean deleteButtonEnabled,
-            boolean insertInFront
-    ) {
+    
+    public IntegerListListEntry(String fieldName, List<Integer> value, boolean defaultExpanded, Supplier<Optional<String[]>> tooltipSupplier, Consumer<List<Integer>> saveConsumer, Supplier<List<Integer>> defaultValue, String resetButtonKey, boolean requiresRestart, boolean deleteButtonEnabled, boolean insertInFront) {
         super(fieldName, value, defaultExpanded, tooltipSupplier, saveConsumer, defaultValue, resetButtonKey, requiresRestart, deleteButtonEnabled, insertInFront, IntegerListCell::new);
         this.minimum = Integer.MIN_VALUE;
         this.maximum = Integer.MAX_VALUE;
     }
-
+    
     public IntegerListListEntry setMaximum(int maximum) {
         this.maximum = maximum;
         return this;
     }
-
+    
     public IntegerListListEntry setMinimum(int minimum) {
         this.minimum = minimum;
         return this;
     }
-
+    
     @Override
     public IntegerListListEntry self() {
         return this;
     }
-
+    
     public static class IntegerListCell extends AbstractTextFieldListListEntry.AbstractTextFieldListCell<Integer, IntegerListCell, IntegerListListEntry> {
-
+        
         public IntegerListCell(Integer value, IntegerListListEntry listListEntry) {
             super(value, listListEntry);
         }
-
+        
         @Nullable
         @Override
         protected Integer substituteDefault(@Nullable Integer value) {
@@ -71,12 +60,12 @@ public class IntegerListListEntry extends AbstractTextFieldListListEntry<Integer
             else
                 return value;
         }
-
+        
         @Override
         protected boolean isValidText(@NotNull String text) {
             return text.chars().allMatch(c -> Character.isDigit(c) || c == '-');
         }
-
+        
         public Integer getValue() {
             try {
                 return Integer.valueOf(widget.getText());
@@ -84,7 +73,7 @@ public class IntegerListListEntry extends AbstractTextFieldListListEntry<Integer
                 return 0;
             }
         }
-
+        
         @Override
         public Optional<String> getError() {
             try {
@@ -99,5 +88,5 @@ public class IntegerListListEntry extends AbstractTextFieldListListEntry<Integer
             return Optional.empty();
         }
     }
-
+    
 }

+ 14 - 14
src/main/java/me/shedaniel/clothconfig2/gui/entries/KeyCodeEntry.java

@@ -42,32 +42,28 @@ public class KeyCodeEntry extends TooltipListEntry<ModifierKeyCode> {
         this.widgets = Lists.newArrayList(buttonWidget, resetButton);
     }
     
-    public void setAllowModifiers(boolean allowModifiers) {
-        this.allowModifiers = allowModifiers;
-    }
-    
-    public void setAllowKey(boolean allowKey) {
-        this.allowKey = allowKey;
-    }
-    
-    public void setAllowMouse(boolean allowMouse) {
-        this.allowMouse = allowMouse;
-    }
-    
     public boolean isAllowModifiers() {
         return allowModifiers;
     }
     
+    public void setAllowModifiers(boolean allowModifiers) {
+        this.allowModifiers = allowModifiers;
+    }
+    
     public boolean isAllowKey() {
         return allowKey;
     }
     
+    public void setAllowKey(boolean allowKey) {
+        this.allowKey = allowKey;
+    }
+    
     public boolean isAllowMouse() {
         return allowMouse;
     }
     
-    public void setValue(ModifierKeyCode value) {
-        this.value = value;
+    public void setAllowMouse(boolean allowMouse) {
+        this.allowMouse = allowMouse;
     }
     
     @Override
@@ -81,6 +77,10 @@ public class KeyCodeEntry extends TooltipListEntry<ModifierKeyCode> {
         return value;
     }
     
+    public void setValue(ModifierKeyCode value) {
+        this.value = value;
+    }
+    
     @Override
     public Optional<ModifierKeyCode> getDefaultValue() {
         return Optional.ofNullable(defaultValue).map(Supplier::get);

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

@@ -14,7 +14,7 @@ public class LongListEntry extends TextFieldListEntry<Long> {
         StringBuilder stringBuilder_1 = new StringBuilder();
         char[] var2 = s.toCharArray();
         int var3 = var2.length;
-    
+        
         for (char c : var2)
             if (Character.isDigit(c) || c == '-')
                 stringBuilder_1.append(c);

+ 14 - 14
src/main/java/me/shedaniel/clothconfig2/gui/entries/LongListListEntry.java

@@ -12,46 +12,46 @@ import java.util.function.Supplier;
 
 @ApiStatus.Internal
 public class LongListListEntry extends AbstractTextFieldListListEntry<Long, LongListListEntry.LongListCell, LongListListEntry> {
-
+    
     private long minimum, maximum;
-
+    
     @Deprecated
     public LongListListEntry(String fieldName, List<Long> value, boolean defaultExpanded, Supplier<Optional<String[]>> tooltipSupplier, Consumer<List<Long>> saveConsumer, Supplier<List<Long>> defaultValue, String resetButtonKey) {
         this(fieldName, value, defaultExpanded, tooltipSupplier, saveConsumer, defaultValue, resetButtonKey, false);
     }
-
+    
     @Deprecated
     public LongListListEntry(String fieldName, List<Long> value, boolean defaultExpanded, Supplier<Optional<String[]>> tooltipSupplier, Consumer<List<Long>> saveConsumer, Supplier<List<Long>> defaultValue, String resetButtonKey, boolean requiresRestart) {
         this(fieldName, value, defaultExpanded, tooltipSupplier, saveConsumer, defaultValue, resetButtonKey, requiresRestart, true, true);
     }
-
+    
     public LongListListEntry(String fieldName, List<Long> value, boolean defaultExpanded, Supplier<Optional<String[]>> tooltipSupplier, Consumer<List<Long>> saveConsumer, Supplier<List<Long>> defaultValue, String resetButtonKey, boolean requiresRestart, boolean deleteButtonEnabled, boolean insertInFront) {
         super(fieldName, value, defaultExpanded, tooltipSupplier, saveConsumer, defaultValue, resetButtonKey, requiresRestart, deleteButtonEnabled, insertInFront, LongListCell::new);
         this.minimum = Long.MIN_VALUE;
         this.maximum = Long.MAX_VALUE;
     }
-
+    
     public LongListListEntry setMaximum(long maximum) {
         this.maximum = maximum;
         return this;
     }
-
+    
     public LongListListEntry setMinimum(long minimum) {
         this.minimum = minimum;
         return this;
     }
-
+    
     @Override
     public LongListListEntry self() {
         return this;
     }
-
+    
     public static class LongListCell extends AbstractTextFieldListListEntry.AbstractTextFieldListCell<Long, LongListCell, LongListListEntry> {
-
+        
         public LongListCell(Long value, LongListListEntry listListEntry) {
             super(value, listListEntry);
         }
-
+        
         @Nullable
         @Override
         protected Long substituteDefault(@Nullable Long value) {
@@ -60,12 +60,12 @@ public class LongListListEntry extends AbstractTextFieldListListEntry<Long, Long
             else
                 return value;
         }
-
+        
         @Override
         protected boolean isValidText(@NotNull String text) {
             return text.chars().allMatch(c -> Character.isDigit(c) || c == '-');
         }
-
+        
         public Long getValue() {
             try {
                 return Long.valueOf(widget.getText());
@@ -73,7 +73,7 @@ public class LongListListEntry extends AbstractTextFieldListListEntry<Long, Long
                 return 0L;
             }
         }
-
+        
         @Override
         public Optional<String> getError() {
             try {
@@ -88,5 +88,5 @@ public class LongListListEntry extends AbstractTextFieldListListEntry<Long, Long
             return Optional.empty();
         }
     }
-
+    
 }

+ 19 - 23
src/main/java/me/shedaniel/clothconfig2/gui/entries/MultiElementListEntry.java

@@ -18,7 +18,7 @@ import java.util.Optional;
 import java.util.stream.Collectors;
 
 public class MultiElementListEntry<T> extends TooltipListEntry<T> {
-
+    
     private static final Identifier CONFIG_TEX = new Identifier("cloth-config2", "textures/gui/cloth_config.png");
     private final T object;
     private String categoryName;
@@ -26,7 +26,7 @@ public class MultiElementListEntry<T> extends TooltipListEntry<T> {
     private MultiElementListEntry<T>.CategoryLabelWidget widget;
     private List<Element> children;
     private boolean expanded;
-
+    
     @ApiStatus.Internal
     public MultiElementListEntry(String categoryName, T object, List<AbstractConfigListEntry<?>> entries, boolean defaultExpanded) {
         super(categoryName, null);
@@ -38,7 +38,7 @@ public class MultiElementListEntry<T> extends TooltipListEntry<T> {
         this.children = Lists.newArrayList(widget);
         this.children.addAll(entries);
     }
-
+    
     @Override
     public boolean isRequiresRestart() {
         for (AbstractConfigListEntry<?> entry : entries)
@@ -46,26 +46,26 @@ public class MultiElementListEntry<T> extends TooltipListEntry<T> {
                 return true;
         return false;
     }
-
+    
     @Override
     public void setRequiresRestart(boolean requiresRestart) {
-
+    
     }
-
+    
     public String getCategoryName() {
         return categoryName;
     }
-
+    
     @Override
     public T getValue() {
         return object;
     }
-
+    
     @Override
     public Optional<T> getDefaultValue() {
         return Optional.empty();
     }
-
+    
     @Override
     public void render(int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isSelected, float delta) {
         super.render(index, y, x, entryWidth, entryHeight, mouseX, mouseY, isSelected, delta);
@@ -90,7 +90,7 @@ public class MultiElementListEntry<T> extends TooltipListEntry<T> {
             }
         }
     }
-
+    
     @Override
     public boolean isMouseInside(int mouseX, int mouseY, int x, int y, int entryWidth, int entryHeight) {
         widget.rectangle.x = x - 15;
@@ -99,7 +99,7 @@ public class MultiElementListEntry<T> extends TooltipListEntry<T> {
         widget.rectangle.height = 24;
         return widget.rectangle.contains(mouseX, mouseY) && getParent().isMouseOver(mouseX, mouseY);
     }
-
+    
     @Override
     public int getItemHeight() {
         if (expanded) {
@@ -110,34 +110,30 @@ public class MultiElementListEntry<T> extends TooltipListEntry<T> {
         }
         return 24;
     }
-
+    
     @Override
     public List<? extends Element> children() {
         return children;
     }
-
+    
     @Override
     public void save() {
         entries.forEach(AbstractConfigListEntry::save);
     }
-
+    
     @Override
     public Optional<String> getError() {
-        List<String> errors = entries.stream()
-                .map(AbstractConfigListEntry::getConfigError)
-                .filter(Optional::isPresent)
-                .map(Optional::get)
-                .collect(Collectors.toList());
-
+        List<String> errors = entries.stream().map(AbstractConfigListEntry::getConfigError).filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList());
+        
         if (errors.size() > 1)
             return Optional.of(I18n.translate("text.cloth-config.multi_error"));
         else
             return errors.stream().findFirst();
     }
-
+    
     public class CategoryLabelWidget implements Element {
         private Rectangle rectangle = new Rectangle();
-
+        
         @Override
         public boolean mouseClicked(double double_1, double double_2, int int_1) {
             if (rectangle.contains(double_1, double_2)) {
@@ -148,5 +144,5 @@ public class MultiElementListEntry<T> extends TooltipListEntry<T> {
             return false;
         }
     }
-
+    
 }

+ 16 - 39
src/main/java/me/shedaniel/clothconfig2/gui/entries/NestedListListEntry.java

@@ -18,92 +18,69 @@ import java.util.function.Supplier;
  * @param <INNER> the type of the inner config entry
  */
 public final class NestedListListEntry<T, INNER extends AbstractConfigListEntry<T>> extends AbstractListListEntry<T, NestedListCell<T, INNER>, NestedListListEntry<T, INNER>> {
-
+    
     @ApiStatus.Internal
-    public NestedListListEntry(
-            String fieldName,
-            List<T> value,
-            boolean defaultExpanded,
-            Supplier<Optional<String[]>> tooltipSupplier,
-            Consumer<List<T>> saveConsumer,
-            Supplier<List<T>> defaultValue,
-            String resetButtonKey,
-            boolean deleteButtonEnabled,
-            boolean insertInFront,
-            BiFunction<T, NestedListListEntry<T, INNER>, INNER> createNewCell
-    ) {
-        super(
-                fieldName,
-                value,
-                defaultExpanded,
-                null,
-                null,
-                defaultValue,
-                resetButtonKey,
-                false,
-                deleteButtonEnabled,
-                insertInFront,
-                (t, nestedListListEntry) -> new NestedListCell<>(t, nestedListListEntry, createNewCell.apply(t, nestedListListEntry))
-        );
+    public NestedListListEntry(String fieldName, List<T> value, boolean defaultExpanded, Supplier<Optional<String[]>> tooltipSupplier, Consumer<List<T>> saveConsumer, Supplier<List<T>> defaultValue, String resetButtonKey, boolean deleteButtonEnabled, boolean insertInFront, BiFunction<T, NestedListListEntry<T, INNER>, INNER> createNewCell) {
+        super(fieldName, value, defaultExpanded, null, null, defaultValue, resetButtonKey, false, deleteButtonEnabled, insertInFront, (t, nestedListListEntry) -> new NestedListCell<>(t, nestedListListEntry, createNewCell.apply(t, nestedListListEntry)));
     }
-
+    
     @Override
     public boolean isRequiresRestart() {
         return cells.stream().anyMatch(NestedListCell::isRequiresRestart);
     }
-
+    
     @Override
     public void setRequiresRestart(boolean requiresRestart) {
     }
-
+    
     @Override
     public NestedListListEntry<T, INNER> self() {
         return this;
     }
-
+    
     /**
      * @param <T> the configuration object type
      * @see NestedListListEntry
      */
     public static class NestedListCell<T, INNER extends AbstractConfigListEntry<T>> extends AbstractListListEntry.AbstractListCell<T, NestedListCell<T, INNER>, NestedListListEntry<T, INNER>> {
-
+        
         private final INNER nestedEntry;
-
+        
         @ApiStatus.Internal
         public NestedListCell(@Nullable T value, NestedListListEntry<T, INNER> listListEntry, INNER nestedEntry) {
             super(value, listListEntry);
             this.nestedEntry = nestedEntry;
         }
-
+        
         @Override
         public T getValue() {
             return nestedEntry.getValue();
         }
-
+        
         @Override
         public Optional<String> getError() {
             return nestedEntry.getError();
         }
-
+        
         @Override
         public int getCellHeight() {
             return nestedEntry.getItemHeight();
         }
-
+        
         @Override
         public void render(int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isSelected, float delta) {
             nestedEntry.setScreen(listListEntry.getScreen());
             nestedEntry.render(index, y, x, entryWidth, entryHeight, mouseX, mouseY, isSelected, delta);
         }
-
+        
         @Override
         public List<? extends Element> children() {
             return Collections.singletonList(nestedEntry);
         }
-
+        
         private boolean isRequiresRestart() {
             return nestedEntry.isRequiresRestart();
         }
     }
-
+    
 }

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

@@ -121,8 +121,7 @@ public class SelectionListEntry<T> extends TooltipListEntry<T> {
     }
     
     public interface Translatable {
-        @NotNull
-        String getKey();
+        @NotNull String getKey();
     }
     
 }

+ 12 - 12
src/main/java/me/shedaniel/clothconfig2/gui/entries/StringListListEntry.java

@@ -11,32 +11,32 @@ import java.util.function.Supplier;
 
 @ApiStatus.Internal
 public class StringListListEntry extends AbstractTextFieldListListEntry<String, StringListListEntry.StringListCell, StringListListEntry> {
-
+    
     @Deprecated
     public StringListListEntry(String fieldName, List<String> value, boolean defaultExpanded, Supplier<Optional<String[]>> tooltipSupplier, Consumer<List<String>> saveConsumer, Supplier<List<String>> defaultValue, String resetButtonKey) {
         this(fieldName, value, defaultExpanded, tooltipSupplier, saveConsumer, defaultValue, resetButtonKey, false);
     }
-
+    
     @Deprecated
     public StringListListEntry(String fieldName, List<String> value, boolean defaultExpanded, Supplier<Optional<String[]>> tooltipSupplier, Consumer<List<String>> saveConsumer, Supplier<List<String>> defaultValue, String resetButtonKey, boolean requiresRestart) {
         this(fieldName, value, defaultExpanded, tooltipSupplier, saveConsumer, defaultValue, resetButtonKey, requiresRestart, true, true);
     }
-
+    
     public StringListListEntry(String fieldName, List<String> value, boolean defaultExpanded, Supplier<Optional<String[]>> tooltipSupplier, Consumer<List<String>> saveConsumer, Supplier<List<String>> defaultValue, String resetButtonKey, boolean requiresRestart, boolean deleteButtonEnabled, boolean insertInFront) {
         super(fieldName, value, defaultExpanded, tooltipSupplier, saveConsumer, defaultValue, resetButtonKey, requiresRestart, deleteButtonEnabled, insertInFront, StringListCell::new);
     }
-
+    
     @Override
     public StringListListEntry self() {
         return this;
     }
-
+    
     public static class StringListCell extends AbstractTextFieldListListEntry.AbstractTextFieldListCell<String, StringListCell, StringListListEntry> {
-
+        
         public StringListCell(String value, StringListListEntry listListEntry) {
             super(value, listListEntry);
         }
-
+        
         @Nullable
         @Override
         protected String substituteDefault(@Nullable String value) {
@@ -45,22 +45,22 @@ public class StringListListEntry extends AbstractTextFieldListListEntry<String,
             else
                 return value;
         }
-
+        
         @Override
         protected boolean isValidText(@NotNull String text) {
             return true;
         }
-
+        
         @Override
         public String getValue() {
             return widget.getText();
         }
-
+        
         @Override
         public Optional<String> getError() {
             return Optional.empty();
         }
-
+        
     }
-
+    
 }

+ 5 - 5
src/main/java/me/shedaniel/clothconfig2/gui/entries/SubCategoryListEntry.java

@@ -16,14 +16,14 @@ import java.util.List;
 import java.util.Optional;
 
 public class SubCategoryListEntry extends TooltipListEntry<List<AbstractConfigListEntry>> {
-
+    
     private static final Identifier CONFIG_TEX = new Identifier("cloth-config2", "textures/gui/cloth_config.png");
     private String categoryName;
     private List<AbstractConfigListEntry> entries;
     private CategoryLabelWidget widget;
     private List<Element> children;
     private boolean expanded;
-
+    
     @Deprecated
     public SubCategoryListEntry(String categoryName, List<AbstractConfigListEntry> entries, boolean defaultExpanded) {
         super(categoryName, null);
@@ -37,7 +37,7 @@ public class SubCategoryListEntry extends TooltipListEntry<List<AbstractConfigLi
     
     @Override
     public boolean isRequiresRestart() {
-        for(AbstractConfigListEntry entry : entries)
+        for (AbstractConfigListEntry entry : entries)
             if (entry.isRequiresRestart())
                 return true;
         return false;
@@ -74,7 +74,7 @@ public class SubCategoryListEntry extends TooltipListEntry<List<AbstractConfigLi
         RenderSystem.color4f(1, 1, 1, 1);
         blit(x - 15, y + 4, 24, (widget.rectangle.contains(mouseX, mouseY) ? 18 : 0) + (expanded ? 9 : 0), 9, 9);
         MinecraftClient.getInstance().textRenderer.drawWithShadow(I18n.translate(categoryName), x, y + 5, widget.rectangle.contains(mouseX, mouseY) ? 0xffe6fe16 : -1);
-        for(AbstractConfigListEntry<?> entry : entries) {
+        for (AbstractConfigListEntry<?> entry : entries) {
             entry.setParent(getParent());
             entry.setScreen(getScreen());
         }
@@ -120,7 +120,7 @@ public class SubCategoryListEntry extends TooltipListEntry<List<AbstractConfigLi
     @Override
     public Optional<String> getError() {
         String error = null;
-        for(AbstractConfigListEntry<?> entry : entries)
+        for (AbstractConfigListEntry<?> entry : entries)
             if (entry.getError().isPresent()) {
                 if (error != null)
                     return Optional.ofNullable(I18n.translate("text.cloth-config.multi_error"));

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

@@ -60,15 +60,15 @@ public abstract class TextFieldListEntry<T> extends TooltipListEntry<T> {
         this.widgets = Lists.newArrayList(textFieldWidget, resetButton);
     }
     
+    protected static void setTextFieldWidth(TextFieldWidget widget, int width) {
+        widget.setWidth(width);
+    }
+    
     @Deprecated
     public void setValue(String s) {
         textFieldWidget.setText(String.valueOf(s));
     }
     
-    protected static void setTextFieldWidth(TextFieldWidget widget, int width) {
-        widget.setWidth(width);
-    }
-    
     protected String stripAddText(String s) {
         return s;
     }

+ 5 - 7
src/main/java/me/shedaniel/clothconfig2/gui/entries/TooltipListEntry.java

@@ -9,18 +9,16 @@ import java.util.Optional;
 import java.util.function.Supplier;
 
 public abstract class TooltipListEntry<T> extends AbstractConfigListEntry<T> {
-
-    @Nullable
-    private Supplier<Optional<String[]>> tooltipSupplier;
-
+    
+    @Nullable private Supplier<Optional<String[]>> tooltipSupplier;
+    
     @Deprecated
     public TooltipListEntry(String fieldName, @Nullable Supplier<Optional<String[]>> tooltipSupplier) {
         this(fieldName, tooltipSupplier, false);
     }
-
+    
     @Deprecated
-    public TooltipListEntry(String fieldName,
-                            @Nullable Supplier<Optional<String[]>> tooltipSupplier, boolean requiresRestart) {
+    public TooltipListEntry(String fieldName, @Nullable Supplier<Optional<String[]>> tooltipSupplier, boolean requiresRestart) {
         super(fieldName, requiresRestart);
         this.tooltipSupplier = tooltipSupplier;
     }

+ 7 - 7
src/main/java/me/shedaniel/clothconfig2/gui/widget/DynamicEntryListWidget.java

@@ -114,7 +114,7 @@ public abstract class DynamicEntryListWidget<E extends DynamicEntryListWidget.En
         int currentY = MathHelper.floor(mouseY - (double) this.top) - this.headerHeight + (int) this.getScroll() - 4;
         int itemY = 0;
         int itemIndex = -1;
-        for(int i = 0; i < entries.size(); i++) {
+        for (int i = 0; i < entries.size(); i++) {
             E item = getItem(i);
             itemY += item.getItemHeight();
             if (itemY > currentY) {
@@ -142,7 +142,7 @@ public abstract class DynamicEntryListWidget<E extends DynamicEntryListWidget.En
     protected int getMaxScrollPosition() {
         List<Integer> list = new ArrayList<>();
         int i = headerHeight;
-        for(E entry : entries) {
+        for (E entry : entries) {
             i += entry.getItemHeight();
             if (entry.getMorePossibleHeight() >= 0) {
                 list.add(i + entry.getMorePossibleHeight());
@@ -257,7 +257,7 @@ public abstract class DynamicEntryListWidget<E extends DynamicEntryListWidget.En
     
     protected void centerScrollOn(E item) {
         double d = (this.bottom - this.top) / -2d;
-        for(int i = 0; i < this.children().indexOf(item) && i < this.getItemCount(); i++)
+        for (int i = 0; i < this.children().indexOf(item) && i < this.getItemCount(); i++)
             d += getItem(i).getItemHeight();
         this.capYPosition(d);
     }
@@ -353,7 +353,7 @@ public abstract class DynamicEntryListWidget<E extends DynamicEntryListWidget.En
     }
     
     public boolean mouseScrolled(double double_1, double double_2, double double_3) {
-        for(E entry : entries) {
+        for (E entry : entries) {
             if (entry.mouseScrolled(double_1, double_2, double_3)) {
                 return true;
             }
@@ -396,10 +396,10 @@ public abstract class DynamicEntryListWidget<E extends DynamicEntryListWidget.En
         Tessellator tessellator = Tessellator.getInstance();
         BufferBuilder buffer = tessellator.getBuffer();
         
-        for(int renderIndex = 0; renderIndex < itemCount; ++renderIndex) {
+        for (int renderIndex = 0; renderIndex < itemCount; ++renderIndex) {
             E item = this.getItem(renderIndex);
             int itemY = startY + headerHeight;
-            for(int i = 0; i < entries.size() && i < renderIndex; i++)
+            for (int i = 0; i < entries.size() && i < renderIndex; i++)
                 itemY += entries.get(i).getItemHeight();
             int itemHeight = item.getItemHeight() - 4;
             int itemWidth = this.getItemWidth();
@@ -440,7 +440,7 @@ public abstract class DynamicEntryListWidget<E extends DynamicEntryListWidget.En
     
     protected int getRowTop(int index) {
         int integer = top + 4 - (int) this.getScroll() + headerHeight;
-        for(int i = 0; i < entries.size() && i < index; i++)
+        for (int i = 0; i < entries.size() && i < index; i++)
             integer += entries.get(i).getItemHeight();
         return integer;
     }

+ 1 - 1
src/main/java/me/shedaniel/clothconfig2/gui/widget/DynamicSmoothScrollingEntryListWidget.java

@@ -102,7 +102,7 @@ public abstract class DynamicSmoothScrollingEntryListWidget<E extends DynamicEnt
     
     @Override
     public boolean mouseScrolled(double double_1, double double_2, double double_3) {
-        for(E entry : children()) {
+        for (E entry : children()) {
             if (entry.mouseScrolled(double_1, double_2, double_3)) {
                 return true;
             }

+ 10 - 11
src/main/java/me/shedaniel/clothconfig2/impl/ScissorsHandlerImpl.java

@@ -13,10 +13,9 @@ import java.util.Collections;
 import java.util.List;
 
 public final class ScissorsHandlerImpl implements ScissorsHandler {
-
-    @Deprecated
-    public static final ScissorsHandler INSTANCE = new ScissorsHandlerImpl();
-
+    
+    @Deprecated public static final ScissorsHandler INSTANCE = new ScissorsHandlerImpl();
+    
     static {
         MinecraftCrashes.onEveryCrash(() -> {
             try {
@@ -26,37 +25,37 @@ public final class ScissorsHandlerImpl implements ScissorsHandler {
             }
         });
     }
-
+    
     private List<Rectangle> scissorsAreas;
-
+    
     public ScissorsHandlerImpl() {
         this.scissorsAreas = Lists.newArrayList();
     }
-
+    
     @Override
     public void clearScissors() {
         scissorsAreas.clear();
         applyScissors();
     }
-
+    
     @Override
     public List<Rectangle> getScissorsAreas() {
         return Collections.unmodifiableList(scissorsAreas);
     }
-
+    
     @Override
     public void scissor(Rectangle rectangle) {
         scissorsAreas.add(rectangle);
         applyScissors();
     }
-
+    
     @Override
     public void removeLastScissor() {
         if (!scissorsAreas.isEmpty())
             scissorsAreas.remove(scissorsAreas.size() - 1);
         applyScissors();
     }
-
+    
     @Override
     public void applyScissors() {
         if (!scissorsAreas.isEmpty()) {

+ 18 - 21
src/main/java/me/shedaniel/clothconfig2/impl/builders/BooleanToggleBuilder.java

@@ -10,75 +10,72 @@ import java.util.function.Function;
 import java.util.function.Supplier;
 
 public class BooleanToggleBuilder extends FieldBuilder<Boolean, BooleanListEntry> {
-
-    @Nullable
-    private Consumer<Boolean> saveConsumer = null;
-    @NotNull
-    private Function<Boolean, Optional<String[]>> tooltipSupplier = bool -> Optional.empty();
+    
+    @Nullable private Consumer<Boolean> saveConsumer = null;
+    @NotNull private Function<Boolean, Optional<String[]>> tooltipSupplier = bool -> Optional.empty();
     private boolean value;
-    @Nullable
-    private Function<Boolean, String> yesNoTextSupplier = null;
-
+    @Nullable private Function<Boolean, String> yesNoTextSupplier = null;
+    
     public BooleanToggleBuilder(String resetButtonKey, String fieldNameKey, boolean value) {
         super(resetButtonKey, fieldNameKey);
         this.value = value;
     }
-
+    
     public BooleanToggleBuilder setErrorSupplier(@Nullable Function<Boolean, Optional<String>> errorSupplier) {
         this.errorSupplier = errorSupplier;
         return this;
     }
-
+    
     public BooleanToggleBuilder requireRestart() {
         requireRestart(true);
         return this;
     }
-
+    
     public BooleanToggleBuilder setSaveConsumer(Consumer<Boolean> saveConsumer) {
         this.saveConsumer = saveConsumer;
         return this;
     }
-
+    
     public BooleanToggleBuilder setDefaultValue(Supplier<Boolean> defaultValue) {
         this.defaultValue = defaultValue;
         return this;
     }
-
+    
     public BooleanToggleBuilder setDefaultValue(boolean defaultValue) {
         this.defaultValue = () -> defaultValue;
         return this;
     }
-
+    
     public BooleanToggleBuilder setTooltipSupplier(@NotNull Function<Boolean, Optional<String[]>> tooltipSupplier) {
         this.tooltipSupplier = tooltipSupplier;
         return this;
     }
-
+    
     public BooleanToggleBuilder setTooltipSupplier(@NotNull Supplier<Optional<String[]>> tooltipSupplier) {
         this.tooltipSupplier = bool -> tooltipSupplier.get();
         return this;
     }
-
+    
     public BooleanToggleBuilder setTooltip(Optional<String[]> tooltip) {
         this.tooltipSupplier = bool -> tooltip;
         return this;
     }
-
+    
     public BooleanToggleBuilder setTooltip(@Nullable String... tooltip) {
         this.tooltipSupplier = bool -> Optional.ofNullable(tooltip);
         return this;
     }
-
+    
     @Nullable
     public Function<Boolean, String> getYesNoTextSupplier() {
         return yesNoTextSupplier;
     }
-
+    
     public BooleanToggleBuilder setYesNoTextSupplier(@Nullable Function<Boolean, String> yesNoTextSupplier) {
         this.yesNoTextSupplier = yesNoTextSupplier;
         return this;
     }
-
+    
     @NotNull
     @Override
     public BooleanListEntry build() {
@@ -95,5 +92,5 @@ public class BooleanToggleBuilder extends FieldBuilder<Boolean, BooleanListEntry
             entry.setErrorSupplier(() -> errorSupplier.apply(entry.getValue()));
         return entry;
     }
-
+    
 }

+ 3 - 3
src/main/java/me/shedaniel/clothconfig2/impl/builders/DoubleFieldBuilder.java

@@ -74,17 +74,17 @@ public class DoubleFieldBuilder extends FieldBuilder<Double, DoubleListEntry> {
         this.tooltipSupplier = d -> tooltipSupplier.get();
         return this;
     }
-
+    
     public DoubleFieldBuilder setTooltip(Optional<String[]> tooltip) {
         this.tooltipSupplier = d -> tooltip;
         return this;
     }
-
+    
     public DoubleFieldBuilder setTooltip(String... tooltip) {
         this.tooltipSupplier = d -> Optional.ofNullable(tooltip);
         return this;
     }
-
+    
     @NotNull
     @Override
     public DoubleListEntry build() {

+ 32 - 25
src/main/java/me/shedaniel/clothconfig2/impl/builders/DoubleListBuilder.java

@@ -2,6 +2,7 @@ package me.shedaniel.clothconfig2.impl.builders;
 
 import me.shedaniel.clothconfig2.gui.entries.DoubleListListEntry;
 import net.minecraft.client.resource.language.I18n;
+import org.jetbrains.annotations.ApiStatus;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.List;
@@ -11,7 +12,7 @@ import java.util.function.Function;
 import java.util.function.Supplier;
 
 public class DoubleListBuilder extends FieldBuilder<List<Double>, DoubleListListEntry> {
-
+    
     protected Function<Double, Optional<String>> cellErrorSupplier;
     private Consumer<List<Double>> saveConsumer = null;
     private Function<List<Double>, Optional<String[]>> tooltipSupplier = list -> Optional.empty();
@@ -21,116 +22,122 @@ public class DoubleListBuilder extends FieldBuilder<List<Double>, DoubleListList
     private Function<DoubleListListEntry, DoubleListListEntry.DoubleListCell> createNewInstance;
     private String addTooltip = I18n.translate("text.cloth-config.list.add"), removeTooltip = I18n.translate("text.cloth-config.list.remove");
     private boolean deleteButtonEnabled = true, insertInFront = true;
-
+    
     public DoubleListBuilder(String resetButtonKey, String fieldNameKey, List<Double> value) {
         super(resetButtonKey, fieldNameKey);
         this.value = value;
     }
-
+    
     public Function<Double, Optional<String>> getCellErrorSupplier() {
         return cellErrorSupplier;
     }
-
+    
     public DoubleListBuilder setCellErrorSupplier(Function<Double, Optional<String>> cellErrorSupplier) {
         this.cellErrorSupplier = cellErrorSupplier;
         return this;
     }
-
+    
     public DoubleListBuilder setErrorSupplier(Function<List<Double>, Optional<String>> errorSupplier) {
         this.errorSupplier = errorSupplier;
         return this;
     }
-
+    
     public DoubleListBuilder setDeleteButtonEnabled(boolean deleteButtonEnabled) {
         this.deleteButtonEnabled = deleteButtonEnabled;
         return this;
     }
-
+    
     public DoubleListBuilder setInsertInFront(boolean insertInFront) {
         this.insertInFront = insertInFront;
         return this;
     }
-
+    
     public DoubleListBuilder setAddButtonTooltip(String addTooltip) {
         this.addTooltip = addTooltip;
         return this;
     }
-
+    
     public DoubleListBuilder setRemoveButtonTooltip(String removeTooltip) {
         this.removeTooltip = removeTooltip;
         return this;
     }
-
+    
     public DoubleListBuilder requireRestart() {
         requireRestart(true);
         return this;
     }
-
+    
     public DoubleListBuilder setCreateNewInstance(Function<DoubleListListEntry, DoubleListListEntry.DoubleListCell> createNewInstance) {
         this.createNewInstance = createNewInstance;
         return this;
     }
-
+    
     public DoubleListBuilder setExpanded(boolean expanded) {
         this.expanded = expanded;
         return this;
     }
-
+    
+    @Deprecated
+    @ApiStatus.ScheduledForRemoval
+    public DoubleListBuilder setExpended(boolean expanded) {
+        return setExpanded(expanded);
+    }
+    
     public DoubleListBuilder setSaveConsumer(Consumer<List<Double>> saveConsumer) {
         this.saveConsumer = saveConsumer;
         return this;
     }
-
+    
     public DoubleListBuilder setDefaultValue(Supplier<List<Double>> defaultValue) {
         this.defaultValue = defaultValue;
         return this;
     }
-
+    
     public DoubleListBuilder setMin(double min) {
         this.min = min;
         return this;
     }
-
+    
     public DoubleListBuilder setMax(double max) {
         this.max = max;
         return this;
     }
-
+    
     public DoubleListBuilder removeMin() {
         this.min = null;
         return this;
     }
-
+    
     public DoubleListBuilder removeMax() {
         this.max = null;
         return this;
     }
-
+    
     public DoubleListBuilder setDefaultValue(List<Double> defaultValue) {
         this.defaultValue = () -> defaultValue;
         return this;
     }
-
+    
     public DoubleListBuilder setTooltipSupplier(Function<List<Double>, Optional<String[]>> tooltipSupplier) {
         this.tooltipSupplier = tooltipSupplier;
         return this;
     }
-
+    
     public DoubleListBuilder setTooltipSupplier(Supplier<Optional<String[]>> tooltipSupplier) {
         this.tooltipSupplier = list -> tooltipSupplier.get();
         return this;
     }
-
+    
     public DoubleListBuilder setTooltip(Optional<String[]> tooltip) {
         this.tooltipSupplier = list -> tooltip;
         return this;
     }
-
+    
     public DoubleListBuilder setTooltip(String... tooltip) {
         this.tooltipSupplier = list -> Optional.ofNullable(tooltip);
         return this;
     }
-
+    
     @NotNull
     @Override
     public DoubleListListEntry build() {
@@ -149,5 +156,5 @@ public class DoubleListBuilder extends FieldBuilder<List<Double>, DoubleListList
             entry.setErrorSupplier(() -> errorSupplier.apply(entry.getValue()));
         return entry;
     }
-
+    
 }

+ 5 - 5
src/main/java/me/shedaniel/clothconfig2/impl/builders/DropdownMenuBuilder.java

@@ -74,17 +74,17 @@ public class DropdownMenuBuilder<T> extends FieldBuilder<T, DropdownBoxEntry<T>>
         this.tooltipSupplier = str -> Optional.ofNullable(tooltip);
         return this;
     }
-
+    
     public DropdownMenuBuilder<T> requireRestart() {
         requireRestart(true);
         return this;
     }
-
+    
     public DropdownMenuBuilder<T> setErrorSupplier(Function<T, Optional<String>> errorSupplier) {
         this.errorSupplier = errorSupplier;
         return this;
     }
-
+    
     @NotNull
     @Override
     public DropdownBoxEntry<T> build() {
@@ -94,7 +94,7 @@ public class DropdownMenuBuilder<T> extends FieldBuilder<T, DropdownBoxEntry<T>>
             entry.setErrorSupplier(() -> errorSupplier.apply(entry.getValue()));
         return entry;
     }
-
+    
     public static class TopCellElementBuilder {
         public static final Function<String, Identifier> IDENTIFIER_FUNCTION = str -> {
             try {
@@ -136,7 +136,7 @@ public class DropdownMenuBuilder<T> extends FieldBuilder<T, DropdownBoxEntry<T>>
             return null;
         };
         private static final ItemStack BARRIER = new ItemStack(Items.BARRIER);
-    
+        
         public static <T> SelectionTopCellElement<T> of(T value, Function<String, T> toObjectFunction) {
             return of(value, toObjectFunction, Object::toString);
         }

+ 4 - 4
src/main/java/me/shedaniel/clothconfig2/impl/builders/EnumSelectorBuilder.java

@@ -65,18 +65,18 @@ public class EnumSelectorBuilder<T extends Enum<?>> extends FieldBuilder<T, Enum
         this.tooltipSupplier = e -> tooltip;
         return this;
     }
-
+    
     public EnumSelectorBuilder<T> setTooltip(String... tooltip) {
         this.tooltipSupplier = e -> Optional.ofNullable(tooltip);
         return this;
     }
-
+    
     public EnumSelectorBuilder<T> setEnumNameProvider(Function<Enum, String> enumNameProvider) {
         Objects.requireNonNull(enumNameProvider);
         this.enumNameProvider = enumNameProvider;
         return this;
     }
-
+    
     @NotNull
     @Override
     public EnumListEntry<T> build() {
@@ -86,5 +86,5 @@ public class EnumSelectorBuilder<T extends Enum<?>> extends FieldBuilder<T, Enum
             entry.setErrorSupplier(() -> errorSupplier.apply(entry.getValue()));
         return entry;
     }
-
+    
 }

+ 13 - 17
src/main/java/me/shedaniel/clothconfig2/impl/builders/FieldBuilder.java

@@ -10,51 +10,47 @@ import java.util.function.Function;
 import java.util.function.Supplier;
 
 public abstract class FieldBuilder<T, A extends AbstractConfigListEntry> {
-    @NotNull
-    private final String fieldNameKey;
-    @NotNull
-    private final String resetButtonKey;
+    @NotNull private final String fieldNameKey;
+    @NotNull private final String resetButtonKey;
     protected boolean requireRestart = false;
-    @Nullable
-    protected Supplier<T> defaultValue = null;
-    @Nullable
-    protected Function<T, Optional<String>> errorSupplier;
-
+    @Nullable protected Supplier<T> defaultValue = null;
+    @Nullable protected Function<T, Optional<String>> errorSupplier;
+    
     protected FieldBuilder(String resetButtonKey, String fieldNameKey) {
         this.resetButtonKey = Objects.requireNonNull(resetButtonKey);
         this.fieldNameKey = Objects.requireNonNull(fieldNameKey);
     }
-
+    
     @Nullable
     public final Supplier<T> getDefaultValue() {
         return defaultValue;
     }
-
+    
     @SuppressWarnings("rawtypes")
     @Deprecated
     public final AbstractConfigListEntry buildEntry() {
         return build();
     }
-
+    
     @NotNull
     public abstract A build();
-
+    
     @NotNull
     public final String getFieldNameKey() {
         return fieldNameKey;
     }
-
+    
     @NotNull
     public final String getResetButtonKey() {
         return resetButtonKey;
     }
-
+    
     public boolean isRequireRestart() {
         return requireRestart;
     }
-
+    
     public void requireRestart(boolean requireRestart) {
         this.requireRestart = requireRestart;
     }
-
+    
 }

+ 3 - 3
src/main/java/me/shedaniel/clothconfig2/impl/builders/FloatFieldBuilder.java

@@ -74,17 +74,17 @@ public class FloatFieldBuilder extends FieldBuilder<Float, FloatListEntry> {
         this.max = max;
         return this;
     }
-
+    
     public FloatFieldBuilder removeMin() {
         this.min = null;
         return this;
     }
-
+    
     public FloatFieldBuilder removeMax() {
         this.max = null;
         return this;
     }
-
+    
     @NotNull
     @Override
     public FloatListEntry build() {

+ 32 - 25
src/main/java/me/shedaniel/clothconfig2/impl/builders/FloatListBuilder.java

@@ -2,6 +2,7 @@ package me.shedaniel.clothconfig2.impl.builders;
 
 import me.shedaniel.clothconfig2.gui.entries.FloatListListEntry;
 import net.minecraft.client.resource.language.I18n;
+import org.jetbrains.annotations.ApiStatus;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.List;
@@ -11,7 +12,7 @@ import java.util.function.Function;
 import java.util.function.Supplier;
 
 public class FloatListBuilder extends FieldBuilder<List<Float>, FloatListListEntry> {
-
+    
     protected Function<Float, Optional<String>> cellErrorSupplier;
     private Consumer<List<Float>> saveConsumer = null;
     private Function<List<Float>, Optional<String[]>> tooltipSupplier = list -> Optional.empty();
@@ -21,116 +22,122 @@ public class FloatListBuilder extends FieldBuilder<List<Float>, FloatListListEnt
     private Function<FloatListListEntry, FloatListListEntry.FloatListCell> createNewInstance;
     private String addTooltip = I18n.translate("text.cloth-config.list.add"), removeTooltip = I18n.translate("text.cloth-config.list.remove");
     private boolean deleteButtonEnabled = true, insertInFront = true;
-
+    
     public FloatListBuilder(String resetButtonKey, String fieldNameKey, List<Float> value) {
         super(resetButtonKey, fieldNameKey);
         this.value = value;
     }
-
+    
     public Function<Float, Optional<String>> getCellErrorSupplier() {
         return cellErrorSupplier;
     }
-
+    
     public FloatListBuilder setCellErrorSupplier(Function<Float, Optional<String>> cellErrorSupplier) {
         this.cellErrorSupplier = cellErrorSupplier;
         return this;
     }
-
+    
     public FloatListBuilder setDeleteButtonEnabled(boolean deleteButtonEnabled) {
         this.deleteButtonEnabled = deleteButtonEnabled;
         return this;
     }
-
+    
     public FloatListBuilder setErrorSupplier(Function<List<Float>, Optional<String>> errorSupplier) {
         this.errorSupplier = errorSupplier;
         return this;
     }
-
+    
     public FloatListBuilder setInsertInFront(boolean insertInFront) {
         this.insertInFront = insertInFront;
         return this;
     }
-
+    
     public FloatListBuilder setAddButtonTooltip(String addTooltip) {
         this.addTooltip = addTooltip;
         return this;
     }
-
+    
     public FloatListBuilder setRemoveButtonTooltip(String removeTooltip) {
         this.removeTooltip = removeTooltip;
         return this;
     }
-
+    
     public FloatListBuilder requireRestart() {
         requireRestart(true);
         return this;
     }
-
+    
     public FloatListBuilder setCreateNewInstance(Function<FloatListListEntry, FloatListListEntry.FloatListCell> createNewInstance) {
         this.createNewInstance = createNewInstance;
         return this;
     }
-
+    
     public FloatListBuilder setExpanded(boolean expanded) {
         this.expanded = expanded;
         return this;
     }
-
+    
+    @Deprecated
+    @ApiStatus.ScheduledForRemoval
+    public FloatListBuilder setExpended(boolean expanded) {
+        return setExpanded(expanded);
+    }
+    
     public FloatListBuilder setSaveConsumer(Consumer<List<Float>> saveConsumer) {
         this.saveConsumer = saveConsumer;
         return this;
     }
-
+    
     public FloatListBuilder setDefaultValue(Supplier<List<Float>> defaultValue) {
         this.defaultValue = defaultValue;
         return this;
     }
-
+    
     public FloatListBuilder setMin(float min) {
         this.min = min;
         return this;
     }
-
+    
     public FloatListBuilder setMax(float max) {
         this.max = max;
         return this;
     }
-
+    
     public FloatListBuilder removeMin() {
         this.min = null;
         return this;
     }
-
+    
     public FloatListBuilder removeMax() {
         this.max = null;
         return this;
     }
-
+    
     public FloatListBuilder setDefaultValue(List<Float> defaultValue) {
         this.defaultValue = () -> defaultValue;
         return this;
     }
-
+    
     public FloatListBuilder setTooltipSupplier(Supplier<Optional<String[]>> tooltipSupplier) {
         this.tooltipSupplier = list -> tooltipSupplier.get();
         return this;
     }
-
+    
     public FloatListBuilder setTooltipSupplier(Function<List<Float>, Optional<String[]>> tooltipSupplier) {
         this.tooltipSupplier = tooltipSupplier;
         return this;
     }
-
+    
     public FloatListBuilder setTooltip(Optional<String[]> tooltip) {
         this.tooltipSupplier = list -> tooltip;
         return this;
     }
-
+    
     public FloatListBuilder setTooltip(String... tooltip) {
         this.tooltipSupplier = list -> Optional.ofNullable(tooltip);
         return this;
     }
-
+    
     @NotNull
     @Override
     public FloatListListEntry build() {
@@ -149,5 +156,5 @@ public class FloatListBuilder extends FieldBuilder<List<Float>, FloatListListEnt
             entry.setErrorSupplier(() -> errorSupplier.apply(entry.getValue()));
         return entry;
     }
-
+    
 }

+ 3 - 3
src/main/java/me/shedaniel/clothconfig2/impl/builders/IntFieldBuilder.java

@@ -74,17 +74,17 @@ public class IntFieldBuilder extends FieldBuilder<Integer, IntegerListEntry> {
         this.max = max;
         return this;
     }
-
+    
     public IntFieldBuilder removeMin() {
         this.min = null;
         return this;
     }
-
+    
     public IntFieldBuilder removeMax() {
         this.max = null;
         return this;
     }
-
+    
     @NotNull
     @Override
     public IntegerListEntry build() {

+ 32 - 25
src/main/java/me/shedaniel/clothconfig2/impl/builders/IntListBuilder.java

@@ -2,6 +2,7 @@ package me.shedaniel.clothconfig2.impl.builders;
 
 import me.shedaniel.clothconfig2.gui.entries.IntegerListListEntry;
 import net.minecraft.client.resource.language.I18n;
+import org.jetbrains.annotations.ApiStatus;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.List;
@@ -11,7 +12,7 @@ import java.util.function.Function;
 import java.util.function.Supplier;
 
 public class IntListBuilder extends FieldBuilder<List<Integer>, IntegerListListEntry> {
-
+    
     protected Function<Integer, Optional<String>> cellErrorSupplier;
     private Consumer<List<Integer>> saveConsumer = null;
     private Function<List<Integer>, Optional<String[]>> tooltipSupplier = list -> Optional.empty();
@@ -21,116 +22,122 @@ public class IntListBuilder extends FieldBuilder<List<Integer>, IntegerListListE
     private Function<IntegerListListEntry, IntegerListListEntry.IntegerListCell> createNewInstance;
     private String addTooltip = I18n.translate("text.cloth-config.list.add"), removeTooltip = I18n.translate("text.cloth-config.list.remove");
     private boolean deleteButtonEnabled = true, insertInFront = true;
-
+    
     public IntListBuilder(String resetButtonKey, String fieldNameKey, List<Integer> value) {
         super(resetButtonKey, fieldNameKey);
         this.value = value;
     }
-
+    
     public Function<Integer, Optional<String>> getCellErrorSupplier() {
         return cellErrorSupplier;
     }
-
+    
     public IntListBuilder setCellErrorSupplier(Function<Integer, Optional<String>> cellErrorSupplier) {
         this.cellErrorSupplier = cellErrorSupplier;
         return this;
     }
-
+    
     public IntListBuilder setErrorSupplier(Function<List<Integer>, Optional<String>> errorSupplier) {
         this.errorSupplier = errorSupplier;
         return this;
     }
-
+    
     public IntListBuilder setDeleteButtonEnabled(boolean deleteButtonEnabled) {
         this.deleteButtonEnabled = deleteButtonEnabled;
         return this;
     }
-
+    
     public IntListBuilder setInsertInFront(boolean insertInFront) {
         this.insertInFront = insertInFront;
         return this;
     }
-
+    
     public IntListBuilder setAddButtonTooltip(String addTooltip) {
         this.addTooltip = addTooltip;
         return this;
     }
-
+    
     public IntListBuilder setRemoveButtonTooltip(String removeTooltip) {
         this.removeTooltip = removeTooltip;
         return this;
     }
-
+    
     public IntListBuilder requireRestart() {
         requireRestart(true);
         return this;
     }
-
+    
     public IntListBuilder setCreateNewInstance(Function<IntegerListListEntry, IntegerListListEntry.IntegerListCell> createNewInstance) {
         this.createNewInstance = createNewInstance;
         return this;
     }
-
+    
     public IntListBuilder setExpanded(boolean expanded) {
         this.expanded = expanded;
         return this;
     }
-
+    
+    @Deprecated
+    @ApiStatus.ScheduledForRemoval
+    public IntListBuilder setExpended(boolean expanded) {
+        return setExpanded(expanded);
+    }
+    
     public IntListBuilder setSaveConsumer(Consumer<List<Integer>> saveConsumer) {
         this.saveConsumer = saveConsumer;
         return this;
     }
-
+    
     public IntListBuilder setDefaultValue(Supplier<List<Integer>> defaultValue) {
         this.defaultValue = defaultValue;
         return this;
     }
-
+    
     public IntListBuilder setMin(int min) {
         this.min = min;
         return this;
     }
-
+    
     public IntListBuilder setMax(int max) {
         this.max = max;
         return this;
     }
-
+    
     public IntListBuilder removeMin() {
         this.min = null;
         return this;
     }
-
+    
     public IntListBuilder removeMax() {
         this.max = null;
         return this;
     }
-
+    
     public IntListBuilder setDefaultValue(List<Integer> defaultValue) {
         this.defaultValue = () -> defaultValue;
         return this;
     }
-
+    
     public IntListBuilder setTooltipSupplier(Function<List<Integer>, Optional<String[]>> tooltipSupplier) {
         this.tooltipSupplier = tooltipSupplier;
         return this;
     }
-
+    
     public IntListBuilder setTooltipSupplier(Supplier<Optional<String[]>> tooltipSupplier) {
         this.tooltipSupplier = list -> tooltipSupplier.get();
         return this;
     }
-
+    
     public IntListBuilder setTooltip(Optional<String[]> tooltip) {
         this.tooltipSupplier = list -> tooltip;
         return this;
     }
-
+    
     public IntListBuilder setTooltip(String... tooltip) {
         this.tooltipSupplier = list -> Optional.ofNullable(tooltip);
         return this;
     }
-
+    
     @NotNull
     @Override
     public IntegerListListEntry build() {
@@ -149,5 +156,5 @@ public class IntListBuilder extends FieldBuilder<List<Integer>, IntegerListListE
             entry.setErrorSupplier(() -> errorSupplier.apply(entry.getValue()));
         return entry;
     }
-
+    
 }

+ 3 - 3
src/main/java/me/shedaniel/clothconfig2/impl/builders/IntSliderBuilder.java

@@ -71,17 +71,17 @@ public class IntSliderBuilder extends FieldBuilder<Integer, IntegerSliderEntry>
         this.tooltipSupplier = i -> Optional.ofNullable(tooltip);
         return this;
     }
-
+    
     public IntSliderBuilder setMax(int max) {
         this.max = max;
         return this;
     }
-
+    
     public IntSliderBuilder setMin(int min) {
         this.min = min;
         return this;
     }
-
+    
     @NotNull
     @Override
     public IntegerSliderEntry build() {

+ 13 - 15
src/main/java/me/shedaniel/clothconfig2/impl/builders/KeyCodeBuilder.java

@@ -13,19 +13,17 @@ import java.util.function.Function;
 import java.util.function.Supplier;
 
 public class KeyCodeBuilder extends FieldBuilder<ModifierKeyCode, KeyCodeEntry> {
-
-    @Nullable
-    private Consumer<ModifierKeyCode> saveConsumer = null;
-    @NotNull
-    private Function<ModifierKeyCode, Optional<String[]>> tooltipSupplier = bool -> Optional.empty();
+    
+    @Nullable private Consumer<ModifierKeyCode> saveConsumer = null;
+    @NotNull private Function<ModifierKeyCode, Optional<String[]>> tooltipSupplier = bool -> Optional.empty();
     private ModifierKeyCode value;
     private boolean allowKey = true, allowMouse = true, allowModifiers = true;
-
+    
     public KeyCodeBuilder(String resetButtonKey, String fieldNameKey, ModifierKeyCode value) {
         super(resetButtonKey, fieldNameKey);
         this.value = ModifierKeyCode.copyOf(value);
     }
-
+    
     public KeyCodeBuilder setAllowModifiers(boolean allowModifiers) {
         this.allowModifiers = allowModifiers;
         if (!allowModifiers)
@@ -78,40 +76,40 @@ public class KeyCodeBuilder extends FieldBuilder<ModifierKeyCode, KeyCodeEntry>
         this.defaultValue = defaultValue;
         return this;
     }
-
+    
     public KeyCodeBuilder setDefaultValue(InputUtil.KeyCode defaultValue) {
         return setDefaultValue(ModifierKeyCode.of(defaultValue, Modifier.none()));
     }
-
+    
     public KeyCodeBuilder setDefaultValue(ModifierKeyCode defaultValue) {
         this.defaultValue = () -> defaultValue;
         return this;
     }
-
+    
     public KeyCodeBuilder setTooltipSupplier(@NotNull Function<InputUtil.KeyCode, Optional<String[]>> tooltipSupplier) {
         return setModifierTooltipSupplier(keyCode -> tooltipSupplier.apply(keyCode.getKeyCode()));
     }
-
+    
     public KeyCodeBuilder setModifierTooltipSupplier(@NotNull Function<ModifierKeyCode, Optional<String[]>> tooltipSupplier) {
         this.tooltipSupplier = tooltipSupplier;
         return this;
     }
-
+    
     public KeyCodeBuilder setTooltipSupplier(@NotNull Supplier<Optional<String[]>> tooltipSupplier) {
         this.tooltipSupplier = bool -> tooltipSupplier.get();
         return this;
     }
-
+    
     public KeyCodeBuilder setTooltip(Optional<String[]> tooltip) {
         this.tooltipSupplier = bool -> tooltip;
         return this;
     }
-
+    
     public KeyCodeBuilder setTooltip(@Nullable String... tooltip) {
         this.tooltipSupplier = bool -> Optional.ofNullable(tooltip);
         return this;
     }
-
+    
     @NotNull
     @Override
     public KeyCodeEntry build() {

+ 3 - 3
src/main/java/me/shedaniel/clothconfig2/impl/builders/LongFieldBuilder.java

@@ -74,17 +74,17 @@ public class LongFieldBuilder extends FieldBuilder<Long, LongListEntry> {
         this.max = max;
         return this;
     }
-
+    
     public LongFieldBuilder removeMin() {
         this.min = null;
         return this;
     }
-
+    
     public LongFieldBuilder removeMax() {
         this.max = null;
         return this;
     }
-
+    
     @NotNull
     @Override
     public LongListEntry build() {

+ 32 - 25
src/main/java/me/shedaniel/clothconfig2/impl/builders/LongListBuilder.java

@@ -2,6 +2,7 @@ package me.shedaniel.clothconfig2.impl.builders;
 
 import me.shedaniel.clothconfig2.gui.entries.LongListListEntry;
 import net.minecraft.client.resource.language.I18n;
+import org.jetbrains.annotations.ApiStatus;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.List;
@@ -11,7 +12,7 @@ import java.util.function.Function;
 import java.util.function.Supplier;
 
 public class LongListBuilder extends FieldBuilder<List<Long>, LongListListEntry> {
-
+    
     protected Function<Long, Optional<String>> cellErrorSupplier;
     private Consumer<List<Long>> saveConsumer = null;
     private Function<List<Long>, Optional<String[]>> tooltipSupplier = list -> Optional.empty();
@@ -21,116 +22,122 @@ public class LongListBuilder extends FieldBuilder<List<Long>, LongListListEntry>
     private Function<LongListListEntry, LongListListEntry.LongListCell> createNewInstance;
     private String addTooltip = I18n.translate("text.cloth-config.list.add"), removeTooltip = I18n.translate("text.cloth-config.list.remove");
     private boolean deleteButtonEnabled = true, insertInFront = true;
-
+    
     public LongListBuilder(String resetButtonKey, String fieldNameKey, List<Long> value) {
         super(resetButtonKey, fieldNameKey);
         this.value = value;
     }
-
+    
     public Function<Long, Optional<String>> getCellErrorSupplier() {
         return cellErrorSupplier;
     }
-
+    
     public LongListBuilder setCellErrorSupplier(Function<Long, Optional<String>> cellErrorSupplier) {
         this.cellErrorSupplier = cellErrorSupplier;
         return this;
     }
-
+    
     public LongListBuilder setErrorSupplier(Function<List<Long>, Optional<String>> errorSupplier) {
         this.errorSupplier = errorSupplier;
         return this;
     }
-
+    
     public LongListBuilder setDeleteButtonEnabled(boolean deleteButtonEnabled) {
         this.deleteButtonEnabled = deleteButtonEnabled;
         return this;
     }
-
+    
     public LongListBuilder setInsertInFront(boolean insertInFront) {
         this.insertInFront = insertInFront;
         return this;
     }
-
+    
     public LongListBuilder setAddButtonTooltip(String addTooltip) {
         this.addTooltip = addTooltip;
         return this;
     }
-
+    
     public LongListBuilder setRemoveButtonTooltip(String removeTooltip) {
         this.removeTooltip = removeTooltip;
         return this;
     }
-
+    
     public LongListBuilder requireRestart() {
         requireRestart(true);
         return this;
     }
-
+    
     public LongListBuilder setCreateNewInstance(Function<LongListListEntry, LongListListEntry.LongListCell> createNewInstance) {
         this.createNewInstance = createNewInstance;
         return this;
     }
-
+    
     public LongListBuilder setExpanded(boolean expanded) {
         this.expanded = expanded;
         return this;
     }
-
+    
+    @Deprecated
+    @ApiStatus.ScheduledForRemoval
+    public LongListBuilder setExpended(boolean expanded) {
+        return setExpanded(expanded);
+    }
+    
     public LongListBuilder setSaveConsumer(Consumer<List<Long>> saveConsumer) {
         this.saveConsumer = saveConsumer;
         return this;
     }
-
+    
     public LongListBuilder setDefaultValue(Supplier<List<Long>> defaultValue) {
         this.defaultValue = defaultValue;
         return this;
     }
-
+    
     public LongListBuilder setMin(long min) {
         this.min = min;
         return this;
     }
-
+    
     public LongListBuilder setMax(long max) {
         this.max = max;
         return this;
     }
-
+    
     public LongListBuilder removeMin() {
         this.min = null;
         return this;
     }
-
+    
     public LongListBuilder removeMax() {
         this.max = null;
         return this;
     }
-
+    
     public LongListBuilder setDefaultValue(List<Long> defaultValue) {
         this.defaultValue = () -> defaultValue;
         return this;
     }
-
+    
     public LongListBuilder setTooltipSupplier(Supplier<Optional<String[]>> tooltipSupplier) {
         this.tooltipSupplier = list -> tooltipSupplier.get();
         return this;
     }
-
+    
     public LongListBuilder setTooltipSupplier(Function<List<Long>, Optional<String[]>> tooltipSupplier) {
         this.tooltipSupplier = tooltipSupplier;
         return this;
     }
-
+    
     public LongListBuilder setTooltip(Optional<String[]> tooltip) {
         this.tooltipSupplier = list -> tooltip;
         return this;
     }
-
+    
     public LongListBuilder setTooltip(String... tooltip) {
         this.tooltipSupplier = list -> Optional.ofNullable(tooltip);
         return this;
     }
-
+    
     @NotNull
     @Override
     public LongListListEntry build() {
@@ -149,5 +156,5 @@ public class LongListBuilder extends FieldBuilder<List<Long>, LongListListEntry>
             entry.setErrorSupplier(() -> errorSupplier.apply(entry.getValue()));
         return entry;
     }
-
+    
 }

+ 4 - 4
src/main/java/me/shedaniel/clothconfig2/impl/builders/LongSliderBuilder.java

@@ -61,18 +61,18 @@ public class LongSliderBuilder extends FieldBuilder<Long, LongSliderEntry> {
         this.tooltipSupplier = i -> tooltipSupplier.get();
         return this;
     }
-
+    
     public LongSliderBuilder setTooltip(Optional<String[]> tooltip) {
         this.tooltipSupplier = i -> tooltip;
         return this;
     }
-
+    
     public LongSliderBuilder setTooltip(String... tooltip) {
         this.tooltipSupplier = i -> Optional.ofNullable(tooltip);
         return this;
     }
-
-
+    
+    
     @NotNull
     @Override
     public LongSliderEntry build() {

+ 4 - 4
src/main/java/me/shedaniel/clothconfig2/impl/builders/SelectorBuilder.java

@@ -64,17 +64,17 @@ public class SelectorBuilder<T> extends FieldBuilder<T, SelectionListEntry<T>> {
         this.tooltipSupplier = e -> tooltip;
         return this;
     }
-
+    
     public SelectorBuilder<T> setTooltip(String... tooltip) {
         this.tooltipSupplier = e -> Optional.ofNullable(tooltip);
         return this;
     }
-
+    
     public SelectorBuilder<T> setNameProvider(Function<T, String> enumNameProvider) {
         this.nameProvider = enumNameProvider;
         return this;
     }
-
+    
     @NotNull
     @Override
     public SelectionListEntry<T> build() {
@@ -84,5 +84,5 @@ public class SelectorBuilder<T> extends FieldBuilder<T, SelectionListEntry<T>> {
             entry.setErrorSupplier(() -> errorSupplier.apply(entry.getValue()));
         return entry;
     }
-
+    
 }

+ 4 - 4
src/main/java/me/shedaniel/clothconfig2/impl/builders/StringFieldBuilder.java

@@ -55,17 +55,17 @@ public class StringFieldBuilder extends FieldBuilder<String, StringListEntry> {
         this.tooltipSupplier = tooltipSupplier;
         return this;
     }
-
+    
     public StringFieldBuilder setTooltip(Optional<String[]> tooltip) {
         this.tooltipSupplier = str -> tooltip;
         return this;
     }
-
+    
     public StringFieldBuilder setTooltip(String... tooltip) {
         this.tooltipSupplier = str -> Optional.ofNullable(tooltip);
         return this;
     }
-
+    
     @NotNull
     @Override
     public StringListEntry build() {
@@ -75,5 +75,5 @@ public class StringFieldBuilder extends FieldBuilder<String, StringListEntry> {
             entry.setErrorSupplier(() -> errorSupplier.apply(entry.getValue()));
         return entry;
     }
-
+    
 }

+ 28 - 21
src/main/java/me/shedaniel/clothconfig2/impl/builders/StringListBuilder.java

@@ -2,6 +2,7 @@ package me.shedaniel.clothconfig2.impl.builders;
 
 import me.shedaniel.clothconfig2.gui.entries.StringListListEntry;
 import net.minecraft.client.resource.language.I18n;
+import org.jetbrains.annotations.ApiStatus;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.List;
@@ -11,7 +12,7 @@ import java.util.function.Function;
 import java.util.function.Supplier;
 
 public class StringListBuilder extends FieldBuilder<List<String>, StringListListEntry> {
-
+    
     private Function<String, Optional<String>> cellErrorSupplier;
     private Consumer<List<String>> saveConsumer = null;
     private Function<List<String>, Optional<String[]>> tooltipSupplier = list -> Optional.empty();
@@ -20,96 +21,102 @@ public class StringListBuilder extends FieldBuilder<List<String>, StringListList
     private Function<StringListListEntry, StringListListEntry.StringListCell> createNewInstance;
     private String addTooltip = I18n.translate("text.cloth-config.list.add"), removeTooltip = I18n.translate("text.cloth-config.list.remove");
     private boolean deleteButtonEnabled = true, insertInFront = true;
-
+    
     public StringListBuilder(String resetButtonKey, String fieldNameKey, List<String> value) {
         super(resetButtonKey, fieldNameKey);
         this.value = value;
     }
-
+    
     public Function<String, Optional<String>> getCellErrorSupplier() {
         return cellErrorSupplier;
     }
-
+    
     public StringListBuilder setCellErrorSupplier(Function<String, Optional<String>> cellErrorSupplier) {
         this.cellErrorSupplier = cellErrorSupplier;
         return this;
     }
-
+    
     public StringListBuilder setErrorSupplier(Function<List<String>, Optional<String>> errorSupplier) {
         this.errorSupplier = errorSupplier;
         return this;
     }
-
+    
     public StringListBuilder setDeleteButtonEnabled(boolean deleteButtonEnabled) {
         this.deleteButtonEnabled = deleteButtonEnabled;
         return this;
     }
-
+    
     public StringListBuilder setInsertInFront(boolean insertInFront) {
         this.insertInFront = insertInFront;
         return this;
     }
-
+    
     public StringListBuilder setAddButtonTooltip(String addTooltip) {
         this.addTooltip = addTooltip;
         return this;
     }
-
+    
     public StringListBuilder setRemoveButtonTooltip(String removeTooltip) {
         this.removeTooltip = removeTooltip;
         return this;
     }
-
+    
     public StringListBuilder requireRestart() {
         requireRestart(true);
         return this;
     }
-
+    
     public StringListBuilder setCreateNewInstance(Function<StringListListEntry, StringListListEntry.StringListCell> createNewInstance) {
         this.createNewInstance = createNewInstance;
         return this;
     }
-
+    
     public StringListBuilder setExpanded(boolean expanded) {
         this.expanded = expanded;
         return this;
     }
-
+    
+    @Deprecated
+    @ApiStatus.ScheduledForRemoval
+    public StringListBuilder setExpended(boolean expanded) {
+        return setExpanded(expanded);
+    }
+    
     public StringListBuilder setSaveConsumer(Consumer<List<String>> saveConsumer) {
         this.saveConsumer = saveConsumer;
         return this;
     }
-
+    
     public StringListBuilder setDefaultValue(Supplier<List<String>> defaultValue) {
         this.defaultValue = defaultValue;
         return this;
     }
-
+    
     public StringListBuilder setDefaultValue(List<String> defaultValue) {
         this.defaultValue = () -> defaultValue;
         return this;
     }
-
+    
     public StringListBuilder setTooltipSupplier(Supplier<Optional<String[]>> tooltipSupplier) {
         this.tooltipSupplier = list -> tooltipSupplier.get();
         return this;
     }
-
+    
     public StringListBuilder setTooltipSupplier(Function<List<String>, Optional<String[]>> tooltipSupplier) {
         this.tooltipSupplier = tooltipSupplier;
         return this;
     }
-
+    
     public StringListBuilder setTooltip(Optional<String[]> tooltip) {
         this.tooltipSupplier = list -> tooltip;
         return this;
     }
-
+    
     public StringListBuilder setTooltip(String... tooltip) {
         this.tooltipSupplier = list -> Optional.ofNullable(tooltip);
         return this;
     }
-
+    
     @NotNull
     @Override
     public StringListListEntry build() {
@@ -124,5 +131,5 @@ public class StringListBuilder extends FieldBuilder<List<String>, StringListList
             entry.setErrorSupplier(() -> errorSupplier.apply(entry.getValue()));
         return entry;
     }
-
+    
 }

+ 12 - 5
src/main/java/me/shedaniel/clothconfig2/impl/builders/SubCategoryBuilder.java

@@ -3,6 +3,7 @@ package me.shedaniel.clothconfig2.impl.builders;
 import com.google.common.collect.Lists;
 import me.shedaniel.clothconfig2.api.AbstractConfigListEntry;
 import me.shedaniel.clothconfig2.gui.entries.SubCategoryListEntry;
+import org.jetbrains.annotations.ApiStatus;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.*;
@@ -34,22 +35,28 @@ public class SubCategoryBuilder extends FieldBuilder<Object, SubCategoryListEntr
         this.tooltipSupplier = tooltipSupplier;
         return this;
     }
-
+    
     public SubCategoryBuilder setTooltip(Optional<String[]> tooltip) {
         this.tooltipSupplier = list -> tooltip;
         return this;
     }
-
+    
     public SubCategoryBuilder setTooltip(String... tooltip) {
         this.tooltipSupplier = list -> Optional.ofNullable(tooltip);
         return this;
     }
-
+    
     public SubCategoryBuilder setExpanded(boolean expanded) {
         this.expanded = expanded;
         return this;
     }
-
+    
+    @Deprecated
+    @ApiStatus.ScheduledForRemoval
+    public SubCategoryBuilder setExpended(boolean expanded) {
+        return setExpanded(expanded);
+    }
+    
     @NotNull
     @Override
     public SubCategoryListEntry build() {
@@ -57,7 +64,7 @@ public class SubCategoryBuilder extends FieldBuilder<Object, SubCategoryListEntr
         entry.setTooltipSupplier(() -> tooltipSupplier.apply(entry.getValue()));
         return entry;
     }
-
+    
     @Override
     public int size() {
         return entries.size();

+ 8 - 9
src/main/java/me/shedaniel/clothconfig2/impl/builders/TextDescriptionBuilder.java

@@ -8,17 +8,16 @@ import java.util.Optional;
 import java.util.function.Supplier;
 
 public class TextDescriptionBuilder extends FieldBuilder<String, TextListEntry> {
-
+    
     private int color = -1;
-    @Nullable
-    private Supplier<Optional<String[]>> tooltipSupplier = null;
+    @Nullable private Supplier<Optional<String[]>> tooltipSupplier = null;
     private String value;
-
+    
     public TextDescriptionBuilder(String resetButtonKey, String fieldNameKey, String value) {
         super(resetButtonKey, fieldNameKey);
         this.value = value;
     }
-
+    
     @Override
     public void requireRestart(boolean requireRestart) {
         throw new UnsupportedOperationException();
@@ -33,21 +32,21 @@ public class TextDescriptionBuilder extends FieldBuilder<String, TextListEntry>
         this.tooltipSupplier = () -> tooltip;
         return this;
     }
-
+    
     public TextDescriptionBuilder setTooltip(String... tooltip) {
         this.tooltipSupplier = () -> Optional.ofNullable(tooltip);
         return this;
     }
-
+    
     public TextDescriptionBuilder setColor(int color) {
         this.color = color;
         return this;
     }
-
+    
     @NotNull
     @Override
     public TextListEntry build() {
         return new TextListEntry(getFieldNameKey(), value, color, tooltipSupplier);
     }
-
+    
 }

+ 4 - 4
src/main/java/me/shedaniel/clothconfig2/impl/builders/TextFieldBuilder.java

@@ -55,17 +55,17 @@ public class TextFieldBuilder extends FieldBuilder<String, StringListEntry> {
         this.tooltipSupplier = tooltipSupplier;
         return this;
     }
-
+    
     public TextFieldBuilder setTooltip(Optional<String[]> tooltip) {
         this.tooltipSupplier = str -> tooltip;
         return this;
     }
-
+    
     public TextFieldBuilder setTooltip(String... tooltip) {
         this.tooltipSupplier = str -> Optional.ofNullable(tooltip);
         return this;
     }
-
+    
     @NotNull
     @Override
     public StringListEntry build() {
@@ -75,5 +75,5 @@ public class TextFieldBuilder extends FieldBuilder<String, StringListEntry> {
             entry.setErrorSupplier(() -> errorSupplier.apply(entry.getValue()));
         return entry;
     }
-
+    
 }