13
0
geforkt von Mirrors/Paper

Improve diff in ServerPlayer#openHorseInventory

Dieser Commit ist enthalten in:
Bjarne Koll 2024-12-19 21:48:24 +01:00
Ursprung 993db46961
Commit 68bbd2e202
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 9576DAF3FDDB088F

Datei anzeigen

@ -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()));