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;
|
Block lastBlock;
|
||||||
|
|
||||||
lastBlock = startBlock.getRelative(reverseFace(mainFace));
|
lastBlock = startBlock.getRelative(mainFace.getOppositeFace());
|
||||||
|
|
||||||
if (secondError < 0) {
|
if (secondError < 0) {
|
||||||
secondError += gridSize;
|
secondError += gridSize;
|
||||||
lastBlock = lastBlock.getRelative(reverseFace(secondFace));
|
lastBlock = lastBlock.getRelative(secondFace.getOppositeFace());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thirdError < 0) {
|
if (thirdError < 0) {
|
||||||
thirdError += gridSize;
|
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
|
// 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();
|
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) {
|
private BlockFace getXFace(Vector direction) {
|
||||||
return ((direction.getX() > 0) ? BlockFace.SOUTH : BlockFace.NORTH);
|
return ((direction.getX() > 0) ? BlockFace.SOUTH : BlockFace.NORTH);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue