From 453a8a9d7cb79d87c1720441442fc6944f1eb92a Mon Sep 17 00:00:00 2001 From: Juuz <6596629+Juuxel@users.noreply.github.com> Date: Sun, 11 Jul 2021 13:25:30 +0300 Subject: Call Inventory.onOpen and Inventory.onClose in SyncedGuiDescription --- .../java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java b/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java index b51e9ee..ebf9e56 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java @@ -92,6 +92,7 @@ public class SyncedGuiDescription extends ScreenHandler implements GuiDescriptio this.world = playerInventory.player.world; this.propertyDelegate = propertyDelegate; if (propertyDelegate!=null && propertyDelegate.size()>0) this.addProperties(propertyDelegate); + if (blockInventory != null) blockInventory.onOpen(playerInventory.player); } public WPanel getRootPanel() { @@ -477,6 +478,12 @@ public class SyncedGuiDescription extends ScreenHandler implements GuiDescriptio public boolean canUse(PlayerEntity entity) { return (blockInventory!=null) ? blockInventory.canPlayerUse(entity) : true; } + + @Override + public void close(PlayerEntity player) { + super.close(player); + if (blockInventory != null) blockInventory.onClose(player); + } //} @Override -- cgit