diff options
author | Erik Broes <erikbroes@grum.nl> | 2011-07-17 15:01:15 +0200 |
---|---|---|
committer | Erik Broes <erikbroes@grum.nl> | 2011-07-17 17:02:37 +0200 |
commit | 9b0dbed88ea31ef3e32f9ab9fa430896f0095930 (patch) | |
tree | 3ff63ec6919c6f04a97749f0332d8c7c7b43cbe3 /src/main | |
parent | 36d901c6b17f04df8eeb2edd35695aa124853ac0 (diff) | |
download | bukkit-9b0dbed88ea31ef3e32f9ab9fa430896f0095930.tar bukkit-9b0dbed88ea31ef3e32f9ab9fa430896f0095930.tar.gz bukkit-9b0dbed88ea31ef3e32f9ab9fa430896f0095930.tar.lz bukkit-9b0dbed88ea31ef3e32f9ab9fa430896f0095930.tar.xz bukkit-9b0dbed88ea31ef3e32f9ab9fa430896f0095930.zip |
Deprecated Block.getFace(Face) and Block.getFace(Face,int); use getRelative()
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/bukkit/block/Block.java | 51 | ||||
-rw-r--r-- | src/main/java/org/bukkit/util/BlockIterator.java | 26 |
2 files changed, 35 insertions, 42 deletions
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java index 05fb9ca8..a5c3bb0c 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java @@ -21,32 +21,14 @@ public interface Block { byte getData(); /** - * Gets the block at the given face<br /> - * <br /> - * This method is equal to getFace(face, 1) - * - * @param face Face of this block to return - * @return Block at the given face - * @see Block.getFace(BlockFace face, int distance); + * @deprecated use {@link #getRelative(BlockFace face)} */ - Block getFace(BlockFace face); + @Deprecated Block getFace(BlockFace face); /** - * Gets the block at the given distance of the given face<br /> - * <br /> - * For example, the following method places water at 100,102,100; two blocks - * above 100,100,100. - * <pre> - * Block block = world.getBlockAt(100,100,100); - * Block shower = block.getFace(BlockFace.Up, 2); - * shower.setType(Material.WATER); - * </pre> - * - * @param face Face of this block to return - * @param distance Distance to get the block at - * @return Block at the given face + * @deprecated use {@link #getRelative(BlockFace face, int distance)} */ - Block getFace(BlockFace face, int distance); + @Deprecated Block getFace(BlockFace face, int distance); /** * Gets the block at the given offsets @@ -59,19 +41,30 @@ public interface Block { Block getRelative(int modX, int modY, int modZ); /** - * Gets the block at the given offsets + * Gets the block at the given face<br /> + * <br /> + * This method is equal to getRelative(face, 1) * - * @param face face - * @return Block at the given offsets + * @param face Face of this block to return + * @return Block at the given face + * @see Block.getRelative(BlockFace face, int distance); */ Block getRelative(BlockFace face); /** - * Gets the block at the given offsets + * Gets the block at the given distance of the given face<br /> + * <br /> + * For example, the following method places water at 100,102,100; two blocks + * above 100,100,100. + * <pre> + * Block block = world.getBlockAt(100,100,100); + * Block shower = block.getFace(BlockFace.UP, 2); + * shower.setType(Material.WATER); + * </pre> * - * @param face face - * @param distance distance - * @return Block at the given offset and distance + * @param face Face of this block to return + * @param distance Distance to get the block at + * @return Block at the given face */ Block getRelative(BlockFace face, int distance); diff --git a/src/main/java/org/bukkit/util/BlockIterator.java b/src/main/java/org/bukkit/util/BlockIterator.java index 0a2fa5be..0427d889 100644 --- a/src/main/java/org/bukkit/util/BlockIterator.java +++ b/src/main/java/org/bukkit/util/BlockIterator.java @@ -135,16 +135,16 @@ public class BlockIterator implements Iterator<Block> { Block lastBlock; - lastBlock = startBlock.getFace(reverseFace(mainFace)); + lastBlock = startBlock.getRelative(reverseFace(mainFace)); if (secondError < 0) { secondError += gridSize; - lastBlock = lastBlock.getFace(reverseFace(secondFace)); + lastBlock = lastBlock.getRelative(reverseFace(secondFace)); } if (thirdError < 0) { thirdError += gridSize; - lastBlock = lastBlock.getFace(reverseFace(thirdFace)); + lastBlock = lastBlock.getRelative(reverseFace(thirdFace)); } // This means that when the variables are positive, it means that the coord=1 boundary has been crossed @@ -350,32 +350,32 @@ public class BlockIterator implements Iterator<Block> { thirdError += thirdStep; if (secondError > 0 && thirdError > 0) { - blockQueue[2] = blockQueue[0].getFace(mainFace); + blockQueue[2] = blockQueue[0].getRelative(mainFace); if (((long) secondStep) * ((long) thirdError) < ((long) thirdStep) * ((long) secondError)) { - blockQueue[1] = blockQueue[2].getFace(secondFace); - blockQueue[0] = blockQueue[1].getFace(thirdFace); + blockQueue[1] = blockQueue[2].getRelative(secondFace); + blockQueue[0] = blockQueue[1].getRelative(thirdFace); } else { - blockQueue[1] = blockQueue[2].getFace(thirdFace); - blockQueue[0] = blockQueue[1].getFace(secondFace); + blockQueue[1] = blockQueue[2].getRelative(thirdFace); + blockQueue[0] = blockQueue[1].getRelative(secondFace); } thirdError -= gridSize; secondError -= gridSize; currentBlock = 2; return; } else if (secondError > 0) { - blockQueue[1] = blockQueue[0].getFace(mainFace); - blockQueue[0] = blockQueue[1].getFace(secondFace); + blockQueue[1] = blockQueue[0].getRelative(mainFace); + blockQueue[0] = blockQueue[1].getRelative(secondFace); secondError -= gridSize; currentBlock = 1; return; } else if (thirdError > 0) { - blockQueue[1] = blockQueue[0].getFace(mainFace); - blockQueue[0] = blockQueue[1].getFace(thirdFace); + blockQueue[1] = blockQueue[0].getRelative(mainFace); + blockQueue[0] = blockQueue[1].getRelative(thirdFace); thirdError -= gridSize; currentBlock = 1; return; } else { - blockQueue[0] = blockQueue[0].getFace(mainFace); + blockQueue[0] = blockQueue[0].getRelative(mainFace); currentBlock = 0; return; } |