aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java
diff options
context:
space:
mode:
authorxander <xander@isxander.dev>2022-09-10 13:45:27 +0100
committerxander <xander@isxander.dev>2022-09-10 19:09:09 +0100
commitaa98d07d08c738e32f7804d2d139eb3cdeb6bddb (patch)
treecfe33752f42a5b857a4e510c1cf270b911c97b93 /src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java
parentc72f2d573ba425871642f2c5b98e7630c10c30fd (diff)
downloadYetAnotherConfigLib-aa98d07d08c738e32f7804d2d139eb3cdeb6bddb.tar.gz
YetAnotherConfigLib-aa98d07d08c738e32f7804d2d139eb3cdeb6bddb.tar.bz2
YetAnotherConfigLib-aa98d07d08c738e32f7804d2d139eb3cdeb6bddb.zip
improve expand minimize button in option groups
Diffstat (limited to 'src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java')
-rw-r--r--src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java b/src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java
new file mode 100644
index 0000000..240cfb2
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java
@@ -0,0 +1,27 @@
+package dev.isxander.yacl.gui;
+
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.widget.ButtonWidget;
+import net.minecraft.client.util.math.MatrixStack;
+import net.minecraft.text.Text;
+import net.minecraft.util.math.MathHelper;
+
+public class LowProfileButtonWidget extends ButtonWidget {
+ public LowProfileButtonWidget(int x, int y, int width, int height, Text message, PressAction onPress) {
+ super(x, y, width, height, message, onPress);
+ }
+
+ public LowProfileButtonWidget(int x, int y, int width, int height, Text message, PressAction onPress, TooltipSupplier tooltipSupplier) {
+ super(x, y, width, height, message, onPress, tooltipSupplier);
+ }
+
+ @Override
+ public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) {
+ if (!isHovered()) {
+ int j = this.active ? 0xFFFFFF : 0xA0A0A0;
+ drawCenteredText(matrices, MinecraftClient.getInstance().textRenderer, this.getMessage(), this.x + this.width / 2, this.y + (this.height - 8) / 2, j | MathHelper.ceil(this.alpha * 255.0F) << 24);
+ } else {
+ super.renderButton(matrices, mouseX, mouseY, delta);
+ }
+ }
+}