Fix Widget Foreground Color not allowing pure black (#6460)

This commit is contained in:
Cadiboo 2020-01-23 06:25:35 +11:00 committed by LexManos
parent 2d30419a31
commit 0f27975f77
2 changed files with 10 additions and 15 deletions

View File

@ -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;
+ }
}

View File

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