From 842962530ac2c603ba63b2f703ddfb623c596dd6 Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Fri, 31 Jan 2014 14:42:45 -0600 Subject: [PATCH] Don't call duplicate interact air events. Fixes BUKKIT-5359 Previously we attempted to call interact events in cases that were missing by modifying the arm swing logic. This, however, was too broad and started triggering events in cases we already covered leading to duplicates. Since the only case we can handle cleanly and the primary point of the previous fix was fluids we now instead simply treat fluids as air for this check. This also ensures we do not get duplicate events when the player is in a fluid and hits a normal block, unlike the previous change. This reverts commit 68b702f7 and replaces it with a better fix. --- .../java/net/minecraft/server/PlayerConnection.java | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java index ee6b0a1ed6..3b378faf6e 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -962,19 +962,9 @@ public class PlayerConnection implements PacketPlayInListener { float f8 = f3 * f5; double d3 = 5.0D; Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); - MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, true); + MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, false); - boolean valid = false; if (movingobjectposition == null || movingobjectposition.type != EnumMovingObjectType.BLOCK) { - valid = true; - } else { - Block block = this.player.world.getType(movingobjectposition.b, movingobjectposition.c, movingobjectposition.d); - if (!block.c()) { // Should be isBreakable? - valid = true; - } - } - - if (valid) { CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.inventory.getItemInHand()); }