Fix isSameBlock(Location), add convenience methods isBlockAbove.

This commit is contained in:
asofold 2013-02-15 15:46:19 +01:00
parent 1264cdb240
commit 29f5a153a5

View File

@ -218,7 +218,25 @@ public class PlayerLocation {
* @return
*/
public final boolean isSameBlock(final Location loc) {
return x == loc.getBlockX() && z == loc.getBlockZ() && y == loc.getBlockY();
return blockX == loc.getBlockX() && blockZ == loc.getBlockZ() && blockY == loc.getBlockY();
}
/**
* Check if this location is above the given one (blockY + 1).
* @param loc
* @return
*/
public boolean isBlockAbove(final PlayerLocation loc){
return blockY == loc.getBlockY() + 1 && blockX == loc.getBlockX() && blockZ == loc.getBlockZ();
}
/**
* Check if this location is above the given one (blockY + 1).
* @param loc
* @return
*/
public boolean isBlockAbove(final Location loc){
return blockY == loc.getBlockY() + 1 && blockX == loc.getBlockX() && blockZ == loc.getBlockZ();
}
/**