From d866f96541b03c80fbc417c5ab5e87d7189bb723 Mon Sep 17 00:00:00 2001
From: Juuxel <6596629+Juuxel@users.noreply.github.com>
Date: Fri, 5 Jun 2020 17:59:04 +0300
Subject: CottonInventoryScreen: Add constructor with screen title, document

---
 .../cotton/gui/client/CottonInventoryScreen.java   | 33 ++++++++++++++++++----
 1 file changed, 27 insertions(+), 6 deletions(-)

(limited to 'src/main')

diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java
index a8327c2..5744aba 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java
@@ -7,21 +7,42 @@ import net.minecraft.client.util.math.MatrixStack;
 import net.minecraft.entity.player.PlayerEntity;
 import net.minecraft.text.LiteralText;
 import net.minecraft.text.Style;
+import net.minecraft.text.Text;
 import org.lwjgl.glfw.GLFW;
 
 import io.github.cottonmc.cotton.gui.CottonInventoryController;
 import io.github.cottonmc.cotton.gui.widget.WPanel;
 import io.github.cottonmc.cotton.gui.widget.WWidget;
 
+/**
+ * A screen for a {@link CottonInventoryController}.
+ *
+ * @param <T> the controller type
+ */
 public class CottonInventoryScreen<T extends CottonInventoryController> extends HandledScreen<T> implements TextHoverRendererScreen {
 	protected CottonInventoryController description;
-	public static final int PADDING = 8;
 	protected WWidget lastResponder = null;
-	protected WWidget focus = null;
-	
-	public CottonInventoryScreen(T container, PlayerEntity player) {
-		super(container, player.inventory, new LiteralText(""));
-		this.description = container;
+
+	/**
+	 * Constructs a new screen without a title.
+	 *
+	 * @param description the GUI description
+	 * @param player     the player
+	 */
+	public CottonInventoryScreen(T description, PlayerEntity player) {
+		this(description, player, new LiteralText(""));
+	}
+
+	/**
+	 * Constructs a new screen.
+	 *
+	 * @param description the GUI description
+	 * @param player      the player
+	 * @param title       the screen title
+	 */
+	public CottonInventoryScreen(T description, PlayerEntity player, Text title) {
+		super(description, player.inventory, title);
+		this.description = description;
 		width = 18*9;
 		height = 18*9;
 		this.backgroundWidth = 18*9;
-- 
cgit