package mod.acgaming.spackenmobs.entities; import java.util.Set; import com.google.common.collect.Sets; import mod.acgaming.spackenmobs.Spackenmobs; import net.minecraft.entity.EntityAgeable; 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.EntityAIWanderAvoidWater; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.passive.EntityPig; 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.DamageSource; import net.minecraft.util.SoundEvent; import net.minecraft.world.World; public class EntityJens extends EntityPig { private static final Set TEMPTATION_ITEMS = Sets.newHashSet(Items.CARROT, Items.POTATO, Items.BEETROOT); public EntityJens(World worldIn) { super(worldIn); setSize(0.6F, 1.8F); } protected void initEntityAI() { this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIPanic(this, 1.25D)); this.tasks.addTask(3, new EntityAIMate(this, 1.0D)); this.tasks.addTask(4, new EntityAITempt(this, 1.2D, Items.CARROT_ON_A_STICK, false)); this.tasks.addTask(4, new EntityAITempt(this, 1.2D, false, TEMPTATION_ITEMS)); this.tasks.addTask(5, new EntityAIFollowParent(this, 1.1D)); this.tasks.addTask(6, new EntityAIWanderAvoidWater(this, 1.0D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); } public boolean isBreedingItem(ItemStack stack) { return TEMPTATION_ITEMS.contains(stack.getItem()); } public EntityJens createChild(EntityAgeable ageable) { return new EntityJens(this.world); } protected SoundEvent getAmbientSound() { return Spackenmobs.ENTITY_JENS_AMBIENT; } protected SoundEvent getHurtSound(DamageSource damageSourceIn) { return Spackenmobs.ENTITY_JENS_HURT; } protected SoundEvent getDeathSound() { return Spackenmobs.ENTITY_JENS_DEATH; } }