mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-04-27 00:49:44 +00:00
Add small optimization tweak to new safe block function.
This commit is contained in:
parent
fb71ebdfdf
commit
141a2bb190
1 changed files with 10 additions and 5 deletions
|
@ -296,14 +296,14 @@ public class Util
|
||||||
int x = loc.getBlockX();
|
int x = loc.getBlockX();
|
||||||
int y = (int)Math.round(loc.getY());
|
int y = (int)Math.round(loc.getY());
|
||||||
int z = loc.getBlockZ();
|
int z = loc.getBlockZ();
|
||||||
final int oy = y;
|
final int origY = y;
|
||||||
|
|
||||||
while (isBlockAboveAir(world, x, y, z))
|
while (isBlockAboveAir(world, x, y, z))
|
||||||
{
|
{
|
||||||
y -= 1;
|
y -= 1;
|
||||||
if (y < 0)
|
if (y < 0)
|
||||||
{
|
{
|
||||||
y = oy;
|
y = origY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -315,7 +315,7 @@ public class Util
|
||||||
{
|
{
|
||||||
x -= 3;
|
x -= 3;
|
||||||
z -= 3;
|
z -= 3;
|
||||||
y = oy + 4;
|
y = origY + 4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,10 +323,9 @@ public class Util
|
||||||
while (isBlockUnsafe(world, x, y, z))
|
while (isBlockUnsafe(world, x, y, z))
|
||||||
{
|
{
|
||||||
y -= 1;
|
y -= 1;
|
||||||
if (y + 4 < oy)
|
if (y + 4 < origY)
|
||||||
{
|
{
|
||||||
x += 1;
|
x += 1;
|
||||||
y = oy + 4;
|
|
||||||
if (x - 3 > loc.getBlockX())
|
if (x - 3 > loc.getBlockX())
|
||||||
{
|
{
|
||||||
x = loc.getBlockX() - 3;
|
x = loc.getBlockX() - 3;
|
||||||
|
@ -339,6 +338,12 @@ public class Util
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
y = origY + 4;
|
||||||
|
if (origY - 4 > world.getHighestBlockYAt(x, z))
|
||||||
|
{
|
||||||
|
y = origY - 4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue