From 5fff677f79b287881388569dbec5ddbbc8d04772 Mon Sep 17 00:00:00 2001 From: Sollace Date: Fri, 30 Sep 2022 10:21:18 +0200 Subject: [PATCH] Prep for a future feature --- .../unicopia/advancement/CustomEventCriterion.java | 2 +- .../unicopia/advancement/RaceChangeCriterion.java | 2 +- .../unicopia/client/gui/DismissSpellScreen.java | 2 +- .../gui/spellbook/SpellbookProfilePageContent.java | 2 +- .../unicopia/command/SpeciesCommand.java | 2 +- .../entity/effect/RaceChangeStatusEffect.java | 2 +- .../unicopia/entity/player/Pony.java | 14 +++++++------- .../unicopia/network/MsgPlayerCapabilities.java | 2 +- .../unicopia/network/MsgRequestSpeciesChange.java | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/advancement/CustomEventCriterion.java b/src/main/java/com/minelittlepony/unicopia/advancement/CustomEventCriterion.java index ff195f0f..3ae2437c 100644 --- a/src/main/java/com/minelittlepony/unicopia/advancement/CustomEventCriterion.java +++ b/src/main/java/com/minelittlepony/unicopia/advancement/CustomEventCriterion.java @@ -83,7 +83,7 @@ public class CustomEventCriterion extends AbstractCriterion 0 && count % repeatCount == 0)); } diff --git a/src/main/java/com/minelittlepony/unicopia/advancement/RaceChangeCriterion.java b/src/main/java/com/minelittlepony/unicopia/advancement/RaceChangeCriterion.java index f3455959..3852453f 100644 --- a/src/main/java/com/minelittlepony/unicopia/advancement/RaceChangeCriterion.java +++ b/src/main/java/com/minelittlepony/unicopia/advancement/RaceChangeCriterion.java @@ -44,7 +44,7 @@ public class RaceChangeCriterion extends AbstractCriterion implements Transmittable, Copieab @Override public Race getSpecies() { - if (getMaster() == null) { - return Race.HUMAN; - } + return getActualSpecies(); + } - return Race.fromName(getMaster().getDataTracker().get(RACE), Race.HUMAN); + public Race getActualSpecies() { + return Race.fromName(entity.getDataTracker().get(RACE), Race.HUMAN); } @Override @@ -285,7 +285,7 @@ public class Pony extends Living implements Transmittable, Copieab if (race != clientPreferredRace) { clientPreferredRace = race; - if (race != getSpecies()) { + if (race != getActualSpecies()) { Channel.CLIENT_REQUEST_SPECIES_CHANGE.send(new MsgRequestSpeciesChange(race)); } } @@ -552,7 +552,7 @@ public class Pony extends Living implements Transmittable, Copieab @Override public void toNBT(NbtCompound compound) { super.toNBT(compound); - compound.putString("playerSpecies", Race.REGISTRY.getId(getSpecies()).toString()); + compound.putString("playerSpecies", Race.REGISTRY.getId(getActualSpecies()).toString()); compound.putFloat("magicExhaustion", magicExhaustion); compound.putInt("ticksHanging", ticksHanging); NbtSerialisable.writeBlockPos("hangingPosition", hangingPosition, compound); @@ -616,7 +616,7 @@ public class Pony extends Living implements Transmittable, Copieab oldPlayer.getSpellSlot().stream(true).filter(SpellPredicate.IS_PLACED).forEach(getSpellSlot()::put); } oldPlayer.getSpellSlot().put(null); - setSpecies(oldPlayer.getSpecies()); + setSpecies(oldPlayer.getActualSpecies()); getDiscoveries().copyFrom(oldPlayer.getDiscoveries()); getCharms().equipSpell(Hand.MAIN_HAND, oldPlayer.getCharms().getEquippedSpell(Hand.MAIN_HAND)); getCharms().equipSpell(Hand.OFF_HAND, oldPlayer.getCharms().getEquippedSpell(Hand.OFF_HAND)); diff --git a/src/main/java/com/minelittlepony/unicopia/network/MsgPlayerCapabilities.java b/src/main/java/com/minelittlepony/unicopia/network/MsgPlayerCapabilities.java index ed344378..2609986b 100644 --- a/src/main/java/com/minelittlepony/unicopia/network/MsgPlayerCapabilities.java +++ b/src/main/java/com/minelittlepony/unicopia/network/MsgPlayerCapabilities.java @@ -42,7 +42,7 @@ public class MsgPlayerCapabilities implements Packet { public MsgPlayerCapabilities(boolean full, Pony player) { playerId = player.getMaster().getUuid(); - newRace = player.getSpecies(); + newRace = player.getActualSpecies(); compoundTag = full ? player.toNBT() : new NbtCompound(); } diff --git a/src/main/java/com/minelittlepony/unicopia/network/MsgRequestSpeciesChange.java b/src/main/java/com/minelittlepony/unicopia/network/MsgRequestSpeciesChange.java index db2da4a8..b244e6e7 100644 --- a/src/main/java/com/minelittlepony/unicopia/network/MsgRequestSpeciesChange.java +++ b/src/main/java/com/minelittlepony/unicopia/network/MsgRequestSpeciesChange.java @@ -45,7 +45,7 @@ public class MsgRequestSpeciesChange implements Packet { Race worldDefaultRace = WorldTribeManager.forWorld((ServerWorld)player.getReferenceWorld()).getDefaultRace(); - if (force || player.getSpecies().isDefault() || (player.getSpecies() == worldDefaultRace && !player.isSpeciesPersisted())) { + if (force || player.getActualSpecies().isDefault() || (player.getActualSpecies() == worldDefaultRace && !player.isSpeciesPersisted())) { player.setSpecies(newRace.isPermitted(sender) ? newRace : worldDefaultRace); }