diff options
author | Juuxel <kasperi.kauppi@gmail.com> | 2020-06-18 12:45:43 +0300 |
---|---|---|
committer | Juuxel <kasperi.kauppi@gmail.com> | 2020-06-18 12:45:43 +0300 |
commit | 3695e8687874559214ac7310b7cfb4c039b9f2fc (patch) | |
tree | 62088de1d5c130d36d2ab728ca0c96d654337e46 | |
parent | fb27ffd22d0d5a722476b342b42bca8b4c91df0c (diff) | |
download | LibGui-3695e8687874559214ac7310b7cfb4c039b9f2fc.tar.gz LibGui-3695e8687874559214ac7310b7cfb4c039b9f2fc.tar.bz2 LibGui-3695e8687874559214ac7310b7cfb4c039b9f2fc.zip |
Fix color of player inventory labels not matching the title color of the GUI
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/widget/WPlayerInvPanel.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WPlayerInvPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WPlayerInvPanel.java index da2ac1c..91fa547 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WPlayerInvPanel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WPlayerInvPanel.java @@ -1,5 +1,6 @@ package io.github.cottonmc.cotton.gui.widget; +import io.github.cottonmc.cotton.gui.GuiDescription; import io.github.cottonmc.cotton.gui.client.BackgroundPainter; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -13,6 +14,8 @@ import javax.annotation.Nullable; public class WPlayerInvPanel extends WPlainPanel { private final WItemSlot inv; private final WItemSlot hotbar; + @Nullable + private final WWidget label; /** * Constructs a player inventory panel with a label. @@ -44,6 +47,7 @@ public class WPlayerInvPanel extends WPlainPanel { public WPlayerInvPanel(PlayerInventory playerInventory, @Nullable WWidget label) { int y = 0; + this.label = label; if (label != null) { this.add(label, 0, 0, label.getWidth(), label.getHeight()); y += label.getHeight(); @@ -75,5 +79,12 @@ public class WPlayerInvPanel extends WPlainPanel { hotbar.setBackgroundPainter(painter); return this; } + + @Override + public void validate(GuiDescription c) { + if (c != null && label instanceof WLabel) { + ((WLabel) label).setColor(c.getTitleColor()); + } + } } |