Search in sources :

Example 1 with EntityAITempt

use of net.minecraft.entity.ai.EntityAITempt in project Totemic by TeamTotemic.

the class ItemFlute method temptEntities.

private void temptEntities(World world, double x, double y, double z) {
    for (EntityLiving entity : EntityUtil.getEntitiesInRange(EntityLiving.class, world, x, y, z, 2, 2)) {
        if ((entity instanceof EntityAnimal && entity.getNavigator() instanceof PathNavigateGround) || entity instanceof EntityVillager) {
            if (temptedEntities.contains(entity))
                continue;
            double speed = (entity instanceof EntityAnimal) ? 1 : 0.5;
            entity.targetTasks.addTask(5, new EntityAITempt((EntityCreature) entity, speed, this, false));
            temptedEntities.add(entity);
        }
    }
}
Also used : EntityLiving(net.minecraft.entity.EntityLiving) EntityVillager(net.minecraft.entity.passive.EntityVillager) EntityAITempt(net.minecraft.entity.ai.EntityAITempt) EntityAnimal(net.minecraft.entity.passive.EntityAnimal) EntityCreature(net.minecraft.entity.EntityCreature) PathNavigateGround(net.minecraft.pathfinding.PathNavigateGround)

Example 2 with EntityAITempt

use of net.minecraft.entity.ai.EntityAITempt in project KalStuff by TEAMModding.

the class EntityDuck method initEntityAI.

protected void initEntityAI() {
    this.tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(1, new EntityAIPanic(this, 1.4D));
    this.tasks.addTask(3, new EntityAITempt(this, 1.0D, false, TEMPTATION_ITEMS));
    this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D));
    this.tasks.addTask(7, new EntityAILookIdle(this));
}
Also used : EntityAIFollowParent(net.minecraft.entity.ai.EntityAIFollowParent) EntityAISwimming(net.minecraft.entity.ai.EntityAISwimming) EntityAITempt(net.minecraft.entity.ai.EntityAITempt) EntityAILookIdle(net.minecraft.entity.ai.EntityAILookIdle) EntityAIPanic(net.minecraft.entity.ai.EntityAIPanic)

Example 3 with EntityAITempt

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

the class MixinEntityChicken 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_SEEDS, Items.MELON_SEEDS, Items.PUMPKIN_SEEDS, Items.BEETROOT_SEEDS);
    Item soyBeanItem = GameRegistry.makeItemStack("almura:food/food/soybean", 0, 1, null).getItem();
    Item cornItem = GameRegistry.makeItemStack("almura:food/food/corn", 0, 1, null).getItem();
    if (soyBeanItem != ItemStack.EMPTY.getItem())
        TEMPTATION_ITEMS.add(soyBeanItem);
    if (cornItem != ItemStack.EMPTY.getItem())
        TEMPTATION_ITEMS.add(cornItem);
    this.tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(1, new EntityAIPanic(this, 1.4D));
    this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
    this.tasks.addTask(3, new EntityAITempt(this, 1.0D, false, TEMPTATION_ITEMS));
    this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D));
    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)

Example 4 with EntityAITempt

use of net.minecraft.entity.ai.EntityAITempt in project DefiledLands by Lykrast.

the class EntityBookWyrm method initEntityAI.

protected void initEntityAI() {
    this.tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(1, new AIPanic(1.2D));
    this.tasks.addTask(2, new EntityAILeapAtTarget(this, 0.4F));
    this.tasks.addTask(3, new EntityAIAttackMelee(this, 1.2D, false));
    this.tasks.addTask(4, new EntityAIMate(this, 1.0D));
    this.tasks.addTask(5, new EntityAITempt(this, 1.2D, false, TEMPTATION_ITEMS));
    this.tasks.addTask(6, new EntityAIFollowParent(this, 1.1D));
    this.tasks.addTask(7, new EntityAIWanderAvoidWater(this, 1.0D));
    this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
    this.tasks.addTask(9, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new AIHurtByTarget());
}
Also used : EntityAIWatchClosest(net.minecraft.entity.ai.EntityAIWatchClosest) EntityAILeapAtTarget(net.minecraft.entity.ai.EntityAILeapAtTarget) EntityAIFollowParent(net.minecraft.entity.ai.EntityAIFollowParent) EntityAIPanic(net.minecraft.entity.ai.EntityAIPanic) 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) EntityAIHurtByTarget(net.minecraft.entity.ai.EntityAIHurtByTarget) EntityAIAttackMelee(net.minecraft.entity.ai.EntityAIAttackMelee) EntityAIWanderAvoidWater(net.minecraft.entity.ai.EntityAIWanderAvoidWater)

Example 5 with EntityAITempt

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

the class MixinEntityPig 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.CARROT, Items.POTATO, Items.BEETROOT);
    Item soyBeanItem = GameRegistry.makeItemStack("almura:food/food/soybean", 0, 1, null).getItem();
    Item cornItem = GameRegistry.makeItemStack("almura:food/food/corn", 0, 1, null).getItem();
    if (soyBeanItem != ItemStack.EMPTY.getItem())
        TEMPTATION_ITEMS.add(soyBeanItem);
    if (cornItem != ItemStack.EMPTY.getItem())
        TEMPTATION_ITEMS.add(cornItem);
    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));
}
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

EntityAITempt (net.minecraft.entity.ai.EntityAITempt)6 EntityAIFollowParent (net.minecraft.entity.ai.EntityAIFollowParent)5 EntityAILookIdle (net.minecraft.entity.ai.EntityAILookIdle)5 EntityAIPanic (net.minecraft.entity.ai.EntityAIPanic)5 EntityAISwimming (net.minecraft.entity.ai.EntityAISwimming)5 EntityAIMate (net.minecraft.entity.ai.EntityAIMate)4 EntityAIWanderAvoidWater (net.minecraft.entity.ai.EntityAIWanderAvoidWater)4 EntityAIWatchClosest (net.minecraft.entity.ai.EntityAIWatchClosest)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 Item (net.minecraft.item.Item)3 Overwrite (org.spongepowered.asm.mixin.Overwrite)3 EntityCreature (net.minecraft.entity.EntityCreature)1 EntityLiving (net.minecraft.entity.EntityLiving)1 EntityAIAttackMelee (net.minecraft.entity.ai.EntityAIAttackMelee)1 EntityAIHurtByTarget (net.minecraft.entity.ai.EntityAIHurtByTarget)1 EntityAILeapAtTarget (net.minecraft.entity.ai.EntityAILeapAtTarget)1 EntityAnimal (net.minecraft.entity.passive.EntityAnimal)1 EntityVillager (net.minecraft.entity.passive.EntityVillager)1 PathNavigateGround (net.minecraft.pathfinding.PathNavigateGround)1