mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 14:33:56 +01:00
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.
This commit is contained in:
parent
9907271071
commit
842962530a
@ -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());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user