diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/DisguiseSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/DisguiseSpell.java index b48a526c..ecc7bbb8 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/DisguiseSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/DisguiseSpell.java @@ -5,7 +5,6 @@ import java.util.Optional; import javax.annotation.Nullable; import com.minelittlepony.unicopia.Affinity; -import com.minelittlepony.unicopia.InteractionManager; import com.minelittlepony.unicopia.Owned; import com.minelittlepony.unicopia.ability.FlightPredicate; import com.minelittlepony.unicopia.ability.DimensionsPredicate; @@ -133,8 +132,8 @@ public class DisguiseSpell extends AbstractSpell implements AttachableSpell, Sup } if (entity == null) { + owner.setInvisible(false); if (source instanceof Pony) { - owner.setInvisible(false); ((Pony) source).setInvisible(false); } @@ -164,8 +163,8 @@ public class DisguiseSpell extends AbstractSpell implements AttachableSpell, Sup if (source instanceof Pony) { Pony player = (Pony)source; - player.setInvisible(true); source.getOwner().setInvisible(true); + player.setInvisible(true); if (entity instanceof Owned) { ((Owned)entity).setOwner(player.getOwner()); @@ -174,11 +173,6 @@ public class DisguiseSpell extends AbstractSpell implements AttachableSpell, Sup if (entity instanceof PlayerEntity) { entity.getDataTracker().set(PlayerAccess.getModelBitFlag(), owner.getDataTracker().get(PlayerAccess.getModelBitFlag())); } - - if (player.isClientPlayer() && InteractionManager.instance().getViewMode() == 0) { - entity.setInvisible(true); - entity.setPos(entity.getX(), Integer.MIN_VALUE, entity.getY()); - } } return !source.getOwner().isDead(); diff --git a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityBehaviour.java b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityBehaviour.java index bd2e55f8..d7bc986e 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityBehaviour.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityBehaviour.java @@ -239,6 +239,7 @@ public class EntityBehaviour { register(MobBehaviour::new, EntityType.RAVAGER, EntityType.IRON_GOLEM); register(HoppingBehaviour::new, EntityType.RABBIT, EntityType.SLIME, EntityType.MAGMA_CUBE); register(TraderBehaviour::new, EntityType.VILLAGER, EntityType.WANDERING_TRADER); + register(SteedBehaviour::new, EntityType.HORSE, EntityType.DONKEY, EntityType.SKELETON_HORSE, EntityType.ZOMBIE_HORSE); register(SheepBehaviour::new, EntityType.SHEEP); register(BeeBehaviour::new, EntityType.BEE); register(GhastBehaviour::new, EntityType.GHAST); diff --git a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/SteedBehaviour.java b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/SteedBehaviour.java new file mode 100644 index 00000000..98cb8d64 --- /dev/null +++ b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/SteedBehaviour.java @@ -0,0 +1,27 @@ +package com.minelittlepony.unicopia.entity.behaviour; + +import com.minelittlepony.unicopia.ability.magic.spell.DisguiseSpell; +import com.minelittlepony.unicopia.entity.player.Pony; + +import net.minecraft.entity.JumpingMount; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.passive.HorseBaseEntity; + +public class SteedBehaviour extends EntityBehaviour { + + @Override + public void update(Pony player, T entity, DisguiseSpell spell) { + + HorseBaseEntity horse = ((HorseBaseEntity)entity); + + boolean angry = !player.getEntity().isOnGround() && player.getOwner().isSprinting(); + boolean sneaking = isSneakingOnGround(player); + + angry |= sneaking; + if (player.sneakingChanged() && sneaking) { + horse.playAngrySound(); + } + + horse.setAngry(angry); + } +}