Refactored up-with-glass code into a helper function.

Dieser Commit ist enthalten in:
TomyLobo 2013-10-23 19:02:47 +02:00
Ursprung a1fa32153c
Commit 90e1788781

Datei anzeigen

@ -252,8 +252,7 @@ public abstract class LocalPlayer {
// Found a ceiling!
if (!BlockType.canPassThrough(world.getBlock(new Vector(x, y, z)))) {
int platformY = Math.max(initialY, y - 3 - clearance);
world.setBlockType(new Vector(x, platformY, z), BlockID.GLASS);
setPosition(new Vector(x + 0.5, platformY + 1, z + 0.5));
floatAt(x, platformY + 1, z);
return true;
}
@ -284,8 +283,7 @@ public abstract class LocalPlayer {
} else if (y > maxY + 1) {
break;
} else if (y == maxY + 1) {
world.setBlockType(new Vector(x, y - 2, z), BlockID.GLASS);
setPosition(new Vector(x + 0.5, y - 1, z + 0.5));
floatAt(x, y - 1, z);
return true;
}
@ -295,6 +293,18 @@ public abstract class LocalPlayer {
return false;
}
/**
* Make the player float in the given blocks.
*
* @param x The X coordinate of the block to float in
* @param y The Y coordinate of the block to float in
* @param z The Z coordinate of the block to float in
*/
private void floatAt(int x, int y, int z) {
getPosition().getWorld().setBlockType(new Vector(x, y - 1, z), BlockID.GLASS);
setPosition(new Vector(x + 0.5, y, z + 0.5));
}
/**
* Get the point of the block that is being stood in.
*