Search in sources :

Example 6 with EntityAIFollowParent

use of net.minecraft.entity.ai.EntityAIFollowParent in project Almura by AlmuraDev.

the class MixinEntityCow method initEntityAI.

/**
 * @author Dockter
 * Purpose: overwrite the AT init method to customize the temptations list.
 */
@Overwrite
protected void initEntityAI() {
    final Set<Item> TEMPTATION_ITEMS = Sets.newHashSet(Items.WHEAT);
    Item soyBeanItem = GameRegistry.makeItemStack("almura:food/food/soybean", 0, 1, null).getItem();
    Item cornItem = GameRegistry.makeItemStack("almura:food/food/corn", 0, 1, null).getItem();
    Item alfalfaItem = GameRegistry.makeItemStack("almura:normal/crop/alfalfa_item", 0, 1, null).getItem();
    if (soyBeanItem != ItemStack.EMPTY.getItem())
        TEMPTATION_ITEMS.add(soyBeanItem);
    if (cornItem != ItemStack.EMPTY.getItem())
        TEMPTATION_ITEMS.add(cornItem);
    if (alfalfaItem != ItemStack.EMPTY.getItem())
        TEMPTATION_ITEMS.add(alfalfaItem);
    this.tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(1, new EntityAIPanic(this, 2.0D));
    this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
    this.tasks.addTask(3, new EntityAITempt(this, 1.25D, false, TEMPTATION_ITEMS));
    this.tasks.addTask(4, new EntityAIFollowParent(this, 1.25D));
    this.tasks.addTask(5, new EntityAIWanderAvoidWater(this, 1.0D));
    this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
    this.tasks.addTask(7, new EntityAILookIdle(this));
}
Also used : Item(net.minecraft.item.Item) EntityAIWatchClosest(net.minecraft.entity.ai.EntityAIWatchClosest) EntityAIFollowParent(net.minecraft.entity.ai.EntityAIFollowParent) EntityAISwimming(net.minecraft.entity.ai.EntityAISwimming) EntityAITempt(net.minecraft.entity.ai.EntityAITempt) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EntityAIMate(net.minecraft.entity.ai.EntityAIMate) EntityAILookIdle(net.minecraft.entity.ai.EntityAILookIdle) EntityAIPanic(net.minecraft.entity.ai.EntityAIPanic) EntityAIWanderAvoidWater(net.minecraft.entity.ai.EntityAIWanderAvoidWater) Overwrite(org.spongepowered.asm.mixin.Overwrite)

Aggregations

EntityAIFollowParent (net.minecraft.entity.ai.EntityAIFollowParent)6 EntityAILookIdle (net.minecraft.entity.ai.EntityAILookIdle)6 EntityAIPanic (net.minecraft.entity.ai.EntityAIPanic)6 EntityAISwimming (net.minecraft.entity.ai.EntityAISwimming)6 EntityAITempt (net.minecraft.entity.ai.EntityAITempt)5 EntityAIWatchClosest (net.minecraft.entity.ai.EntityAIWatchClosest)5 EntityPlayer (net.minecraft.entity.player.EntityPlayer)5 EntityAIMate (net.minecraft.entity.ai.EntityAIMate)4 EntityAIWanderAvoidWater (net.minecraft.entity.ai.EntityAIWanderAvoidWater)4 Item (net.minecraft.item.Item)3 Overwrite (org.spongepowered.asm.mixin.Overwrite)3 EntityAIHurtByTarget (net.minecraft.entity.ai.EntityAIHurtByTarget)2 EntityAIAttackMelee (net.minecraft.entity.ai.EntityAIAttackMelee)1 EntityAILeapAtTarget (net.minecraft.entity.ai.EntityAILeapAtTarget)1 EntityAIWander (net.minecraft.entity.ai.EntityAIWander)1