diff --git a/src/main/java/com/minelittlepony/unicopia/command/SpeciesCommand.java b/src/main/java/com/minelittlepony/unicopia/command/SpeciesCommand.java index b631c148..9b61331f 100644 --- a/src/main/java/com/minelittlepony/unicopia/command/SpeciesCommand.java +++ b/src/main/java/com/minelittlepony/unicopia/command/SpeciesCommand.java @@ -3,6 +3,8 @@ package com.minelittlepony.unicopia.command; import com.minelittlepony.unicopia.Race; import com.minelittlepony.unicopia.Unicopia; import com.minelittlepony.unicopia.entity.player.Pony; +import com.minelittlepony.unicopia.network.Channel; +import com.minelittlepony.unicopia.network.MsgTribeSelect; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.builder.LiteralArgumentBuilder; @@ -11,6 +13,7 @@ import net.minecraft.command.argument.RegistryKeyArgumentType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.server.command.CommandManager; import net.minecraft.server.command.CommandManager.RegistrationEnvironment; +import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.text.MutableText; import net.minecraft.text.Text; @@ -64,6 +67,10 @@ class SpeciesCommand { pony.setSpecies(race); pony.setDirty(); + if (race.isUnset()) { + Channel.SERVER_SELECT_TRIBE.sendToPlayer(new MsgTribeSelect(Race.allPermitted(player), "gui.unicopia.tribe_selection.respawn"), (ServerPlayerEntity)player); + } + if (player == source.getPlayer()) { source.sendFeedback(Text.translatable("commands.race.success.self", race.getDisplayName()), true); } else { diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java b/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java index 2e87ae8e..da0d1d58 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java @@ -698,10 +698,11 @@ public class Pony extends Living implements Copyable, Update @Override public void copyFrom(Pony oldPlayer, boolean alive) { - boolean forcedSwap = !alive + boolean forcedSwap = (!alive && entity instanceof ServerPlayerEntity && entity.world.getGameRules().getBoolean(UGameRules.SWAP_TRIBE_ON_DEATH) - && oldPlayer.respawnRace == Race.UNSET; + && oldPlayer.respawnRace.isUnset()) + || oldPlayer.getActualSpecies().isUnset(); if (alive) { oldPlayer.getSpellSlot().stream(true).forEach(getSpellSlot()::put);