mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Fixed race change advancement criterion. Fixes #230
This commit is contained in:
parent
54381cf673
commit
5ac68a3df9
1 changed files with 20 additions and 16 deletions
|
@ -239,8 +239,7 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
||||||
|
|
||||||
gravity.updateFlightState();
|
gravity.updateFlightState();
|
||||||
entity.sendAbilitiesUpdate();
|
entity.sendAbilitiesUpdate();
|
||||||
|
recalculateCompositeRace();
|
||||||
UCriteria.PLAYER_CHANGE_RACE.trigger(entity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSuppressedRace(Race race) {
|
public void setSuppressedRace(Race race) {
|
||||||
|
@ -377,20 +376,7 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
||||||
@Override
|
@Override
|
||||||
public boolean beforeUpdate() {
|
public boolean beforeUpdate() {
|
||||||
if (compositeRace.includes(Race.UNSET) || entity.age % 2 == 0) {
|
if (compositeRace.includes(Race.UNSET) || entity.age % 2 == 0) {
|
||||||
Race intrinsicRace = getSpecies();
|
recalculateCompositeRace();
|
||||||
Race suppressedRace = getSuppressedRace();
|
|
||||||
compositeRace = getSpellSlot()
|
|
||||||
.get(SpellPredicate.IS_MIMIC, true)
|
|
||||||
.map(AbstractDisguiseSpell::getDisguise)
|
|
||||||
.map(EntityAppearance::getAppearance)
|
|
||||||
.flatMap(Pony::of)
|
|
||||||
.map(Pony::getSpecies)
|
|
||||||
.orElse(intrinsicRace).composite(
|
|
||||||
AmuletSelectors.UNICORN_AMULET.test(entity) ? Race.UNICORN
|
|
||||||
: AmuletSelectors.ALICORN_AMULET.test(entity) ? Race.ALICORN
|
|
||||||
: null,
|
|
||||||
AmuletSelectors.PEARL_NECKLACE.test(entity) ? suppressedRace.or(Race.SEAPONY) : null
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ticksInvulnerable > 0) {
|
if (ticksInvulnerable > 0) {
|
||||||
|
@ -482,6 +468,24 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
||||||
return super.beforeUpdate();
|
return super.beforeUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void recalculateCompositeRace() {
|
||||||
|
Race intrinsicRace = getSpecies();
|
||||||
|
Race suppressedRace = getSuppressedRace();
|
||||||
|
compositeRace = getSpellSlot()
|
||||||
|
.get(SpellPredicate.IS_MIMIC, true)
|
||||||
|
.map(AbstractDisguiseSpell::getDisguise)
|
||||||
|
.map(EntityAppearance::getAppearance)
|
||||||
|
.flatMap(Pony::of)
|
||||||
|
.map(Pony::getSpecies)
|
||||||
|
.orElse(intrinsicRace).composite(
|
||||||
|
AmuletSelectors.UNICORN_AMULET.test(entity) ? Race.UNICORN
|
||||||
|
: AmuletSelectors.ALICORN_AMULET.test(entity) ? Race.ALICORN
|
||||||
|
: null,
|
||||||
|
AmuletSelectors.PEARL_NECKLACE.test(entity) ? suppressedRace.or(Race.SEAPONY) : null
|
||||||
|
);
|
||||||
|
UCriteria.PLAYER_CHANGE_RACE.trigger(entity);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<BlockPos> chooseClimbingPos() {
|
public Optional<BlockPos> chooseClimbingPos() {
|
||||||
if (getObservedSpecies() == Race.CHANGELING && getSpellSlot().get(SpellPredicate.IS_DISGUISE, false).isEmpty()) {
|
if (getObservedSpecies() == Race.CHANGELING && getSpellSlot().get(SpellPredicate.IS_DISGUISE, false).isEmpty()) {
|
||||||
|
|
Loading…
Reference in a new issue