mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 19:49:35 +01:00
Use existing function to get opposite block face
By: Acrobot <andrzejp@dysleksja.pl>
This commit is contained in:
parent
7769f579c6
commit
1d034350f7
1 changed files with 3 additions and 28 deletions
|
@ -134,16 +134,16 @@ public class BlockIterator implements Iterator<Block> {
|
|||
|
||||
Block lastBlock;
|
||||
|
||||
lastBlock = startBlock.getRelative(reverseFace(mainFace));
|
||||
lastBlock = startBlock.getRelative(mainFace.getOppositeFace());
|
||||
|
||||
if (secondError < 0) {
|
||||
secondError += gridSize;
|
||||
lastBlock = lastBlock.getRelative(reverseFace(secondFace));
|
||||
lastBlock = lastBlock.getRelative(secondFace.getOppositeFace());
|
||||
}
|
||||
|
||||
if (thirdError < 0) {
|
||||
thirdError += gridSize;
|
||||
lastBlock = lastBlock.getRelative(reverseFace(thirdFace));
|
||||
lastBlock = lastBlock.getRelative(thirdFace.getOppositeFace());
|
||||
}
|
||||
|
||||
// This means that when the variables are positive, it means that the coord=1 boundary has been crossed
|
||||
|
@ -178,31 +178,6 @@ public class BlockIterator implements Iterator<Block> {
|
|||
return a.getX() == b.getX() && a.getY() == b.getY() && a.getZ() == b.getZ();
|
||||
}
|
||||
|
||||
private BlockFace reverseFace(BlockFace face) {
|
||||
switch (face) {
|
||||
case UP:
|
||||
return BlockFace.DOWN;
|
||||
|
||||
case DOWN:
|
||||
return BlockFace.UP;
|
||||
|
||||
case NORTH:
|
||||
return BlockFace.SOUTH;
|
||||
|
||||
case SOUTH:
|
||||
return BlockFace.NORTH;
|
||||
|
||||
case EAST:
|
||||
return BlockFace.WEST;
|
||||
|
||||
case WEST:
|
||||
return BlockFace.EAST;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private BlockFace getXFace(Vector direction) {
|
||||
return ((direction.getX() > 0) ? BlockFace.SOUTH : BlockFace.NORTH);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue