Skip to content

Commit

Permalink
If a trace hits the world limit, cancel it (#1942)
Browse files Browse the repository at this point in the history
  • Loading branch information
octylFractal committed Nov 21, 2021
1 parent c407471 commit 29f1c66
Showing 1 changed file with 4 additions and 7 deletions.
Expand Up @@ -143,18 +143,15 @@ private void setValues(Vector3 loc, double rotationX, double rotationY, int maxD
* @return Block
*/
public Location getAnyTargetBlock() {
boolean searchForLastBlock = true;
Location lastBlock = null;
while (getNextBlock() != null) {
if (stopMask.test(targetPos)) {
break;
} else {
if (searchForLastBlock) {
lastBlock = getCurrentBlock();
if (lastBlock.getBlockY() <= world.getMinY()
|| lastBlock.getBlockY() >= world.getMaxY()) {
searchForLastBlock = false;
}
lastBlock = getCurrentBlock();
if (lastBlock.getBlockY() < world.getMinY()
|| lastBlock.getBlockY() > world.getMaxY()) {
return null;
}
}
}
Expand Down

0 comments on commit 29f1c66

Please sign in to comment.