summaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2016-06-11 09:21:44 +1000
committermd_5 <git@md-5.net>2016-06-11 09:25:31 +1000
commit6d3efa063495d5dc9d81cdc9e472f009ea6daa58 (patch)
tree7d00395aa07521cbd4a0ef6049438d8444a27708 /src/main/java/org
parent10c10b3124020862b6e912c63938a337dda693fe (diff)
downloadcraftbukkit-6d3efa063495d5dc9d81cdc9e472f009ea6daa58.tar
craftbukkit-6d3efa063495d5dc9d81cdc9e472f009ea6daa58.tar.gz
craftbukkit-6d3efa063495d5dc9d81cdc9e472f009ea6daa58.tar.lz
craftbukkit-6d3efa063495d5dc9d81cdc9e472f009ea6daa58.tar.xz
craftbukkit-6d3efa063495d5dc9d81cdc9e472f009ea6daa58.zip
SPIGOT-2380: Hitting in the air will always load the chunk at 0,0
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index cc488ccc..119e97d2 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -191,7 +191,7 @@ public class CraftEventFactory {
if (action != Action.LEFT_CLICK_AIR && action != Action.RIGHT_CLICK_AIR) {
throw new AssertionError(String.format("%s performing %s with %s", who, action, itemstack));
}
- return callPlayerInteractEvent(who, action, new BlockPosition(0, 256, 0), EnumDirection.SOUTH, itemstack, hand);
+ return callPlayerInteractEvent(who, action, null, EnumDirection.SOUTH, itemstack, hand);
}
public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, BlockPosition position, EnumDirection direction, ItemStack itemstack, EnumHand hand) {
@@ -205,20 +205,20 @@ public class CraftEventFactory {
CraftWorld craftWorld = (CraftWorld) player.getWorld();
CraftServer craftServer = (CraftServer) player.getServer();
- Block blockClicked = craftWorld.getBlockAt(position.getX(), position.getY(), position.getZ());
- BlockFace blockFace = CraftBlock.notchToBlockFace(direction);
-
- if (position.getY() > 255) {
- blockClicked = null;
+ Block blockClicked = null;
+ if (position != null) {
+ blockClicked = craftWorld.getBlockAt(position.getX(), position.getY(), position.getZ());
+ } else {
switch (action) {
- case LEFT_CLICK_BLOCK:
- action = Action.LEFT_CLICK_AIR;
- break;
- case RIGHT_CLICK_BLOCK:
- action = Action.RIGHT_CLICK_AIR;
- break;
+ case LEFT_CLICK_BLOCK:
+ action = Action.LEFT_CLICK_AIR;
+ break;
+ case RIGHT_CLICK_BLOCK:
+ action = Action.RIGHT_CLICK_AIR;
+ break;
}
}
+ BlockFace blockFace = CraftBlock.notchToBlockFace(direction);
if (itemInHand.getType() == Material.AIR || itemInHand.getAmount() == 0) {
itemInHand = null;