diff options
author | isXander <xandersmith2008@gmail.com> | 2022-12-01 18:17:59 +0000 |
---|---|---|
committer | isXander <xandersmith2008@gmail.com> | 2022-12-01 18:17:59 +0000 |
commit | aba4bcb529e7613de181ea7410fc3d371c9b3d07 (patch) | |
tree | 52244a40a4cc88267ae1692edb720b13160a1daa /src/client/java/dev/isxander/yacl/gui/controllers | |
parent | 60a06e94e2fc176294f9ff426fee6d0621946c22 (diff) | |
download | YetAnotherConfigLib-aba4bcb529e7613de181ea7410fc3d371c9b3d07.tar.gz YetAnotherConfigLib-aba4bcb529e7613de181ea7410fc3d371c9b3d07.tar.bz2 YetAnotherConfigLib-aba4bcb529e7613de181ea7410fc3d371c9b3d07.zip |
generify element list widgets and prevent wrapping soft-lock
Diffstat (limited to 'src/client/java/dev/isxander/yacl/gui/controllers')
-rw-r--r-- | src/client/java/dev/isxander/yacl/gui/controllers/BooleanController.java | 9 | ||||
-rw-r--r-- | src/client/java/dev/isxander/yacl/gui/controllers/ControllerWidget.java | 4 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/BooleanController.java b/src/client/java/dev/isxander/yacl/gui/controllers/BooleanController.java index 7037ff5..b696831 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/BooleanController.java +++ b/src/client/java/dev/isxander/yacl/gui/controllers/BooleanController.java @@ -6,6 +6,7 @@ import dev.isxander.yacl.api.utils.Dimension; import dev.isxander.yacl.gui.AbstractWidget; import dev.isxander.yacl.gui.YACLScreen; import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.screen.ScreenTexts; import net.minecraft.text.Text; import net.minecraft.util.Formatting; import org.lwjgl.glfw.GLFW; @@ -19,8 +20,8 @@ public class BooleanController implements Controller<Boolean> { public static final Function<Boolean, Text> ON_OFF_FORMATTER = (state) -> state - ? Text.translatable("options.on") - : Text.translatable("options.off"); + ? ScreenTexts.ON + : ScreenTexts.OFF; public static final Function<Boolean, Text> TRUE_FALSE_FORMATTER = (state) -> state @@ -29,8 +30,8 @@ public class BooleanController implements Controller<Boolean> { public static final Function<Boolean, Text> YES_NO_FORMATTER = (state) -> state - ? Text.translatable("gui.yes") - : Text.translatable("gui.no"); + ? ScreenTexts.YES + : ScreenTexts.NO; private final Option<Boolean> option; private final Function<Boolean, Text> valueFormatter; diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/ControllerWidget.java b/src/client/java/dev/isxander/yacl/gui/controllers/ControllerWidget.java index c7f9e97..cebaba7 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/ControllerWidget.java +++ b/src/client/java/dev/isxander/yacl/gui/controllers/ControllerWidget.java @@ -4,6 +4,7 @@ import dev.isxander.yacl.api.Controller; import dev.isxander.yacl.api.utils.Dimension; import dev.isxander.yacl.gui.AbstractWidget; import dev.isxander.yacl.gui.YACLScreen; +import dev.isxander.yacl.impl.utils.YACLConstants; import net.minecraft.client.font.MultilineText; import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder; @@ -44,6 +45,9 @@ public abstract class ControllerWidget<T extends Controller<?>> extends Abstract nameString = nameString.substring(0, Math.max(nameString.length() - (firstIter ? 2 : 5), 0)).trim(); nameString += "..."; + if (nameString.equals("...")) + break; + firstIter = false; } |