Deprecated Block.getFace(Face) and Block.getFace(Face,int); use getRelative()
This commit is contained in:
parent
36d901c6b1
commit
9b0dbed88e
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user