mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-02 10:57:11 +00:00
Refactored up-with-glass code into a helper function.
This commit is contained in:
parent
a1fa32153c
commit
90e1788781
@ -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.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user