mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-30 16:28:00 +01:00
Fixed crash without trinkets
This commit is contained in:
parent
ba0fba791e
commit
23cf8bd702
1 changed files with 15 additions and 15 deletions
|
@ -94,8 +94,7 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
|||
|
||||
private final Interpolator interpolator = new LinearInterpolator();
|
||||
|
||||
@Nullable
|
||||
private Race.Composite compositeRace;
|
||||
private Race.Composite compositeRace = Race.UNSET.composite();
|
||||
private Race respawnRace = Race.UNSET;
|
||||
|
||||
private boolean dirty;
|
||||
|
@ -220,19 +219,6 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
|||
*/
|
||||
@Override
|
||||
public Race.Composite getCompositeRace() {
|
||||
if (compositeRace == null || entity.age % 2 == 0) {
|
||||
compositeRace = getSpellSlot()
|
||||
.get(SpellPredicate.IS_MIMIC, true)
|
||||
.map(AbstractDisguiseSpell::getDisguise)
|
||||
.map(EntityAppearance::getAppearance)
|
||||
.flatMap(Pony::of)
|
||||
.map(Pony::getSpecies)
|
||||
.orElseGet(this::getSpecies).composite(
|
||||
AmuletSelectors.UNICORN_AMULET.test(entity) ? Race.UNICORN
|
||||
: AmuletSelectors.ALICORN_AMULET.test(entity) ? Race.ALICORN
|
||||
: null
|
||||
);
|
||||
}
|
||||
return compositeRace;
|
||||
}
|
||||
|
||||
|
@ -352,6 +338,20 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
|||
|
||||
@Override
|
||||
public boolean beforeUpdate() {
|
||||
if (compositeRace.includes(Race.UNSET) || entity.age % 2 == 0) {
|
||||
compositeRace = getSpellSlot()
|
||||
.get(SpellPredicate.IS_MIMIC, true)
|
||||
.map(AbstractDisguiseSpell::getDisguise)
|
||||
.map(EntityAppearance::getAppearance)
|
||||
.flatMap(Pony::of)
|
||||
.map(Pony::getSpecies)
|
||||
.orElseGet(this::getSpecies).composite(
|
||||
AmuletSelectors.UNICORN_AMULET.test(entity) ? Race.UNICORN
|
||||
: AmuletSelectors.ALICORN_AMULET.test(entity) ? Race.ALICORN
|
||||
: null
|
||||
);
|
||||
}
|
||||
|
||||
if (isClient()) {
|
||||
if (entity.hasVehicle() && entity.isSneaking()) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue