diff options
author | Juuz <6596629+Juuxel@users.noreply.github.com> | 2021-12-24 17:20:36 +0200 |
---|---|---|
committer | Juuz <6596629+Juuxel@users.noreply.github.com> | 2021-12-24 17:20:36 +0200 |
commit | 42d6ad1f8f94d0ce0c9e3c0a9c8112d2a84d2da8 (patch) | |
tree | 71c75fc5555d8ba946200ae48db97e6531aaba7a /src/main | |
parent | fa43ee9fcf370f278e6665c285e98d8d01e24f6f (diff) | |
download | LibGui-42d6ad1f8f94d0ce0c9e3c0a9c8112d2a84d2da8.tar.gz LibGui-42d6ad1f8f94d0ce0c9e3c0a9c8112d2a84d2da8.tar.bz2 LibGui-42d6ad1f8f94d0ce0c9e3c0a9c8112d2a84d2da8.zip |
Add CottonInventoryScreen ctor overloads with PlayerInventory
Closes #147.
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java | 36 |
1 files changed, 30 insertions, 6 deletions
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 96da107..53fbcba 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 @@ -5,6 +5,7 @@ import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder; import net.minecraft.client.render.DiffuseLighting; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.text.LiteralText; import net.minecraft.text.Style; import net.minecraft.text.Text; @@ -36,21 +37,23 @@ public class CottonInventoryScreen<T extends SyncedGuiDescription> extends Handl * Constructs a new screen without a title. * * @param description the GUI description - * @param player the player + * @param inventory the player inventory + * @since 5.2.0 */ - public CottonInventoryScreen(T description, PlayerEntity player) { - this(description, player, new LiteralText("")); + public CottonInventoryScreen(T description, PlayerInventory inventory) { + this(description, inventory, new LiteralText("")); } /** * Constructs a new screen. * * @param description the GUI description - * @param player the player + * @param inventory the player inventory * @param title the screen title + * @since 5.2.0 */ - public CottonInventoryScreen(T description, PlayerEntity player, Text title) { - super(description, player.getInventory(), title); + public CottonInventoryScreen(T description, PlayerInventory inventory, Text title) { + super(description, inventory, title); this.description = description; width = 18*9; height = 18*9; @@ -58,6 +61,27 @@ public class CottonInventoryScreen<T extends SyncedGuiDescription> extends Handl this.backgroundHeight = 18*9; description.getRootPanel().validate(description); } + + /** + * 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.getInventory()); + } + + /** + * 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) { + this(description, player.getInventory(), title); + } /* * RENDERING NOTES: |