aboutsummaryrefslogtreecommitdiff
path: root/src/client/java/dev/isxander/yacl/gui/controllers/TickBoxController.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/controllers/TickBoxController.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/controllers/TickBoxController.java')
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/TickBoxController.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/TickBoxController.java b/src/client/java/dev/isxander/yacl/gui/controllers/TickBoxController.java
index b0ae449..3f615db 100644
--- a/src/client/java/dev/isxander/yacl/gui/controllers/TickBoxController.java
+++ b/src/client/java/dev/isxander/yacl/gui/controllers/TickBoxController.java
@@ -1,14 +1,14 @@
package dev.isxander.yacl.gui.controllers;
+import com.mojang.blaze3d.platform.InputConstants;
+import com.mojang.blaze3d.vertex.PoseStack;
import dev.isxander.yacl.api.Controller;
import dev.isxander.yacl.api.Option;
import dev.isxander.yacl.api.utils.Dimension;
import dev.isxander.yacl.gui.AbstractWidget;
import dev.isxander.yacl.gui.YACLScreen;
-import net.minecraft.client.gui.DrawableHelper;
-import net.minecraft.client.util.InputUtil;
-import net.minecraft.client.util.math.MatrixStack;
-import net.minecraft.text.Text;
+import net.minecraft.client.gui.GuiComponent;
+import net.minecraft.network.chat.Component;
/**
* This controller renders a tickbox
@@ -37,8 +37,8 @@ public class TickBoxController implements Controller<Boolean> {
* {@inheritDoc}
*/
@Override
- public Text formatValue() {
- return Text.empty();
+ public Component formatValue() {
+ return Component.empty();
}
/**
@@ -55,7 +55,7 @@ public class TickBoxController implements Controller<Boolean> {
}
@Override
- protected void drawHoveredControl(MatrixStack matrices, int mouseX, int mouseY, float delta) {
+ protected void drawHoveredControl(PoseStack matrices, int mouseX, int mouseY, float delta) {
int outlineSize = 10;
int outlineX1 = getDimension().xLimit() - getXPadding() - outlineSize;
int outlineY1 = getDimension().centerY() - outlineSize / 2;
@@ -68,13 +68,13 @@ public class TickBoxController implements Controller<Boolean> {
drawOutline(matrices, outlineX1 + 1, outlineY1 + 1, outlineX2 + 1, outlineY2 + 1, 1, shadowColor);
drawOutline(matrices, outlineX1, outlineY1, outlineX2, outlineY2, 1, color);
if (control.option().pendingValue()) {
- DrawableHelper.fill(matrices, outlineX1 + 3, outlineY1 + 3, outlineX2 - 1, outlineY2 - 1, shadowColor);
- DrawableHelper.fill(matrices, outlineX1 + 2, outlineY1 + 2, outlineX2 - 2, outlineY2 - 2, color);
+ GuiComponent.fill(matrices, outlineX1 + 3, outlineY1 + 3, outlineX2 - 1, outlineY2 - 1, shadowColor);
+ GuiComponent.fill(matrices, outlineX1 + 2, outlineY1 + 2, outlineX2 - 2, outlineY2 - 2, color);
}
}
@Override
- protected void drawValueText(MatrixStack matrices, int mouseX, int mouseY, float delta) {
+ protected void drawValueText(PoseStack matrices, int mouseX, int mouseY, float delta) {
if (!isHovered())
drawHoveredControl(matrices, mouseX, mouseY, delta);
}
@@ -109,7 +109,7 @@ public class TickBoxController implements Controller<Boolean> {
return false;
}
- if (keyCode == InputUtil.GLFW_KEY_ENTER || keyCode == InputUtil.GLFW_KEY_SPACE || keyCode == InputUtil.GLFW_KEY_KP_ENTER) {
+ if (keyCode == InputConstants.KEY_RETURN || keyCode == InputConstants.KEY_SPACE || keyCode == InputConstants.KEY_NUMPADENTER) {
toggleSetting();
return true;
}