Skip to content

Commit 20d46ff

Browse files
committed
Fix #1027
1 parent 51bca3b commit 20d46ff

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/main/java/com/flansmod/common/driveables/EntitySeat.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import io.netty.buffer.ByteBuf;
66
import net.minecraft.client.Minecraft;
77
import net.minecraft.entity.Entity;
8-
import net.minecraft.entity.EntityLiving;
98
import net.minecraft.entity.EntityLivingBase;
9+
import net.minecraft.entity.passive.EntityAnimal;
1010
import net.minecraft.entity.player.EntityPlayer;
1111
import net.minecraft.entity.player.EntityPlayerMP;
1212
import net.minecraft.item.ItemLead;
@@ -735,27 +735,24 @@ public boolean processInitialInteract(EntityPlayer entityplayer,
735735
return true;
736736
if(currentItem.getItem() instanceof ItemLead)
737737
{
738-
if(getControllingPassenger() != null && getControllingPassenger() instanceof EntityLiving &&
739-
!(getControllingPassenger() instanceof EntityPlayer))
738+
if(getControllingPassenger() instanceof EntityAnimal)
740739
{
741-
EntityLiving mob = (EntityLiving)getControllingPassenger();
742-
mob.dismountRidingEntity();
743-
mob.setLeashHolder(entityplayer, true);
740+
// Minecraft will handle dismounting the mob
744741
return true;
745742
}
743+
746744
double checkRange = 10;
747-
List nearbyMobs = world.getEntitiesWithinAABB(EntityLiving.class,
745+
List<EntityAnimal> nearbyAnimals = world.getEntitiesWithinAABB(EntityAnimal.class,
748746
new AxisAlignedBB(posX - checkRange, posY - checkRange, posZ - checkRange, posX + checkRange,
749747
posY + checkRange, posZ + checkRange));
750-
for(Object obj : nearbyMobs)
748+
for(EntityAnimal animal : nearbyAnimals)
751749
{
752-
EntityLiving entity = (EntityLiving)obj;
753-
if(entity.getLeashed() && entity.getLeashHolder() == entityplayer)
750+
if(animal.getLeashed() && animal.getLeashHolder() == entityplayer)
754751
{
755-
if(entity.startRiding(this))
752+
if(animal.startRiding(this))
756753
{
757-
looking.setAngles(-entity.rotationYaw, entity.rotationPitch, 0F);
758-
entity.clearLeashed(true, !entityplayer.capabilities.isCreativeMode);
754+
looking.setAngles(-animal.rotationYaw, animal.rotationPitch, 0F);
755+
animal.clearLeashed(true, !entityplayer.capabilities.isCreativeMode);
759756
}
760757
else
761758
{

0 commit comments

Comments
 (0)