Java Code Examples for net.minecraft.entity.ai.EntityAIHurtByTarget

The following examples show how to use net.minecraft.entity.ai.EntityAIHurtByTarget. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
@Override
public void setupGolem(EntityGolemBase golem) {
    WrappedGolem wrapped = new WrappedGolem(golem);

    golem.setHomeArea(0, 300000000, 0, 300000000);
    golem.setMarkers(new ArrayList<Marker>());

    golem.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(wrapped));
    golem.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(wrapped));
    golem.targetTasks.addTask(3, new EntityAIHurtByTarget(golem, true));

    golem.tasks.addTask(1, new AISit(golem));

    if (golem.decoration.contains("R")) {
        golem.tasks.addTask(2, new AIUncheckedDartAttack(golem));
    }
    golem.tasks.addTask(3, new AIUncheckedAttackOnCollide(golem));
    golem.tasks.addTask(4, new AIFollowOwner(wrapped, 5, 2));

    golem.tasks.addTask(5, new AIOpenDoor(golem, true));
    golem.tasks.addTask(7, new EntityAIWatchClosest(golem, EntityPlayer.class, 6.0F));
    golem.tasks.addTask(8, new EntityAILookIdle(golem));
}
 
Example 2
Source Project: TFC2   Source File: EntityElk.java    License: 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
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 Project: EnderZoo   Source File: EntityDireWolf.java    License: Creative Commons Zero v1.0 Universal 6 votes vote down vote up
public EntityDireWolf(World world) {
    super(world);
    setSize(0.8F, 1.2F);
    //getNavigator().setAvoidsWater(true);
//    ((PathNavigateGround) this.getNavigator()).setAvoidsWater(true);
    tasks.addTask(1, new EntityAISwimming(this));
    tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
    tasks.addTask(4, new EntityAIAttackOnCollideAggressive(this, 1.1D, true).setAttackFrequency(20));
    tasks.addTask(7, new EntityAIWander(this, 0.5D));
    tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    tasks.addTask(9, new EntityAILookIdle(this));
    targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));

    if(Config.direWolfAggresiveRange > 0) {      
      EntityAINearestAttackableTargetBounded<EntityPlayer> nearTarg = new EntityAINearestAttackableTargetBounded<EntityPlayer>(this, EntityPlayer.class, true);
      nearTarg.setMaxDistanceToTarget(Config.direWolfAggresiveRange);
      targetTasks.addTask(2, nearTarg);
    }
  }
 
Example 5
Source Project: ToroQuest   Source File: EntityMage.java    License: 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 EntityAIAttackRanged(this, 1.0D, 16, 10.0F));
	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 6
Source Project: ToroQuest   Source File: EntityBas.java    License: 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 7
Source Project: ToroQuest   Source File: EntityRainbowGuard.java    License: 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 8
Source Project: Et-Futurum   Source File: EntityEndermite.java    License: The Unlicense 5 votes vote down vote up
public EntityEndermite(World world) {
	super(world);
	sorter = new EntityAINearestAttackableTarget.Sorter(this);

	experienceValue = 3;
	setSize(0.4F, 0.3F);
	tasks.addTask(1, new EntityAISwimming(this));
	tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
	tasks.addTask(3, new EntityAIWander(this, 1.0D));
	tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
	tasks.addTask(8, new EntityAILookIdle(this));
	targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
	targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 10, true));
}
 
Example 9
protected void applyEntityAI() {
  this.tasks.addTask(4, new EntityHalloweenCow.AICowAttack(this));
  this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0]));
  targetTasks.addTask(2, new EntityAINearestAttackableTarget<EntityPlayer>
      (this, EntityPlayer.class, true));
  targetTasks.addTask(3, new EntityAINearestAttackableTarget<EntityVillager>
      (this, EntityVillager.class, false));
  targetTasks.addTask(3, new EntityAINearestAttackableTarget<EntityIronGolem>
      (this, EntityIronGolem.class, true));
}
 
Example 10
public EntityWitherWitch(World world) {
  super(world);
  rangedAttackAI = new EntityAIRangedAttack(this, 1, 60, 10);
  tasks.addTask(1, new EntityAISwimming(this));
  tasks.addTask(1, new EntityAISwimming(this));    
  tasks.addTask(2, rangedAttackAI);
  tasks.addTask(2, new EntityAIWander(this, 1.0D));
  tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
  tasks.addTask(3, new EntityAILookIdle(this));
  targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
  targetTasks.addTask(2, new EntityAINearestAttackableTarget<EntityPlayer>(this, EntityPlayer.class, true));
}
 
Example 11
Source Project: Artifacts   Source File: EntityClayGolem.java    License: MIT License 5 votes vote down vote up
public EntityClayGolem(World par1World)
{
    super(par1World);
    //this.moveSpeed = 0.16F;
    /*this.setSize(1.4F, 2.9F);
    this.getNavigator().setAvoidsWater(true);
    this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityPlayer.class, 0.288D, false));
    this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityZombie.class, 0.288D, true));
    this.tasks.addTask(3, new EntityAIMoveTowardsRestriction(this, 0.16D));
    this.tasks.addTask(4, new EntityAIWander(this, 0.16D));
    this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(6, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityZombie.class, 0, true));
    //this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true, true, IMob.mobSelector));
    //this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityZombie.class, 0, false, true, IMob.mobSelector));*/
    this.getNavigator().setAvoidsWater(true);
    this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
    this.tasks.addTask(3, new EntityAIAttackOnCollide(this, EntityVillager.class, 1.0D, true));
    this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D));
    this.tasks.addTask(5, new EntityAIMoveThroughVillage(this, 1.0D, false));
    this.tasks.addTask(6, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(7, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, 0, false));
}