mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-09 04:09:54 +01:00
Call interact event if block cannot be punched. Fixes BUKKIT-5126
We do ray tracing on arm swings to filter out swings that hit blocks since punching blocks has its own event handling. However, some blocks cannot be punched so the air interact type is still valid for them. Luckily these blocks all have a means to query them so add an additional check for this and don't fail the check for them.
This commit is contained in:
parent
ca4c118994
commit
f5fad449bd
@ -962,7 +962,17 @@ public class PlayerConnection implements PacketPlayInListener {
|
||||
Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
|
||||
MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, true);
|
||||
|
||||
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