Add convenience methods for block coordinate comparison.

This commit is contained in:
asofold 2012-11-25 23:24:06 +01:00
parent 484c61e9aa
commit d5136dc788

View File

@ -189,6 +189,26 @@ public class PlayerLocation {
return blockX == other.getBlockX() && blockZ == other.getBlockZ() && blockY == other.getBlockY();
}
/**
* Block coordinate comparison.
* @param x
* @param y
* @param z
* @return
*/
public final boolean isSameBlock(final int x, final int y, final int z) {
return blockX == x && blockZ == z && blockY == y;
}
/**
* Compares block coordinates (not the world).
* @param loc
* @return
*/
public final boolean isSameBlock(final Location loc) {
return x == loc.getBlockX() && z == loc.getBlockZ() && y == loc.getBlockY();
}
/**
* Compares exact coordinates (not the world).
*