net.minecraft.entity.ai.EntityAIAttackMelee Java Examples

The following examples show how to use net.minecraft.entity.ai.EntityAIAttackMelee. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityGuard.java    From ToroQuest with GNU General Public License v3.0 6 votes vote down vote up
protected void initEntityAI() {
	areaAI = new EntityAIMoveIntoArea(this, 0.5D, 30);
	tasks.addTask(0, new EntityAISwimming(this));
	tasks.addTask(2, new EntityAIAttackMelee(this, 0.6D, false));
	tasks.addTask(4, areaAI);
	tasks.addTask(7, new EntityAIWander(this, 0.35D));
	tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
	tasks.addTask(8, new EntityAILookIdle(this));

	targetTasks.addTask(2, new EntityAINearestAttackableCivTarget(this));
	targetTasks.addTask(3, new EntityAINearestAttackableTarget<EntityMob>(this, EntityMob.class, 10, false, false, new Predicate<EntityMob>() {
		@Override
		public boolean apply(EntityMob target) {
			return !(target instanceof EntityCreeper);
		}
	}));
}
 
Example #2
Source File: EntityElk.java    From TFC2 with GNU General Public License v3.0 6 votes vote down vote up
public EntityElk(World worldIn) 
{
	super(worldIn);
	this.setSize(1.5F, 1.8F);
	((PathNavigateGround)this.getNavigator()).setCanSwim(true);
	this.tasks.addTask(0, new EntityAISmartSwim(this));
	this.tasks.addTask(4, new EntityAIAttackMelee(this, 0.8D, true));
	this.tasks.addTask(5, new EntityAIFollowParent(this, 0.8D));	
	aiHerdMove = new EntityAIHerdMove(this, 0.5D);
	this.tasks.addTask(6, aiHerdMove);
	this.tasks.addTask(7, new EntityAIWanderHex(this, 0.5D));
	//this.tasks.addTask(7, new EntityAIWander(this, 0.5D));
	//this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
	this.tasks.addTask(8, new EntityAILookIdle(this));
	this.targetTasks.addTask(0, new EntityAIHurtByTarget(this, true, new Class[0]));//The array seems to be for class types that this task should ignore
	setGender(worldIn.rand.nextBoolean() ? Gender.Male : Gender.Female);
}
 
Example #3
Source File: EntityEnderminy.java    From EnderZoo with Creative Commons Zero v1.0 Universal 6 votes vote down vote up
public EntityEnderminy(World world) {
  super(world);
  setSize(0.6F * 0.5F, 2.9F * 0.25F);
  stepHeight = 1.0F;

  tasks.addTask(0, new EntityAISwimming(this));
  tasks.addTask(2, new EntityAIAttackMelee(this, 1.0D, false));
  tasks.addTask(7, new EntityAIWander(this, 1.0D));
  tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
  tasks.addTask(8, new EntityAILookIdle(this));
  targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0]));

  if(attackIfLookingAtPlayer) {
    targetTasks.addTask(2, new AIFindPlayer());
  }

  if(attackCreepers) {
    targetTasks.addTask(2, new EntityAINearestAttackableTarget<EntityCreeper>(this, EntityCreeper.class, true, true));
  }
}
 
Example #4
Source File: EntityWitherCat.java    From EnderZoo with Creative Commons Zero v1.0 Universal 6 votes vote down vote up
public EntityWitherCat(World world) {
  super(world);

  followTask = new EntityAIFollowOwner(this, 2.5, 5, 1);
  EntityAIFollowOwner retreatTask = new EntityAIFollowOwner(this, 2.5, 5, 2.5);

  tasks.addTask(1, new EntityAISwimming(this));
  tasks.addTask(2, new EntityAIAttackOnCollideOwned(this, EntityPlayer.class, 2.5, false, retreatTask));
  tasks.addTask(3, followTask);
  tasks.addTask(4, new EntityAIWander(this, 1.0D));
  tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
  tasks.addTask(6, new EntityAILookIdle(this));
  tasks.addTask(7, new EntityAIAttackMelee(this, 1.0D, true));

  setSize(DEF_WIDTH, DEF_HEIGHT);
}
 
Example #5
Source File: EntityVampireBat.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
protected void initEntityAI() {
	tasks.addTask(2, new EntityAIAttackMelee(this, 0.4D, false));
	targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
	targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityToroNpc.class, true));
	targetTasks.addTask(4, new EntityAINearestAttackableTarget(this, EntityVillager.class, false));
	targetTasks.addTask(5, new EntityAINearestAttackableTarget(this, EntityAnimal.class, false));
}
 
Example #6
Source File: EntitySentry.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
protected void initEntityAI() {
	tasks.addTask(0, new EntityAISwimming(this));
	tasks.addTask(2, new EntityAIAttackMelee(this, 0.5D, false));
	tasks.addTask(7, new EntityAIWander(this, 0.35D));
	tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
	tasks.addTask(8, new EntityAILookIdle(this));

	targetTasks.addTask(2, new EntityAINearestAttackableCivTarget(this));
	targetTasks.addTask(3, new EntityAINearestAttackableTarget<EntityMob>(this, EntityMob.class, 2, false, false, new Predicate<EntityMob>() {
		@Override
		public boolean apply(EntityMob target) {
			return !(target instanceof EntityCreeper);
		}
	}));
}
 
Example #7
Source File: EntityBas.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
protected void ai() {
	tasks.addTask(1, new EntityAISwimming(this));
	tasks.addTask(2, new EntityAIAttackMelee(this, 0.5D, false));
	tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
	tasks.addTask(3, new EntityAILookIdle(this));
	targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0]));
	targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
}
 
Example #8
Source File: EntityRainbowGuard.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
protected void ai() {
	tasks.addTask(1, new EntityAISwimming(this));
	tasks.addTask(2, new EntityAIAtAttention(this));
	tasks.addTask(4, new EntityAIAttackMelee(this, 0.5D, false));
	tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
	tasks.addTask(5, new EntityAILookIdle(this));
	targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0]));
	targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
}
 
Example #9
Source File: EntityToro.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
protected void initEntityAI() {
	this.tasks.addTask(0, new EntityAISwimming(this));
	this.tasks.addTask(1, new EntityAIPanic(this, 2.0D));
	this.tasks.addTask(2, new EntityAIAttackMelee(this, 1.75, false));
	this.tasks.addTask(5, new EntityAIWander(this, 1.0D));
	this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
	this.tasks.addTask(7, new EntityAILookIdle(this));

}
 
Example #10
Source File: EntityEndermanFighter.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected void initEntityAI()
{
    this.tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(2, new EntityAIAttackMelee(this, 1.0D, false));
    this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(8, new EntityAILookIdle(this));
    this.tasks.addTask(6, new EntityEndermanFighter.AIDespawn(this, 200));

    this.targetTasks.addTask(1, new EntityEndermanFighter.AIAttackAssignedTarget(this, true));
    this.targetTasks.addTask(2, new EntityEndermanFighter.AIAttackRevengeTarget(this, false));
    this.targetTasks.addTask(3, new EntityEndermanFighter.AIAttackClosestPlayer(this, false));
}
 
Example #11
Source File: EntityFallenMount.java    From EnderZoo with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
public EntityFallenMount(World world) {
  super(world);
  setGrowingAge(0);
  setHorseSaddled(true);

  tasks.taskEntries.clear();
  tasks.addTask(0, new EntityAISwimming(this));
  tasks.addTask(6, new EntityAIWander(this, 1.2D));
  tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
  tasks.addTask(8, new EntityAILookIdle(this));

  findTargetAI = new EntityAINearestAttackableTarget<EntityPlayer>(this, EntityPlayer.class, true);
  attackAI = new EntityAIAttackMelee(this, MOUNTED_ATTACK_MOVE_SPEED, false);
  updateAttackAI(); 
}