Changed //cyl and //hcyl to respect boundaries.

This commit is contained in:
sk89q
2010-10-17 17:39:20 -07:00
parent 3031480b38
commit 3ad6577be6
3 changed files with 88 additions and 2 deletions

View File

@ -887,6 +887,19 @@ public class EditSession {
int d = (5 - radius * 4) / 4;
int affected = 0;
if (height == 0) {
return 0;
} else if (height < 0) {
height = -height;
pos = pos.subtract(0, height, 0);
}
if (pos.getBlockY() - height - 1 < 0) {
height = pos.getBlockY() + 1;
} else if (pos.getBlockY() + height - 1 > 127) {
height = 127 - pos.getBlockY() + 1;
}
affected += makeHCylinderPoints(pos, x, z, height, block);
while (x < z) {
@ -961,6 +974,19 @@ public class EditSession {
int d = (5 - radius * 4) / 4;
int affected = 0;
if (height == 0) {
return 0;
} else if (height < 0) {
height = -height;
pos = pos.subtract(0, height, 0);
}
if (pos.getBlockY() - height - 1 < 0) {
height = pos.getBlockY() + 1;
} else if (pos.getBlockY() + height - 1 > 127) {
height = 127 - pos.getBlockY() + 1;
}
affected += makeCylinderPoints(pos, x, z, height, block);
while (x < z) {