protected void applyEntityAI() { targetTasks.addTask(2, new EntityAINearestAttackableTarget<>(this, EntityPlayer.class, true)); }
@Override public boolean shouldExecute() { if (replicator.hunger < replicator.hungerToCanibal) return false; return super.shouldExecute(); } }
/** * Reset the task's internal state. Called when this task is interrupted by another one */ public void resetTask() { this.player = null; super.resetTask(); }
/** * Returns whether an in-progress EntityAIBase should continue executing */ @Override public boolean shouldContinueExecuting() { final EntityPlayer targetPlayer2 = targetPlayer; if (targetPlayer2 != null) { if (!enderminy.shouldAttackPlayer(targetPlayer2)) { return false; } else { enderminy.setAggressive(true); enderminy.faceEntity(targetPlayer2, 10.0F, 10.0F); return true; } } else { return super.shouldContinueExecuting(); } }
@Override protected double getTargetDistance() { return super.getTargetDistance() / 2; } });
/** * Returns whether an in-progress EntityAIBase should continue executing */ @Override public boolean shouldContinueExecuting() { if (player != null) { if (!shouldAttackPlayer(player)) { return false; } else { enderman.faceEntity(player, 10.0F, 10.0F); return true; } } else { return targetEntity != null && targetEntity.isEntityAlive() || super.shouldContinueExecuting(); } }
@Override protected double getTargetDistance() { return super.getTargetDistance() / 2; } });
public EntityFallenKnight(World world) { super(world); setCombatTaskReal(); targetTasks.addTask(2, new EntityAINearestAttackableTarget<EntityVillager>(this, EntityVillager.class, false)); targetTasks.addTask(2, new EntityAINearestAttackableTarget<AbstractIllager>(this, AbstractIllager.class, false)); }
/** * Returns whether the EntityAIBase should begin execution. */ public boolean shouldExecute() { return super.shouldExecute(); } }
/** * Resets the task */ @Override public void resetTask() { player = null; super.resetTask(); }
/** * Returns whether an in-progress EntityAIBase should continue executing */ @Override public boolean shouldContinueExecuting() { if (player != null) { if (!shouldAttackPlayer(player)) { return false; } else { enderman.faceEntity(player, 10.0F, 10.0F); return true; } } else { return targetEntity != null && targetEntity.isEntityAlive() || super.shouldContinueExecuting(); } }
@Override protected double getTargetDistance() { if (distanceOverride != null) { return distanceOverride.get(); } return super.getTargetDistance(); }
private void applyEntityAI() { this.tasks.addTask(6, new EntityAIMoveThroughVillage(this, 1.0D, false)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[]{EntityPigZombie.class})); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityVillager.class, false)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityIronGolem.class, true)); }
@Override public boolean shouldExecute() { return ZooConfig.attackCreepers.get() ? super.shouldExecute() : false; } });
/** * Resets the task */ @Override public void resetTask() { player = null; super.resetTask(); }
/** * Returns whether an in-progress EntityAIBase should continue executing */ public boolean shouldContinueExecuting() { if (this.player != null) { if (!EntityGorgon.isEntityLookingAt(this.player, this.cockatrice, 0.4F)) { return false; } else { this.cockatrice.faceEntity(this.player, 10.0F, 10.0F); if(!this.cockatrice.isTamed()){ this.cockatrice.setTargetedEntity(this.player.getEntityId()); this.cockatrice.setAttackTarget(this.player); } return true; } } else { return this.targetEntity != null && ((EntityPlayer) this.targetEntity).isEntityAlive() ? true : super.shouldContinueExecuting(); } } }
@Override protected void initEntityAI() { tasks.addTask(0, new EntityAISwimming(this)); tasks.addTask(1, new EntityAIErebusAttackMelee(this, 0.7D, false)); tasks.addTask(2, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); tasks.addTask(3, new EntityAntlion.AIWander(this, 0.7D)); targetTasks.addTask(0, new EntityAIHurtByTarget(this, false)); targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, false)); targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityFireAnt.class, false)); targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityFireAntSoldier.class, false)); //targetTasks.addTask(4, new EntityAINearestAttackableTarget(this, EntityBlackAnt.class, true)); }
/** * Returns whether the EntityAIBase should begin execution. */ public boolean shouldExecute() { float f = this.taskOwner.getBrightness(); return !(f >= 0.5F) && super.shouldExecute(); } }
/** * Resets the task */ @Override public void resetTask() { targetPlayer = null; enderminy.setScreaming(false); IAttributeInstance iattributeinstance = enderminy.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED); iattributeinstance.removeModifier(EntityEnderminy.getAttackingspeedboostmodifier()); super.resetTask(); }
@Override protected void initEntityAI() { tasks.addTask(0, new EntityAISwimming(this)); tasks.addTask(1, new EntityAIErebusAttackMelee(this, 0.5D, true)); tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); tasks.addTask(4, new EntityAILookIdle(this)); tasks.addTask(5, new EntityAIFlyingWander(this, 0.75D, 1)); targetTasks.addTask(0, new EntityAIHurtByTarget(this, true)); targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); //targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityGrasshopper.class, true)); targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityBeetle.class, true)); targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityBeetleLarva.class, true)); targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityWorkerBee.class, true)); }