2014-03-23 00:06:43 +00:00
|
|
|
From ef95f91c929c37c03bc09d142936b802d471e007 Mon Sep 17 00:00:00 2001
|
2014-01-08 03:44:50 +00:00
|
|
|
From: bloodshot <jdroque@gmail.com>
|
|
|
|
Date: Mon, 6 Jan 2014 16:29:51 -0500
|
|
|
|
Subject: [PATCH] Update Chest Animation when Cancelling Event
|
|
|
|
|
|
|
|
Update chest animation after cancelling InventoryOpenEvent. Fixes BUKKIT-1440
|
|
|
|
|
|
|
|
Currently if a plugin cancels an InventoryOpenEvent for vanilla chests,
|
|
|
|
the chest animation for clients is stuck in the open state since
|
|
|
|
IInventory's closeChest method is never called. To fix the issue, closeChest
|
|
|
|
is called before exiting the display GUI method.
|
|
|
|
More info can be found here
|
|
|
|
https://bukkit.atlassian.net/browse/BUKKIT-1440
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
2014-03-23 00:06:43 +00:00
|
|
|
index e8756ed..b8c3540 100644
|
2014-01-08 03:44:50 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
2014-03-23 00:06:43 +00:00
|
|
|
@@ -622,7 +622,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2014-01-08 03:44:50 +00:00
|
|
|
|
|
|
|
// CraftBukkit start - Inventory open hook
|
|
|
|
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerChest(this.inventory, iinventory));
|
|
|
|
- if(container == null) return;
|
|
|
|
+ if(container == null) {
|
|
|
|
+ iinventory.l_();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
this.nextContainerCounter();
|
2014-03-23 00:06:43 +00:00
|
|
|
@@ -635,7 +638,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2014-01-08 03:44:50 +00:00
|
|
|
public void openHopper(TileEntityHopper tileentityhopper) {
|
|
|
|
// CraftBukkit start - Inventory open hook
|
|
|
|
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, tileentityhopper));
|
|
|
|
- if(container == null) return;
|
|
|
|
+ if(container == null) {
|
|
|
|
+ tileentityhopper.l_();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
this.nextContainerCounter();
|
2014-03-23 00:06:43 +00:00
|
|
|
@@ -648,7 +654,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2014-01-08 03:44:50 +00:00
|
|
|
public void openMinecartHopper(EntityMinecartHopper entityminecarthopper) {
|
|
|
|
// CraftBukkit start - Inventory open hook
|
|
|
|
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, entityminecarthopper));
|
|
|
|
- if(container == null) return;
|
|
|
|
+ if(container == null) {
|
|
|
|
+ entityminecarthopper.l_();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
this.nextContainerCounter();
|
2014-03-23 00:06:43 +00:00
|
|
|
@@ -661,7 +670,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2014-01-08 03:44:50 +00:00
|
|
|
public void openFurnace(TileEntityFurnace tileentityfurnace) {
|
|
|
|
// CraftBukkit start - Inventory open hook
|
|
|
|
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerFurnace(this.inventory, tileentityfurnace));
|
|
|
|
- if(container == null) return;
|
|
|
|
+ if(container == null) {
|
|
|
|
+ tileentityfurnace.l_();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
this.nextContainerCounter();
|
2014-03-23 00:06:43 +00:00
|
|
|
@@ -674,7 +686,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2014-01-08 03:44:50 +00:00
|
|
|
public void openDispenser(TileEntityDispenser tileentitydispenser) {
|
|
|
|
// CraftBukkit start - Inventory open hook
|
|
|
|
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerDispenser(this.inventory, tileentitydispenser));
|
|
|
|
- if(container == null) return;
|
|
|
|
+ if(container == null) {
|
|
|
|
+ tileentitydispenser.l_();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
this.nextContainerCounter();
|
2014-03-23 00:06:43 +00:00
|
|
|
@@ -687,7 +702,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2014-01-08 03:44:50 +00:00
|
|
|
public void openBrewingStand(TileEntityBrewingStand tileentitybrewingstand) {
|
|
|
|
// CraftBukkit start - Inventory open hook
|
|
|
|
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBrewingStand(this.inventory, tileentitybrewingstand));
|
|
|
|
- if(container == null) return;
|
|
|
|
+ if(container == null) {
|
|
|
|
+ tileentitybrewingstand.l_();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
this.nextContainerCounter();
|
2014-03-23 00:06:43 +00:00
|
|
|
@@ -700,7 +718,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2014-01-08 03:44:50 +00:00
|
|
|
public void openBeacon(TileEntityBeacon tileentitybeacon) {
|
|
|
|
// CraftBukkit start - Inventory open hook
|
|
|
|
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBeacon(this.inventory, tileentitybeacon));
|
|
|
|
- if(container == null) return;
|
|
|
|
+ if(container == null) {
|
|
|
|
+ tileentitybeacon.l_();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
this.nextContainerCounter();
|
2014-03-23 00:06:43 +00:00
|
|
|
@@ -743,7 +764,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2014-01-08 03:44:50 +00:00
|
|
|
public void openHorseInventory(EntityHorse entityhorse, IInventory iinventory) {
|
|
|
|
// CraftBukkit start - Inventory open hook
|
|
|
|
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHorse(this.inventory, iinventory, entityhorse));
|
|
|
|
- if(container == null) return;
|
|
|
|
+ if(container == null) {
|
|
|
|
+ iinventory.l_();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
if (this.activeContainer != this.defaultContainer) {
|
|
|
|
--
|
2014-03-23 00:06:43 +00:00
|
|
|
1.8.5.2.msysgit.0
|
2014-01-08 03:44:50 +00:00
|
|
|
|