Fixed some mechanics not taking spectator mode into account

This commit is contained in:
Sollace 2020-05-29 20:35:31 +02:00
parent b4443e0549
commit fab5363028
2 changed files with 10 additions and 4 deletions

View file

@ -25,6 +25,10 @@ public class UHud extends DrawableHelper {
public void render(InGameHud hud, float tickDelta) { public void render(InGameHud hud, float tickDelta) {
if (client.player == null || client.player.isSpectator()) {
return;
}
int scaledWidth = client.getWindow().getScaledWidth(); int scaledWidth = client.getWindow().getScaledWidth();
int scaledHeight = client.getWindow().getScaledHeight(); int scaledHeight = client.getWindow().getScaledHeight();

View file

@ -52,7 +52,7 @@ public class PlayerPhysics extends EntityPhysics<Pony> implements Tickable, Moti
} }
private boolean checkCanFly() { private boolean checkCanFly() {
if (pony.getOwner().abilities.creativeMode) { if (pony.getOwner().abilities.creativeMode || pony.getOwner().isSpectator()) {
return true; return true;
} }
@ -100,15 +100,17 @@ public class PlayerPhysics extends EntityPhysics<Pony> implements Tickable, Moti
} }
} }
boolean creative = entity.abilities.creativeMode || pony.getOwner().isSpectator();
entity.abilities.allowFlying = checkCanFly(); entity.abilities.allowFlying = checkCanFly();
if (!entity.abilities.creativeMode) { if (!creative) {
entity.abilities.flying |= entity.abilities.allowFlying && isFlying && !entity.onGround && !entity.isTouchingWater(); entity.abilities.flying |= entity.abilities.allowFlying && isFlying && !entity.onGround && !entity.isTouchingWater();
} }
isFlying = entity.abilities.flying && !entity.abilities.creativeMode; isFlying = entity.abilities.flying && !creative;
if (!entity.abilities.creativeMode && !entity.isFallFlying()) { if (!creative && !entity.isFallFlying()) {
if (isFlying && !entity.hasVehicle()) { if (isFlying && !entity.hasVehicle()) {
if (!isRainbooming && getHorizontalMotion(entity) > 0.2 && flightExperience < MAXIMUM_FLIGHT_EXPERIENCE) { if (!isRainbooming && getHorizontalMotion(entity) > 0.2 && flightExperience < MAXIMUM_FLIGHT_EXPERIENCE) {