Skip to content

Commit

Permalink
Refactor code to improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinDaGame committed Apr 12, 2024
1 parent ce5f286 commit a4dbd22
Showing 1 changed file with 25 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,36 +34,38 @@ private void fillDown(final SnipeData v, final IBlock b) {
final double currentXSquared = Math.pow(x, 2);

for (int z = -brushSize; z <= brushSize; z++) {
if (currentXSquared + Math.pow(z, 2) <= brushSizeSquared) {
int y = 0;
boolean found = false;
if (this.fromExisting) {
for (y = -v.getVoxelHeight(); y < v.getVoxelHeight(); y++) {
final IBlock currentBlock = this.getWorld().getBlock(
targetBlock.getX() + x,
targetBlock.getY() + y,
targetBlock.getZ() + z);
if (!currentBlock.isEmpty()) {
found = true;
break;
}
}
if (!found) {
continue;
}
y--;
}
for (; y >= -targetBlock.getY(); --y) {
if (currentXSquared + Math.pow(z, 2) > brushSizeSquared) {
continue;
}

int y = 0;
boolean found = false;
if (this.fromExisting) {
for (y = -v.getVoxelHeight(); y < v.getVoxelHeight(); y++) {
final IBlock currentBlock = this.getWorld().getBlock(
targetBlock.getX() + x,
targetBlock.getY() + y,
targetBlock.getZ() + z);
if (currentBlock.isEmpty() || (fillLiquid && currentBlock.isLiquid())) {
this.positions.add(currentBlock.getLocation());
} else {
if (!currentBlock.isEmpty()) {
found = true;
break;
}
}
if (!found) {
continue;
}
y--;
}
for (; y >= getWorld().getMinWorldHeight(); --y) {
final IBlock currentBlock = this.getWorld().getBlock(
targetBlock.getX() + x,
targetBlock.getY() + y,
targetBlock.getZ() + z);
if (currentBlock.isEmpty() || (fillLiquid && currentBlock.isLiquid())) {
this.positions.add(currentBlock.getLocation());
} else {
break;
}
}
}
}
Expand Down

0 comments on commit a4dbd22

Please sign in to comment.