Added support for non-128 worldheights

This commit is contained in:
zml2008
2011-12-12 19:20:31 -08:00
committed by TomyLobo
parent e01aad00d8
commit 98216e2762
24 changed files with 190 additions and 102 deletions

View File

@ -168,7 +168,7 @@ public class EditSession {
public boolean rawSetBlock(Vector pt, BaseBlock block) {
final int y = pt.getBlockY();
final int type = block.getType();
if (y < 0 || y > 127) {
if (y < 0 || y > world.getMaxY()) {
return false;
}
@ -1046,7 +1046,7 @@ public class EditSession {
*/
public int removeAbove(Vector pos, int size, int height)
throws MaxChangedBlocksException {
int maxY = Math.min(127, pos.getBlockY() + height - 1);
int maxY = Math.min(world.getMaxY(), pos.getBlockY() + height - 1);
--size;
int affected = 0;
@ -1122,7 +1122,7 @@ public class EditSession {
int minX = pos.getBlockX() - size;
int maxX = pos.getBlockX() + size;
int minY = Math.max(0, pos.getBlockY() - size);
int maxY = Math.min(127, pos.getBlockY() + size);
int maxY = Math.min(world.getMaxY(), pos.getBlockY() + size);
int minZ = pos.getBlockZ() - size;
int maxZ = pos.getBlockZ() + size;
@ -1584,7 +1584,7 @@ public class EditSession {
Vector min = region.getMinimumPoint();
Vector max = region.getMaximumPoint();
int upperY = Math.min(127, max.getBlockY() + 1);
int upperY = Math.min(world.getMaxY(), max.getBlockY() + 1);
int lowerY = Math.max(0, min.getBlockY() - 1);
int affected = 0;
@ -1599,7 +1599,7 @@ public class EditSession {
for (int y = upperY; y >= lowerY; --y) {
Vector above = new Vector(x, y + 1, z);
if (y + 1 <= 127 && !getBlock(new Vector(x, y, z)).isAir()
if (y + 1 <= world.getMaxY() && !getBlock(new Vector(x, y, z)).isAir()
&& getBlock(above).isAir()) {
if (setBlock(above, block)) {
++affected;
@ -1626,7 +1626,7 @@ public class EditSession {
Vector min = region.getMinimumPoint();
Vector max = region.getMaximumPoint();
int upperY = Math.min(127, max.getBlockY() + 1);
int upperY = Math.min(world.getMaxY(), max.getBlockY() + 1);
int lowerY = Math.max(0, min.getBlockY() - 1);
int affected = 0;
@ -1641,7 +1641,7 @@ public class EditSession {
for (int y = upperY; y >= lowerY; --y) {
Vector above = new Vector(x, y + 1, z);
if (y + 1 <= 127 && !getBlock(new Vector(x, y, z)).isAir()
if (y + 1 <= world.getMaxY() && !getBlock(new Vector(x, y, z)).isAir()
&& getBlock(above).isAir()) {
if (setBlock(above, pattern.next(above))) {
++affected;
@ -1668,7 +1668,7 @@ public class EditSession {
Vector min = region.getMinimumPoint();
Vector max = region.getMaximumPoint();
int upperY = Math.min(127, max.getBlockY() + 1);
int upperY = Math.min(world.getMaxY(), max.getBlockY() + 1);
int lowerY = Math.max(0, min.getBlockY() - 1);
int affected = 0;
@ -2020,8 +2020,8 @@ public class EditSession {
if (pos.getBlockY() - height - 1 < 0) {
height = pos.getBlockY() + 1;
} else if (pos.getBlockY() + height - 1 > 127) {
height = 127 - pos.getBlockY() + 1;
} else if (pos.getBlockY() + height - 1 > world.getMaxY()) {
height = world.getMaxY() - pos.getBlockY() + 1;
}
final double invRadiusX = 1 / radiusX;
@ -2253,7 +2253,7 @@ public class EditSession {
continue;
}
for (int y = 127; y >= 1; --y) {
for (int y = world.getMaxY(); y >= 1; --y) {
Vector pt = new Vector(x, y, z);
int id = getBlockType(pt);
@ -2312,7 +2312,7 @@ public class EditSession {
continue;
}
for (int y = 127; y >= 1; --y) {
for (int y = world.getMaxY(); y >= 1; --y) {
Vector pt = new Vector(x, y, z);
int id = getBlockType(pt);
@ -2334,7 +2334,7 @@ public class EditSession {
}
// Too high?
if (y == 127) {
if (y == world.getMaxY()) {
break;
}
@ -2376,7 +2376,7 @@ public class EditSession {
continue;
}
loop: for (int y = 127; y >= 1; --y) {
loop: for (int y = world.getMaxY(); y >= 1; --y) {
final Vector pt = new Vector(x, y, z);
final int id = getBlockType(pt);