From 68bbd2e202431b0f6ad968bd309e6522e87b8c2f Mon Sep 17 00:00:00 2001 From: Bjarne Koll Date: Thu, 19 Dec 2024 21:48:24 +0100 Subject: [PATCH] Improve diff in ServerPlayer#openHorseInventory --- .../minecraft/server/level/ServerPlayer.java.patch | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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()));