Fixed alicorn amulet flight not working

This commit is contained in:
Sollace 2023-10-07 23:44:30 +01:00
parent f0270be985
commit 222e208141
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
3 changed files with 9 additions and 1 deletions

View file

@ -42,6 +42,10 @@ public enum FlightType {
return this == INSECTOID ? 0.66F : 1; return this == INSECTOID ? 0.66F : 1;
} }
public FlightType or(FlightType other) {
return ordinal() > other.ordinal() ? this : other;
}
/** /**
* Predicate for abilities to control whether a player can fly. * Predicate for abilities to control whether a player can fly.
* *

View file

@ -220,6 +220,10 @@ public record Race (Supplier<Composite> compositeSupplier, boolean canCast, Flig
public boolean canCast() { public boolean canCast() {
return any(Race::canCast); return any(Race::canCast);
} }
public FlightType flightType() {
return physical().flightType().or(pseudo().flightType());
}
} }
} }

View file

@ -197,7 +197,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
.filter(effect -> !effect.isDead() && effect instanceof FlightType.Provider) .filter(effect -> !effect.isDead() && effect instanceof FlightType.Provider)
.map(effect -> ((FlightType.Provider)effect).getFlightType()) .map(effect -> ((FlightType.Provider)effect).getFlightType())
.filter(FlightType::isPresent) .filter(FlightType::isPresent)
.orElse(pony.getObservedSpecies().flightType()); .orElse(pony.getCompositeRace().flightType());
} }
public void cancelFlight(boolean force) { public void cancelFlight(boolean force) {