mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-17 22:47:34 +01:00
SPIGOT-2380: Hitting in the air will always load the chunk at 0,0
This commit is contained in:
parent
10c10b3124
commit
6d3efa0634
@ -191,7 +191,7 @@ public class CraftEventFactory {
|
|||||||
if (action != Action.LEFT_CLICK_AIR && action != Action.RIGHT_CLICK_AIR) {
|
if (action != Action.LEFT_CLICK_AIR && action != Action.RIGHT_CLICK_AIR) {
|
||||||
throw new AssertionError(String.format("%s performing %s with %s", who, action, itemstack));
|
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) {
|
public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, BlockPosition position, EnumDirection direction, ItemStack itemstack, EnumHand hand) {
|
||||||
@ -205,11 +205,10 @@ public class CraftEventFactory {
|
|||||||
CraftWorld craftWorld = (CraftWorld) player.getWorld();
|
CraftWorld craftWorld = (CraftWorld) player.getWorld();
|
||||||
CraftServer craftServer = (CraftServer) player.getServer();
|
CraftServer craftServer = (CraftServer) player.getServer();
|
||||||
|
|
||||||
Block blockClicked = craftWorld.getBlockAt(position.getX(), position.getY(), position.getZ());
|
Block blockClicked = null;
|
||||||
BlockFace blockFace = CraftBlock.notchToBlockFace(direction);
|
if (position != null) {
|
||||||
|
blockClicked = craftWorld.getBlockAt(position.getX(), position.getY(), position.getZ());
|
||||||
if (position.getY() > 255) {
|
} else {
|
||||||
blockClicked = null;
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case LEFT_CLICK_BLOCK:
|
case LEFT_CLICK_BLOCK:
|
||||||
action = Action.LEFT_CLICK_AIR;
|
action = Action.LEFT_CLICK_AIR;
|
||||||
@ -219,6 +218,7 @@ public class CraftEventFactory {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BlockFace blockFace = CraftBlock.notchToBlockFace(direction);
|
||||||
|
|
||||||
if (itemInHand.getType() == Material.AIR || itemInHand.getAmount() == 0) {
|
if (itemInHand.getType() == Material.AIR || itemInHand.getAmount() == 0) {
|
||||||
itemInHand = null;
|
itemInHand = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user