From a3484c8995e5bb0026a8a931c7a4bbbb78e92d68 Mon Sep 17 00:00:00 2001 From: Juuxel <6596629+Juuxel@users.noreply.github.com> Date: Sun, 11 Oct 2020 13:20:35 +0300 Subject: Add WPlayerInvPanel.createInventoryLabel --- .../io/github/cottonmc/cotton/gui/widget/WPlayerInvPanel.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 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 3879e1f..2a64a74 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 @@ -34,7 +34,7 @@ public class WPlayerInvPanel extends WPlainPanel { * @since 2.0.0 */ public WPlayerInvPanel(PlayerInventory playerInventory, boolean hasLabel) { - this(playerInventory, hasLabel ? createDefaultLabel(playerInventory) : null); + this(playerInventory, hasLabel ? createInventoryLabel(playerInventory) : null); } /** @@ -59,7 +59,14 @@ public class WPlayerInvPanel extends WPlainPanel { this.add(hotbar, 0, y + 58); } - private static WLabel createDefaultLabel(PlayerInventory playerInventory) { + /** + * Creates a vanilla-style inventory label for a player inventory. + * + * @param playerInventory the player inventory + * @return the created label + * @since 3.1.0 + */ + public static WLabel createInventoryLabel(PlayerInventory playerInventory) { WLabel label = new WLabel(playerInventory.getDisplayName()); label.setSize(9*18, 11); return label; -- cgit