diff --git a/src/main/java/drzhark/mocreatures/entity/IMoCEntity.java b/src/main/java/drzhark/mocreatures/entity/IMoCEntity.java index 47035b6b5..c16e09f8f 100644 --- a/src/main/java/drzhark/mocreatures/entity/IMoCEntity.java +++ b/src/main/java/drzhark/mocreatures/entity/IMoCEntity.java @@ -4,6 +4,7 @@ package drzhark.mocreatures.entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import java.util.UUID; @@ -95,4 +96,7 @@ public interface IMoCEntity { boolean getIsFlying(); String getClazzString(); + boolean startRidingPlayer(EntityPlayer player); + + boolean canRidePlayer(); } diff --git a/src/main/java/drzhark/mocreatures/entity/MoCEntityAnimal.java b/src/main/java/drzhark/mocreatures/entity/MoCEntityAnimal.java index 35acfba7e..75556333d 100644 --- a/src/main/java/drzhark/mocreatures/entity/MoCEntityAnimal.java +++ b/src/main/java/drzhark/mocreatures/entity/MoCEntityAnimal.java @@ -1046,6 +1046,20 @@ public boolean getIsGhost() { return false; } + @Override + public boolean startRidingPlayer(EntityPlayer player) { + if (MoCTools.getEntityRidingPlayer(player) != null) { + return false; // Something is already riding this player. + } + boolean ret = super.startRiding(player); + if (ret) { + NBTTagCompound tag = player.getEntityData(); + tag.setUniqueId("MOCEntity_Riding_Player", this.getUniqueID()); + return true; + } + return false; + } + @Override public void setLeashHolder(Entity entityIn, boolean sendAttachNotification) { if (this.getIsTamed() && entityIn instanceof EntityPlayer) { diff --git a/src/main/java/drzhark/mocreatures/entity/tameable/IMoCTameable.java b/src/main/java/drzhark/mocreatures/entity/tameable/IMoCTameable.java index cf42573e0..8aefcfac3 100644 --- a/src/main/java/drzhark/mocreatures/entity/tameable/IMoCTameable.java +++ b/src/main/java/drzhark/mocreatures/entity/tameable/IMoCTameable.java @@ -47,10 +47,6 @@ public interface IMoCTameable extends IMoCEntity { int getGestationTime(); - boolean startRidingPlayer(EntityPlayer player); - - boolean canRidePlayer(); - void setGestationTime(int time); } diff --git a/src/main/java/drzhark/mocreatures/entity/tameable/MoCEntityTameableAnimal.java b/src/main/java/drzhark/mocreatures/entity/tameable/MoCEntityTameableAnimal.java index e88d7cc08..48f3fc4ba 100644 --- a/src/main/java/drzhark/mocreatures/entity/tameable/MoCEntityTameableAnimal.java +++ b/src/main/java/drzhark/mocreatures/entity/tameable/MoCEntityTameableAnimal.java @@ -543,18 +543,4 @@ public int getGestationTime() { public void setGestationTime(int time) { gestationtime = time; } - - @Override - public boolean startRidingPlayer(EntityPlayer player) { - if (MoCTools.getEntityRidingPlayer(player) != null) { - return false; // Something is already riding this player. - } - boolean ret = super.startRiding(player); - if (ret) { - NBTTagCompound tag = player.getEntityData(); - tag.setUniqueId("MOCEntity_Riding_Player", this.getUniqueID()); - return true; - } - return false; - } } diff --git a/src/main/java/drzhark/mocreatures/event/MoCEventHooks.java b/src/main/java/drzhark/mocreatures/event/MoCEventHooks.java index d7e2910b1..606cbe1fa 100644 --- a/src/main/java/drzhark/mocreatures/event/MoCEventHooks.java +++ b/src/main/java/drzhark/mocreatures/event/MoCEventHooks.java @@ -6,6 +6,7 @@ import com.google.common.primitives.Ints; import drzhark.mocreatures.MoCConstants; import drzhark.mocreatures.MoCTools; +import drzhark.mocreatures.entity.IMoCEntity; import drzhark.mocreatures.entity.MoCEntityAnimal; import drzhark.mocreatures.entity.MoCEntityData; import drzhark.mocreatures.entity.tameable.MoCPetMapData; @@ -127,8 +128,8 @@ public void onPlayerLogout(PlayerEvent.PlayerLoggedOutEvent event) { Entity entityRidingPlayer = MoCTools.getEntityRidingPlayer(player); if (entityRidingPlayer != null) { // System.out.println("PLAYER LEFT THE GAME carrying entity: "+entityRidingPlayer); - if (IMoCTameable.class.isAssignableFrom(entityRidingPlayer.getClass())) { - IMoCTameable mocEntity = (IMoCTameable) entityRidingPlayer; + if (IMoCEntity.class.isAssignableFrom(entityRidingPlayer.getClass())) { + IMoCEntity mocEntity = (IMoCEntity) entityRidingPlayer; if (mocEntity.canRidePlayer()) MoCTools.dismountPassengerFromEntity(entityRidingPlayer, player, true); } }