diff --git a/src/main/java/net/uku3lig/ukulib/config/Position.java b/src/main/java/net/uku3lig/ukulib/config/Position.java index 2919c72..d4fd127 100644 --- a/src/main/java/net/uku3lig/ukulib/config/Position.java +++ b/src/main/java/net/uku3lig/ukulib/config/Position.java @@ -39,7 +39,15 @@ public enum Position { MIDDLE(4, "ukulib.position.middle"), ; + /** + * The id of the position. + * @return The id + */ private final int id; + /** + * The translation key of the position. + * @return The translation key + */ private final String translationKey; Position(int id, String translationKey) { diff --git a/src/main/java/net/uku3lig/ukulib/config/screen/PositionSelectScreen.java b/src/main/java/net/uku3lig/ukulib/config/screen/PositionSelectScreen.java index f021010..7ea5062 100644 --- a/src/main/java/net/uku3lig/ukulib/config/screen/PositionSelectScreen.java +++ b/src/main/java/net/uku3lig/ukulib/config/screen/PositionSelectScreen.java @@ -2,9 +2,9 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.ScreenTexts; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.screen.ScreenTexts; import net.minecraft.text.Text; import net.uku3lig.ukulib.config.ConfigManager; import org.lwjgl.glfw.GLFW; diff --git a/src/main/java/net/uku3lig/ukulib/mixin/MixinCyclingButtonWidgetBuilder.java b/src/main/java/net/uku3lig/ukulib/mixin/MixinCyclingButtonWidgetBuilder.java index 296d873..6e26af0 100644 --- a/src/main/java/net/uku3lig/ukulib/mixin/MixinCyclingButtonWidgetBuilder.java +++ b/src/main/java/net/uku3lig/ukulib/mixin/MixinCyclingButtonWidgetBuilder.java @@ -1,7 +1,6 @@ package net.uku3lig.ukulib.mixin; import net.minecraft.client.gui.widget.CyclingButtonWidget; -import net.minecraft.client.option.SimpleOption; import net.minecraft.text.MutableText; import net.minecraft.text.Text; import net.uku3lig.ukulib.utils.Ukutils; @@ -27,14 +26,14 @@ public class MixinCyclingButtonWidgetBuilder { @Shadow private CyclingButtonWidget.Values values; @Shadow @Final private Function valueToText; @Shadow private Function, MutableText> narrationMessageFactory; - @Shadow private SimpleOption.TooltipFactory tooltipFactory; + @Shadow private CyclingButtonWidget.TooltipFactory tooltipFactory; @Shadow private boolean optionTextOmitted; @Inject(method = "build(IIIILnet/minecraft/text/Text;Lnet/minecraft/client/gui/widget/CyclingButtonWidget$UpdateCallback;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget;", - at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/CyclingButtonWidget;(IIIILnet/minecraft/text/Text;Lnet/minecraft/text/Text;ILjava/lang/Object;Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Values;Ljava/util/function/Function;Ljava/util/function/Function;Lnet/minecraft/client/gui/widget/CyclingButtonWidget$UpdateCallback;Lnet/minecraft/client/option/SimpleOption$TooltipFactory;Z)V"), + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/CyclingButtonWidget;(IIIILnet/minecraft/text/Text;Lnet/minecraft/text/Text;ILjava/lang/Object;Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Values;Ljava/util/function/Function;Ljava/util/function/Function;Lnet/minecraft/client/gui/widget/CyclingButtonWidget$UpdateCallback;Lnet/minecraft/client/gui/widget/CyclingButtonWidget$TooltipFactory;Z)V"), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) private void fixText(int x, int y, int width, int height, Text optionText, CyclingButtonWidget.UpdateCallback callback, CallbackInfoReturnable> cir, List list, T object, Text text, Text text2) { - if (text2.contains(Ukutils.BUTTON_PLACEHOLDER)) text2 = optionText; + if (text2.getString().contains(Ukutils.BUTTON_PLACEHOLDER.getString())) text2 = optionText; CyclingButtonWidget w = new CyclingButtonWidget<>(x, y, width, height, text2, optionText, this.initialIndex, object, this.values, this.valueToText, this.narrationMessageFactory, callback, this.tooltipFactory, this.optionTextOmitted); cir.setReturnValue(w); diff --git a/src/main/resources/ukulib.accesswidener b/src/main/resources/ukulib.accesswidener index f423a14..89b7fe7 100644 --- a/src/main/resources/ukulib.accesswidener +++ b/src/main/resources/ukulib.accesswidener @@ -1,3 +1,5 @@ accessWidener v1 named -accessible method net/minecraft/client/gui/widget/CyclingButtonWidget (IIIILnet/minecraft/text/Text;Lnet/minecraft/text/Text;ILjava/lang/Object;Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Values;Ljava/util/function/Function;Ljava/util/function/Function;Lnet/minecraft/client/gui/widget/CyclingButtonWidget$UpdateCallback;Lnet/minecraft/client/option/SimpleOption$TooltipFactory;Z)V \ No newline at end of file +accessible method net/minecraft/client/gui/widget/CyclingButtonWidget (IIIILnet/minecraft/text/Text;Lnet/minecraft/text/Text;ILjava/lang/Object;Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Values;Ljava/util/function/Function;Ljava/util/function/Function;Lnet/minecraft/client/gui/widget/CyclingButtonWidget$UpdateCallback;Lnet/minecraft/client/gui/widget/CyclingButtonWidget$TooltipFactory;Z)V + +accessible class net/minecraft/client/gui/widget/CyclingButtonWidget$Values \ No newline at end of file