Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +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.
Dieser Commit ist enthalten in:
Ursprung
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());
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren