summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTravis Watkins <amaranth@ubuntu.com>2013-12-12 01:56:49 -0600
committerTravis Watkins <amaranth@ubuntu.com>2013-12-12 02:01:22 -0600
commitf5fad449bd3b9c822318a0bc2e97c51147bb2c2b (patch)
treea37337c35e7cf35d9e40d1e2309395d9f37d12cf /src
parentca4c118994117955cc682c572c407f317a0a7530 (diff)
downloadcraftbukkit-f5fad449bd3b9c822318a0bc2e97c51147bb2c2b.tar
craftbukkit-f5fad449bd3b9c822318a0bc2e97c51147bb2c2b.tar.gz
craftbukkit-f5fad449bd3b9c822318a0bc2e97c51147bb2c2b.tar.lz
craftbukkit-f5fad449bd3b9c822318a0bc2e97c51147bb2c2b.tar.xz
craftbukkit-f5fad449bd3b9c822318a0bc2e97c51147bb2c2b.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/minecraft/server/PlayerConnection.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index da1a7e70..c1483013 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -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());
}