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); } } }