summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/Util.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Util.java b/Essentials/src/com/earth2me/essentials/Util.java
index 643a66729..c17e196fa 100644
--- a/Essentials/src/com/earth2me/essentials/Util.java
+++ b/Essentials/src/com/earth2me/essentials/Util.java
@@ -296,14 +296,14 @@ public class Util
int x = loc.getBlockX();
int y = (int)Math.round(loc.getY());
int z = loc.getBlockZ();
- final int oy = y;
+ final int origY = y;
while (isBlockAboveAir(world, x, y, z))
{
y -= 1;
if (y < 0)
{
- y = oy;
+ y = origY;
break;
}
}
@@ -315,7 +315,7 @@ public class Util
{
x -= 3;
z -= 3;
- y = oy + 4;
+ y = origY + 4;
break;
}
}
@@ -323,10 +323,9 @@ public class Util
while (isBlockUnsafe(world, x, y, z))
{
y -= 1;
- if (y + 4 < oy)
+ if (y + 4 < origY)
{
x += 1;
- y = oy + 4;
if (x - 3 > loc.getBlockX())
{
x = loc.getBlockX() - 3;
@@ -339,6 +338,12 @@ public class Util
break;
}
}
+
+ y = origY + 4;
+ if (origY - 4 > world.getHighestBlockYAt(x, z))
+ {
+ y = origY - 4;
+ }
}
}