From 0f27975f77996b7fea8e7c2717d23717c8f90d02 Mon Sep 17 00:00:00 2001 From: Cadiboo <37298044+Cadiboo@users.noreply.github.com> Date: Thu, 23 Jan 2020 06:25:35 +1100 Subject: [PATCH] Fix Widget Foreground Color not allowing pure black (#6460) --- .../client/gui/widget/Widget.java.patch | 8 ++++++-- .../fml/client/config/GuiButtonExt.java | 17 ++++------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/gui/widget/Widget.java.patch b/patches/minecraft/net/minecraft/client/gui/widget/Widget.java.patch index 8a4bd7e99..b73daf954 100644 --- a/patches/minecraft/net/minecraft/client/gui/widget/Widget.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/widget/Widget.java.patch @@ -29,12 +29,16 @@ this.focused = p_setFocused_1_; } + ++ public static final int UNSET_FG_COLOR = -1; + protected int packedFGColor = 0; + public int getFGColor() { -+ if (packedFGColor != 0) return packedFGColor; -+ return this.active ? 16777215 : 10526880; ++ if (packedFGColor != UNSET_FG_COLOR) return packedFGColor; ++ return this.active ? 16777215 : 10526880; // White : Light Grey + } + public void setFGColor(int color) { + this.packedFGColor = color; ++ } ++ public void clearFGColor() { ++ this.packedFGColor = UNSET_FG_COLOR; + } } diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiButtonExt.java b/src/main/java/net/minecraftforge/fml/client/config/GuiButtonExt.java index 666f432ba..f4eff64a5 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiButtonExt.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiButtonExt.java @@ -20,6 +20,7 @@ package net.minecraftforge.fml.client.config; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.widget.Widget; import net.minecraft.client.gui.widget.button.Button; /** @@ -52,20 +53,10 @@ public class GuiButtonExt extends Button int k = this.getYImage(this.isHovered); GuiUtils.drawContinuousTexturedBox(WIDGETS_LOCATION, this.x, this.y, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.getBlitOffset()); this.renderBg(mc, mouseX, mouseY); - int color = 14737632; + int color = getFGColor(); - if (packedFGColor != 0) - { - color = packedFGColor; - } - else if (!this.active) - { - color = 10526880; - } - else if (this.isHovered) - { - color = 16777120; - } + if (this.isHovered && this.packedFGColor == Widget.UNSET_FG_COLOR) + color = 0xFFFFA0; // Slightly Yellow String buttonText = this.getMessage(); int strWidth = mc.fontRenderer.getStringWidth(buttonText);