Browse Source

Pull error supplier assignment as far up as possible

Mitchell Skaggs 5 years ago
parent
commit
695eedaf25

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

@@ -75,6 +75,7 @@ public abstract class AbstractListListEntry<T, C extends AbstractListListEntry.A
 
         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();

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

@@ -61,7 +61,6 @@ public abstract class AbstractTextFieldListListEntry<T, C extends AbstractTextFi
             final T finalValue = substituteDefault(value);
 
             widget = new TextFieldWidget(MinecraftClient.getInstance().textRenderer, 0, 0, 100, 18, "");
-            this.setErrorSupplier(() -> Optional.ofNullable(listListEntry.cellErrorSupplier).flatMap(cellErrorFn -> cellErrorFn.apply(this.getValue())));
             widget.setTextPredicate(this::isValidText);
             widget.setMaxLength(Integer.MAX_VALUE);
             widget.setHasBorder(false);