diff options
author | Erik Broes <erikbroes@grum.nl> | 2011-03-23 18:29:43 +0100 |
---|---|---|
committer | Erik Broes <erikbroes@grum.nl> | 2011-03-23 18:29:43 +0100 |
commit | d08ee17352868dc52d58403b8ae97cd05d5e0723 (patch) | |
tree | cdc087dde7ecd44208b51a8ed9cc13191f3ee8b3 /src/main/java/net/minecraft/server/ItemInWorldManager.java | |
parent | ca1c9ef2e1af3738ef93d712cd4d10e65a7212ac (diff) | |
download | craftbukkit-d08ee17352868dc52d58403b8ae97cd05d5e0723.tar craftbukkit-d08ee17352868dc52d58403b8ae97cd05d5e0723.tar.gz craftbukkit-d08ee17352868dc52d58403b8ae97cd05d5e0723.tar.lz craftbukkit-d08ee17352868dc52d58403b8ae97cd05d5e0723.tar.xz craftbukkit-d08ee17352868dc52d58403b8ae97cd05d5e0723.zip |
Fix doors not updating after opening has been denied
Diffstat (limited to 'src/main/java/net/minecraft/server/ItemInWorldManager.java')
-rw-r--r-- | src/main/java/net/minecraft/server/ItemInWorldManager.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/ItemInWorldManager.java b/src/main/java/net/minecraft/server/ItemInWorldManager.java index 52acfd3a..d21130f8 100644 --- a/src/main/java/net/minecraft/server/ItemInWorldManager.java +++ b/src/main/java/net/minecraft/server/ItemInWorldManager.java @@ -64,7 +64,15 @@ public class ItemInWorldManager { PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.a, Action.LEFT_CLICK_BLOCK , i, j, k, -1, this.a.inventory.b()); - if (event.useInteractedBlock() != Event.Result.DENY) { + if (event.useInteractedBlock() == Event.Result.DENY) { + // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door. + if (l == Block.WOODEN_DOOR.id) { + // For some reason *BOTH* the bottom/top part have to be marked updated. + boolean bottom = (this.b.getData(i, j, k) & 8) == 0; + ((EntityPlayer) this.a).a.b((Packet) (new Packet53BlockChange(i, j, k, this.b)));
+ ((EntityPlayer) this.a).a.b((Packet) (new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, this.b))); + } + } else { Block.byId[l].b(this.b, i, j, k, this.a); } @@ -187,7 +195,13 @@ public class ItemInWorldManager { boolean result = false; if (i1 > 0) { PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, i, j, k, l, itemstack); - if (event.useInteractedBlock() != Event.Result.DENY) { + if (event.useInteractedBlock() == Event.Result.DENY) {
+ // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door. + if (i1 == Block.WOODEN_DOOR.id) { + boolean bottom = (world.getData(i, j, k) & 8) == 0; + ((EntityPlayer) entityhuman).a.b((Packet) (new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, world)));
+ } + } else { result = Block.byId[i1].a(world, i, j, k, entityhuman); } if (itemstack != null && event.useItemInHand() != Event.Result.DENY && (!result || event.useItemInHand() == Event.Result.ALLOW)) { |