From 3695e8687874559214ac7310b7cfb4c039b9f2fc Mon Sep 17 00:00:00 2001
From: Juuxel <kasperi.kauppi@gmail.com>
Date: Thu, 18 Jun 2020 12:45:43 +0300
Subject: Fix color of player inventory labels not matching the title color of
 the GUI

---
 .../io/github/cottonmc/cotton/gui/widget/WPlayerInvPanel.java | 11 +++++++++++
 1 file changed, 11 insertions(+)

(limited to 'src')

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());
+		}
+	}
 }
 
-- 
cgit