mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 15:00:13 +01:00
Improve diff in ServerPlayer#openHorseInventory
This commit is contained in:
parent
993db46961
commit
68bbd2e202
1 changed files with 6 additions and 8 deletions
|
@ -966,12 +966,8 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openHorseInventory(AbstractHorse horse, Container inventory) {
|
public void openHorseInventory(AbstractHorse horse, Container inventory) {
|
||||||
- if (this.containerMenu != this.inventoryMenu) {
|
|
||||||
- this.closeContainer();
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
+ // CraftBukkit start - Inventory open hook
|
+ // 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());
|
+ AbstractContainerMenu container = new HorseInventoryMenu(this.containerCounter, this.getInventory(), inventory, horse, horse.getInventoryColumns());
|
||||||
+ container.setTitle(horse.getDisplayName());
|
+ container.setTitle(horse.getDisplayName());
|
||||||
+ container = org.bukkit.craftbukkit.event.CraftEventFactory.callInventoryOpenEvent(this, container);
|
+ container = org.bukkit.craftbukkit.event.CraftEventFactory.callInventoryOpenEvent(this, container);
|
||||||
|
@ -981,10 +977,12 @@
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // 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.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.OPEN_NEW); // Paper - Inventory close reason
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
|
- this.nextContainerCounter();
|
||||||
+ // this.nextContainerCounter(); // CraftBukkit - moved up
|
+ // this.nextContainerCounter(); // CraftBukkit - moved up
|
||||||
int inventoryColumns = horse.getInventoryColumns();
|
int inventoryColumns = horse.getInventoryColumns();
|
||||||
this.connection.send(new ClientboundHorseScreenOpenPacket(this.containerCounter, inventoryColumns, horse.getId()));
|
this.connection.send(new ClientboundHorseScreenOpenPacket(this.containerCounter, inventoryColumns, horse.getId()));
|
||||||
|
|
Loading…
Reference in a new issue