From 69d5132df4ffeb59ac4fa182e7b267092fc76546 Mon Sep 17 00:00:00 2001 From: Erik Broes Date: Thu, 24 Mar 2011 22:42:23 +0100 Subject: [PATCH] Reset blocks faster clientside --- .../java/net/minecraft/server/ItemInWorldManager.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/net/minecraft/server/ItemInWorldManager.java b/src/main/java/net/minecraft/server/ItemInWorldManager.java index 1c2dc575c4..7cd5f3a127 100644 --- a/src/main/java/net/minecraft/server/ItemInWorldManager.java +++ b/src/main/java/net/minecraft/server/ItemInWorldManager.java @@ -78,6 +78,13 @@ public class ItemInWorldManager { // Handle hitting a block float toolDamage = Block.byId[l].a(this.a); + if (event.useItemInHand() == Event.Result.DENY) { + // If we 'insta destroyed' then the client needs to be informed. + if (toolDamage > 1.0f) { + ((EntityPlayer) this.a).a.b((Packet) (new Packet53BlockChange(i, j, k, this.b))); + } + return; + } BlockDamageEvent blockEvent = CraftEventFactory.callBlockDamageEvent(this.a, i, j, k, this.a.inventory.b(), toolDamage >= 1.0f); if (blockEvent.isCancelled()) { @@ -117,6 +124,10 @@ public class ItemInWorldManager { this.o = this.d; } } + // CraftBukkit start -- force blockreset to client + } else { + ((EntityPlayer) this.a).a.b((Packet) (new Packet53BlockChange(i, j, k, this.b))); + // CraftBukkit end } this.c = 0.0F;