aboutsummaryrefslogtreecommitdiff
path: root/src/client/java/dev/isxander/yacl/gui/TooltipButtonWidget.java
diff options
context:
space:
mode:
authorisXander <xandersmith2008@gmail.com>2023-01-19 21:15:26 +0000
committerisXander <xandersmith2008@gmail.com>2023-01-19 21:15:26 +0000
commitee53b51a1e8d88085c75f227f4710b68c03b19c8 (patch)
tree77a942242a982757da040a6120950bad30e49f77 /src/client/java/dev/isxander/yacl/gui/TooltipButtonWidget.java
parentffdd6e5ceacd71c76c55a8716702d4d6da17c7ab (diff)
downloadYetAnotherConfigLib-ee53b51a1e8d88085c75f227f4710b68c03b19c8.tar.gz
YetAnotherConfigLib-ee53b51a1e8d88085c75f227f4710b68c03b19c8.tar.bz2
YetAnotherConfigLib-ee53b51a1e8d88085c75f227f4710b68c03b19c8.zip
mojmap
Diffstat (limited to 'src/client/java/dev/isxander/yacl/gui/TooltipButtonWidget.java')
-rw-r--r--src/client/java/dev/isxander/yacl/gui/TooltipButtonWidget.java29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/client/java/dev/isxander/yacl/gui/TooltipButtonWidget.java b/src/client/java/dev/isxander/yacl/gui/TooltipButtonWidget.java
index 359e8d0..1395a3f 100644
--- a/src/client/java/dev/isxander/yacl/gui/TooltipButtonWidget.java
+++ b/src/client/java/dev/isxander/yacl/gui/TooltipButtonWidget.java
@@ -1,35 +1,34 @@
package dev.isxander.yacl.gui;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.font.MultilineText;
-import net.minecraft.client.gui.screen.Screen;
-import net.minecraft.client.gui.tooltip.Tooltip;
-import net.minecraft.client.gui.widget.ButtonWidget;
-import net.minecraft.client.util.math.MatrixStack;
-import net.minecraft.text.Text;
+import com.mojang.blaze3d.vertex.PoseStack;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.components.Button;
+import net.minecraft.client.gui.components.MultiLineLabel;
+import net.minecraft.client.gui.screens.Screen;
+import net.minecraft.network.chat.Component;
public class TooltipButtonWidget extends TextScaledButtonWidget {
protected final Screen screen;
- protected MultilineText wrappedDescription;
+ protected MultiLineLabel wrappedDescription;
- public TooltipButtonWidget(Screen screen, int x, int y, int width, int height, Text message, float textScale, Text tooltip, PressAction onPress) {
+ public TooltipButtonWidget(Screen screen, int x, int y, int width, int height, Component message, float textScale, Component tooltip, Button.OnPress onPress) {
super(x, y, width, height, textScale, message, onPress);
this.screen = screen;
setTooltip(tooltip);
}
- public TooltipButtonWidget(Screen screen, int x, int y, int width, int height, Text message, Text tooltip, PressAction onPress) {
+ public TooltipButtonWidget(Screen screen, int x, int y, int width, int height, Component message, Component tooltip, Button.OnPress onPress) {
this(screen, x, y, width, height, message, 1, tooltip, onPress);
}
- public void renderHoveredTooltip(MatrixStack matrices) {
- if (isHovered()) {
- YACLScreen.renderMultilineTooltip(matrices, MinecraftClient.getInstance().textRenderer, wrappedDescription, getX() + width / 2, getY() - 4, getY() + height + 4, screen.width, screen.height);
+ public void renderHoveredTooltip(PoseStack matrices) {
+ if (isHoveredOrFocused()) {
+ YACLScreen.renderMultilineTooltip(matrices, Minecraft.getInstance().font, wrappedDescription, getX() + width / 2, getY() - 4, getY() + height + 4, screen.width, screen.height);
}
}
- public void setTooltip(Text tooltip) {
- wrappedDescription = MultilineText.create(MinecraftClient.getInstance().textRenderer, tooltip, screen.width / 3 - 5);
+ public void setTooltip(Component tooltip) {
+ wrappedDescription = MultiLineLabel.create(Minecraft.getInstance().font, tooltip, screen.width / 3 - 5);
}
}