diff --git a/src/main/java/com/minelittlepony/unicopia/InteractionManager.java b/src/main/java/com/minelittlepony/unicopia/InteractionManager.java index 0fa2f9c6..2c108740 100644 --- a/src/main/java/com/minelittlepony/unicopia/InteractionManager.java +++ b/src/main/java/com/minelittlepony/unicopia/InteractionManager.java @@ -8,7 +8,6 @@ import org.jetbrains.annotations.Nullable; import com.minelittlepony.unicopia.ability.magic.CasterView; import com.minelittlepony.unicopia.block.data.Ether; import com.minelittlepony.unicopia.entity.player.dummy.DummyPlayerEntity; -import com.minelittlepony.unicopia.entity.player.dummy.DummyServerPlayerEntity; import com.minelittlepony.unicopia.network.handler.ClientNetworkHandler; import com.mojang.authlib.GameProfile; import com.mojang.authlib.minecraft.MinecraftSessionService; @@ -99,9 +98,6 @@ public class InteractionManager { */ @NotNull public PlayerEntity createPlayer(World world, GameProfile profile) { - if (world instanceof ServerWorld) { - return new DummyServerPlayerEntity((ServerWorld)world, profile); - } return new DummyPlayerEntity(world, profile); } } diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/MindSwapSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/MindSwapSpell.java index ab5f387b..8f1441d6 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/MindSwapSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/MindSwapSpell.java @@ -78,6 +78,8 @@ public class MindSwapSpell extends MimicSpell { if (counterpart.getId().isPresent() && counterpart.get(caster.getReferenceWorld()) == null) { caster.getMaster().damage(DamageSource.MAGIC, Float.MAX_VALUE); + setDead(); + return false; } } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityAppearance.java b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityAppearance.java index 715c6861..f18315a6 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityAppearance.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityAppearance.java @@ -194,8 +194,6 @@ public class EntityAppearance implements NbtSerialisable, PlayerDimensions.Provi return; } - Caster.of(entity).ifPresent(c -> c.getSpellSlot().clear()); - if (entity instanceof LivingEntity) { ((LivingEntity) entity).getAttributeInstance(UEntityAttributes.ENTITY_GRAVTY_MODIFIER).clearModifiers(); } @@ -343,9 +341,13 @@ public class EntityAppearance implements NbtSerialisable, PlayerDimensions.Provi } entityNbt.putString("playerName", profile.getName()); entityNbt.putByte("playerVisibleParts", player.getDataTracker().get(Disguise.PlayerAccess.getModelBitFlag())); - entityNbt.put("playerNbt", player.writeNbt(new NbtCompound())); + + NbtCompound playerNbt = player.writeNbt(new NbtCompound()); + playerNbt.remove("unicopia_caster"); + entityNbt.put("playerNbt", playerNbt); } else { entity.saveSelfNbt(entityNbt); + entityNbt.remove("unicopia_caster"); } return entityNbt; diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/dummy/DummyPlayerEntity.java b/src/main/java/com/minelittlepony/unicopia/entity/player/dummy/DummyPlayerEntity.java index 07b8c1bb..2ee53e5b 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/dummy/DummyPlayerEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/dummy/DummyPlayerEntity.java @@ -6,6 +6,7 @@ import com.minelittlepony.unicopia.InteractionManager; import com.minelittlepony.unicopia.Owned; import com.mojang.authlib.GameProfile; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; @@ -24,6 +25,11 @@ public class DummyPlayerEntity extends PlayerEntity implements Owned { - - private PlayerEntity owner; - - public DummyServerPlayerEntity(ServerWorld world, GameProfile profile) { - super(world.getServer(), world, profile, null); - } - - @Override - protected void playEquipSound(ItemStack stack) { - /*noop*/ - } - - @Override - protected void onBlockCollision(BlockState state) { - /*noop*/ - } - - @Override - @Nullable - public PlayerEntity getMaster() { - return owner; - } - - @Override - public void setMaster(PlayerEntity owner) { - this.owner = owner; - } - - @Override - public boolean shouldRenderName() { - return !InteractionManager.instance().isClientPlayer(getMaster()); - } -}