Now /ascend and /descend won't land you in lava anymore. /unstuck made more accurate.

This commit is contained in:
sk89q 2010-10-16 17:15:17 -07:00
parent 3a940ba936
commit 383a475237

View File

@ -137,7 +137,7 @@ public abstract class WorldEditPlayer {
* that free position. * that free position.
*/ */
public void findFreePosition() { public void findFreePosition() {
Vector pos = getPosition(); Vector pos = getBlockIn();
int x = pos.getBlockX(); int x = pos.getBlockX();
int y = pos.getBlockY(); int y = pos.getBlockY();
int origY = y; int origY = y;
@ -187,6 +187,13 @@ public abstract class WorldEditPlayer {
if (free == 2) { if (free == 2) {
spots++; spots++;
if (spots == 2) { if (spots == 2) {
int type = server.getBlockType(new Vector(x, y - 2, z));
// Don't get put in lava!
if (type == 10 || type == 11) {
return false;
}
setPosition(new Vector(x + 0.5, y - 1, z + 0.5)); setPosition(new Vector(x + 0.5, y - 1, z + 0.5));
return true; return true;
} }
@ -223,7 +230,10 @@ public abstract class WorldEditPlayer {
// lightly and also check to see if there's something to // lightly and also check to see if there's something to
// stand upon // stand upon
while (y >= 0) { while (y >= 0) {
if (server.getBlockType(new Vector(x, y, z)) != 0) { int type = server.getBlockType(new Vector(x, y, z));
// Don't want to end up in lava
if (type != 0 && type != 10 && type != 11) {
// Found a block! // Found a block!
setPosition(new Vector(x + 0.5, y + 1, z + 0.5)); setPosition(new Vector(x + 0.5, y + 1, z + 0.5));
return true; return true;