Search in sources :

Example 1 with EntityAIAttackRanged

use of net.minecraft.entity.ai.EntityAIAttackRanged in project SpongeCommon by SpongePowered.

the class SpongeRangeAgentAIBuilder method build.

@Override
public RangeAgentAITask build(Ranger owner) {
    checkNotNull(owner);
    checkArgument(owner instanceof IRangedAttackMob, "Ranger must be an IRangedAttackMob!");
    return (RangeAgentAITask) new EntityAIAttackRanged((IRangedAttackMob) owner, this.maxSpeed, this.delayBetweenAttacks, this.attackRadius);
}
Also used : EntityAIAttackRanged(net.minecraft.entity.ai.EntityAIAttackRanged) RangeAgentAITask(org.spongepowered.api.entity.ai.task.builtin.creature.RangeAgentAITask) IRangedAttackMob(net.minecraft.entity.IRangedAttackMob)

Example 2 with EntityAIAttackRanged

use of net.minecraft.entity.ai.EntityAIAttackRanged in project Tropicraft by Tropicraft.

the class EntityTreeFrog method initEntityAI.

@Override
protected void initEntityAI() {
    super.initEntityAI();
    this.tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(1, new EntityAIAttackRanged(this, 1.0D, 60, 10.0F));
    this.tasks.addTask(2, new EntityAIWander(this, 1.0D));
    hostileAI = new EntityAINearestAttackableTarget<EntityPlayer>(this, EntityPlayer.class, true);
    this.targetTasks.addTask(1, hostileAI);
}
Also used : EntityAIAttackRanged(net.minecraft.entity.ai.EntityAIAttackRanged) EntityAISwimming(net.minecraft.entity.ai.EntityAISwimming) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EntityAIWander(net.minecraft.entity.ai.EntityAIWander)

Example 3 with EntityAIAttackRanged

use of net.minecraft.entity.ai.EntityAIAttackRanged in project Minestuck by mraof.

the class EntityPawn method setCombatTask.

// /**
// * Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack.
// */
// @Override
// protected void attackEntity(Entity par1Entity, float par2)
// {
// if (this.attackTime <= 0 && par2 < 2.0F && par1Entity.getEntityBoundingBox().maxY > this.getEntityBoundingBox().minY && par1Entity.getEntityBoundingBox().minY < this.getEntityBoundingBox().maxY)
// {
// this.attackTime = 20;
// this.attackEntityAsMob(par1Entity);
// }
// }
@Override
public void setCombatTask() {
    if (this.entityAIArrowAttack == null || this.entityAIAttackOnCollide == null) {
        entityAIArrowAttack = new EntityAIAttackRanged(this, 0.25F, 20, 10.0F);
        entityAIAttackOnCollide = new EntityAIAttackMelee(this, .4F, false);
    }
    this.tasks.removeTask(this.entityAIArrowAttack);
    this.tasks.removeTask(this.entityAIAttackOnCollide);
    ItemStack weapon = this.getHeldItemMainhand();
    if (weapon != null && weapon.getItem() == Items.BOW) {
        this.tasks.addTask(4, this.entityAIArrowAttack);
    } else
        this.tasks.addTask(4, this.entityAIAttackOnCollide);
}
Also used : EntityAIAttackRanged(net.minecraft.entity.ai.EntityAIAttackRanged) ItemStack(net.minecraft.item.ItemStack) EntityAIAttackMelee(net.minecraft.entity.ai.EntityAIAttackMelee)

Example 4 with EntityAIAttackRanged

use of net.minecraft.entity.ai.EntityAIAttackRanged in project takumicraft by TNTModders.

the class EntitySnowCreeper method initEntityAI.

@Override
protected void initEntityAI() {
    super.initEntityAI();
    this.tasks.addTask(1, new EntityAIAttackRanged(this, 1.25D, 20, 10.0F));
    this.targetTasks.addTask(1, new EntityAINearestAttackableTarget<>(this, EntityPlayer.class, 10, true, false, IMob.MOB_SELECTOR));
}
Also used : EntityAIAttackRanged(net.minecraft.entity.ai.EntityAIAttackRanged) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Aggregations

EntityAIAttackRanged (net.minecraft.entity.ai.EntityAIAttackRanged)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 IRangedAttackMob (net.minecraft.entity.IRangedAttackMob)1 EntityAIAttackMelee (net.minecraft.entity.ai.EntityAIAttackMelee)1 EntityAISwimming (net.minecraft.entity.ai.EntityAISwimming)1 EntityAIWander (net.minecraft.entity.ai.EntityAIWander)1 ItemStack (net.minecraft.item.ItemStack)1 RangeAgentAITask (org.spongepowered.api.entity.ai.task.builtin.creature.RangeAgentAITask)1