diff --git a/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch b/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch index eae0ca32da..ce890ce4a0 100644 --- a/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch @@ -966,12 +966,8 @@ @Override public void openHorseInventory(AbstractHorse horse, Container inventory) { -- if (this.containerMenu != this.inventoryMenu) { -- this.closeContainer(); -- } -- + // CraftBukkit start - Inventory open hook - this.nextContainerCounter(); ++ this.nextContainerCounter(); // Moved up from below + AbstractContainerMenu container = new HorseInventoryMenu(this.containerCounter, this.getInventory(), inventory, horse, horse.getInventoryColumns()); + container.setTitle(horse.getDisplayName()); + container = org.bukkit.craftbukkit.event.CraftEventFactory.callInventoryOpenEvent(this, container); @@ -981,10 +977,12 @@ + return; + } + // CraftBukkit end -+ if (this.containerMenu != this.inventoryMenu) { + if (this.containerMenu != this.inventoryMenu) { +- this.closeContainer(); + this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.OPEN_NEW); // Paper - Inventory close reason -+ } -+ + } + +- this.nextContainerCounter(); + // this.nextContainerCounter(); // CraftBukkit - moved up int inventoryColumns = horse.getInventoryColumns(); this.connection.send(new ClientboundHorseScreenOpenPacket(this.containerCounter, inventoryColumns, horse.getId()));