From 74ead3abd17c4dfb0987a143483b2ca68ce1553f Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Tue, 17 Jan 2012 15:52:02 -0600 Subject: [PATCH] Immediately tell client a block is broken, then process the event. In order to avoid clients seeing blocks break, reappear, then break again due to lag caused by plugins taking too long to process the BlockBreakEvent we immediately tell the client the block is air then process the event. If the event ends up being cancelled the client will get another packet telling them the block still exists. --- .../java/net/minecraft/server/ItemInWorldManager.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/net/minecraft/server/ItemInWorldManager.java b/src/main/java/net/minecraft/server/ItemInWorldManager.java index 663489fc0e..322d58fd9f 100644 --- a/src/main/java/net/minecraft/server/ItemInWorldManager.java +++ b/src/main/java/net/minecraft/server/ItemInWorldManager.java @@ -203,6 +203,16 @@ public class ItemInWorldManager { if (this.player instanceof EntityPlayer) { org.bukkit.block.Block block = this.world.getWorld().getBlockAt(i, j, k); + // Tell client the block is gone immediately then process events + if (world.getTileEntity(i, j, k) == null) { + int id = block.getTypeId(); + byte data = block.getData(); + + block.setTypeId(0, false); + ((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world)); + block.setTypeIdAndData(id, data, false); + } + BlockBreakEvent event = new BlockBreakEvent(block, (org.bukkit.entity.Player) this.player.getBukkitEntity()); this.world.getServer().getPluginManager().callEvent(event);