package dev.isxander.yacl.gui; import net.minecraft.client.MinecraftClient; 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 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, DEFAULT_NARRATION_SUPPLIER); } public LowProfileButtonWidget(int x, int y, int width, int height, Text message, PressAction onPress, Tooltip tooltip) { this(x, y, width, height, message, onPress); setTooltip(tooltip); } @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.getX() + this.width / 2, this.getY() + (this.height - 8) / 2, j | MathHelper.ceil(this.alpha * 255.0F) << 24); } else { super.renderButton(matrices, mouseX, mouseY, delta); } } }