diff options
4 files changed, 10 insertions, 19 deletions
diff --git a/gradle.properties b/gradle.properties index 358c97d..d624cb9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ org.gradle.jvmargs=-Xmx3G -minecraftVersion=23w04a +minecraftVersion=23w05a fabricLoaderVersion=0.14.13 -qmBuild=5 +qmBuild=1 modId=yet-another-config-lib modName=YetAnotherConfigLib diff --git a/src/client/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java b/src/client/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java index 3b66b6a..15257e3 100644 --- a/src/client/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java +++ b/src/client/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java @@ -18,12 +18,12 @@ public class LowProfileButtonWidget extends Button { } @Override - public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) { + public void renderButton(PoseStack matrices, int mouseX, int mouseY) { if (!isHoveredOrFocused() || !active) { int j = this.active ? 0xFFFFFF : 0xA0A0A0; - drawCenteredString(matrices, Minecraft.getInstance().font, this.getMessage(), this.getX() + this.width / 2, this.getY() + (this.height - 8) / 2, j | Mth.ceil(this.alpha * 255.0F) << 24); + this.renderString(matrices, Minecraft.getInstance().font, this.getX() + this.width / 2, this.getY() + (this.height - 8) / 2, j); } else { - super.renderButton(matrices, mouseX, mouseY, delta); + super.renderButton(matrices, mouseX, mouseY); } } } diff --git a/src/client/java/dev/isxander/yacl/gui/SearchFieldWidget.java b/src/client/java/dev/isxander/yacl/gui/SearchFieldWidget.java index 103831d..72cf549 100644 --- a/src/client/java/dev/isxander/yacl/gui/SearchFieldWidget.java +++ b/src/client/java/dev/isxander/yacl/gui/SearchFieldWidget.java @@ -22,8 +22,8 @@ public class SearchFieldWidget extends EditBox { } @Override - public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) { - super.renderButton(matrices, mouseX, mouseY, delta); + public void renderWidget(PoseStack matrices, int mouseX, int mouseY, float delta) { + super.renderWidget(matrices, mouseX, mouseY, delta); if (isVisible() && isEmpty()) { font.drawShadow(matrices, emptyText, getX() + 4, this.getY() + (this.height - 8) / 2f, 0x707070); } diff --git a/src/client/java/dev/isxander/yacl/gui/TextScaledButtonWidget.java b/src/client/java/dev/isxander/yacl/gui/TextScaledButtonWidget.java index 76ba14f..e52174a 100644 --- a/src/client/java/dev/isxander/yacl/gui/TextScaledButtonWidget.java +++ b/src/client/java/dev/isxander/yacl/gui/TextScaledButtonWidget.java @@ -23,22 +23,13 @@ public class TextScaledButtonWidget extends Button { } @Override - public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) { - // prevents super from rendering text - Component message = getMessage(); - setMessage(Component.empty()); - - super.renderButton(matrices, mouseX, mouseY, delta); - - setMessage(message); - int j = this.active ? 16777215 : 10526880; - FormattedCharSequence orderedText = getMessage().getVisualOrderText(); + public void renderString(PoseStack matrices, Font textRenderer, int x, int y, int color) { Font font = Minecraft.getInstance().font; matrices.pushPose(); - matrices.translate(((this.getX() + this.width / 2f) - font.width(orderedText) * textScale / 2), (float)this.getY() + (this.height - 8 * textScale) / 2f / textScale, 0); + matrices.translate(((this.getX() + this.width / 2f) - font.width(getMessage()) * textScale / 2), (float)this.getY() + (this.height - 8 * textScale) / 2f / textScale, 0); matrices.scale(textScale, textScale, 1); - font.drawShadow(matrices, orderedText, 0, 0, j | Mth.ceil(this.alpha * 255.0F) << 24); + font.drawShadow(matrices, getMessage(), 0, 0, color | Mth.ceil(this.alpha * 255.0F) << 24); matrices.popPose(); } } |