Heres my code
package com.chestedyt.mod.entity.passive;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIFollowParent;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMate;
import net.minecraft.entity.ai.EntityAIPanic;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAITempt;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
public class EntitySquirtle extends EntityAnimal
{
public EntitySquirtle(World worldIn)
{
super(worldIn);
this.setSize(1.0F, 1.0F);
}
protected void initEntityAI()
{
this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(1, new EntityAIPanic(this, 1.25D));
this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
this.tasks.addTask(3, new EntityAITempt(this, 1.25D, Items.fish, false));
this.tasks.addTask(4, new EntityAIFollowParent(this, 1.25D));
this.tasks.addTask(5, new EntityAIWander(this, 1.0D));
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 20.0F));
this.tasks.addTask(7, new EntityAILookIdle(this));
}
@Override
public boolean isAIDisabled() {
return false;
}
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.0D);
}
public boolean isBreedingItem(ItemStack itemstack) {
return itemstack != null && itemstack.getItem() == Items.fish;
}
public boolean canBreatheUnderwater() {
return true;
}
public boolean isPushedByWater() {
return false;
}
public void onLivingUpdate() {
super.onLivingUpdate();
if(this.isInWater()) {
this.setAir(300);
this.limbSwingAmount = 0;
this.limbSwing = 0;
this.prevLimbSwingAmount = this.limbSwingAmount;
}
}
@Override
protected String getLivingSound() {
return "mob.rabbit.idle";
}
@Override
protected String getHurtSound() {
return "mob.rabbit.hurt";
}
@Override
protected String getDeathSound() {
return "mob.rabbit.death";
}
protected void func_180429_a(BlockPos bp, Block b) {
this.playSound("mob.cow.step", 0.15f, 2.0f);
}
protected float getSoundVolume() {
return 0.4f;
}
protected Item getDropItem() {
return Items.leather;
}
protected void dropFewItems(boolean recentlyhit, int modifier) {
this.dropItem(Items.leather, 1);
}
@Override
public boolean interact(EntityPlayer player) {
return super.interact(player);
}
public EntitySquirtle createChild(EntityAgeable ageable)
{
return new EntitySquirtle(this.worldObj);
}
public float getEyeHeight()
{
return 1.3F;
}
public boolean getCanSpawnHere() {
return super.getCanSpawnHere();
}
public void moveEntityWithHeading(float x, float z) {
if(this.isInWater())
{
this.moveFlying(x, z, 0.1f);
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.8D;
this.motionY *= 0.8D;
this.motionZ *= 0.8D;
}
else
{
super.moveEntityWithHeading(x, z);
}
}
}