Move floatAt logic to AbstractPlayer, add isAllowedToFly and setFlying.

This commit is contained in:
wizjany
2019-07-11 20:27:05 -04:00
parent 8545417b3a
commit 2cc6a367c6
6 changed files with 54 additions and 36 deletions

View File

@ -204,14 +204,13 @@ public class SpongePlayer extends AbstractPlayerActor {
}
@Override
public void floatAt(int x, int y, int z, boolean alwaysGlass) {
if (alwaysGlass || !player.get(Keys.CAN_FLY).orElse(false)) {
super.floatAt(x, y, z, alwaysGlass);
return;
}
public boolean isAllowedToFly() {
return player.get(Keys.CAN_FLY).orElse(super.isAllowedToFly());
}
setPosition(Vector3.at(x + 0.5, y, z + 0.5));
player.offer(Keys.IS_FLYING, true);
@Override
public void setFlying(boolean flying) {
player.offer(Keys.IS_FLYING, flying);
}
@Override