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.
Dieser Commit ist enthalten in:
Travis Watkins 2014-01-31 14:42:45 -06:00
Ursprung 9907271071
Commit 842962530a

Datei anzeigen

@ -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());
}