use of net.minecraft.entity.ai.EntityAIHurtByTarget in project ArsMagica2 by Mithion.
the class AM2Boss method initAI.
/**
* This contains the default AI tasks. To add new ones, override {@link #initSpecificAI()}
*/
protected void initAI() {
this.getNavigator().setBreakDoors(true);
this.tasks.addTask(0, new EntityAISwimming(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, EntityLightMage.class, 0, true));
initSpecificAI();
}
use of net.minecraft.entity.ai.EntityAIHurtByTarget in project ArsMagica2 by Mithion.
the class EntityUtilities method makeSummon_PlayerFaction.
public static void makeSummon_PlayerFaction(EntityCreature entityliving, EntityPlayer player, boolean storeForRevert) {
if (isAIEnabled(entityliving) && !(entityliving instanceof IBossDisplayData) && ExtendedProperties.For(player).getCanHaveMoreSummons()) {
if (storeForRevert)
storedTasks.put(entityliving.getEntityId(), new ArrayList(entityliving.targetTasks.taskEntries));
boolean addMeleeAttack = false;
ArrayList<EntityAITaskEntry> toRemove = new ArrayList<EntityAITaskEntry>();
for (Object task : entityliving.tasks.taskEntries) {
EntityAITaskEntry base = (EntityAITaskEntry) task;
if (base.action instanceof EntityAIAttackOnCollide) {
toRemove.add(base);
addMeleeAttack = true;
}
}
entityliving.tasks.taskEntries.removeAll(toRemove);
if (storeForRevert)
storedAITasks.put(entityliving.getEntityId(), toRemove);
if (addMeleeAttack) {
float speed = entityliving.getAIMoveSpeed();
if (speed <= 0)
speed = 1.0f;
entityliving.tasks.addTask(3, new EntityAIAttackOnCollide(entityliving, EntityMob.class, speed, true));
entityliving.tasks.addTask(3, new EntityAIAttackOnCollide(entityliving, IMob.class, speed, true));
entityliving.tasks.addTask(3, new EntityAIAttackOnCollide(entityliving, EntitySlime.class, speed, true));
}
entityliving.targetTasks.taskEntries.clear();
entityliving.targetTasks.addTask(1, new EntityAIHurtByTarget(entityliving, true));
entityliving.targetTasks.addTask(2, new EntityAINearestAttackableTarget(entityliving, EntityMob.class, 0, true, false, SummonEntitySelector.instance));
entityliving.targetTasks.addTask(2, new EntityAINearestAttackableTarget(entityliving, EntitySlime.class, 0, true));
entityliving.targetTasks.addTask(2, new EntityAINearestAttackableTarget(entityliving, EntityGhast.class, 0, true));
if (!entityliving.worldObj.isRemote && entityliving.getAttackTarget() != null && entityliving.getAttackTarget() instanceof EntityPlayer)
AMCore.proxy.addDeferredTargetSet(entityliving, null);
if (entityliving instanceof EntityTameable) {
((EntityTameable) entityliving).setTamed(true);
((EntityTameable) entityliving).func_152115_b(player.getCommandSenderName());
}
entityliving.getEntityData().setBoolean(isSummonKey, true);
ExtendedProperties.For(player).addSummon(entityliving);
}
}
use of net.minecraft.entity.ai.EntityAIHurtByTarget in project MorePlanets by SteveKunG.
the class EntityGiantWorm method initEntityAI.
@Override
protected void initEntityAI() {
this.tasks.addTask(1, new EntityAISwimming(this));
this.tasks.addTask(2, new EntityAIAttackMelee(this, 1.0D, false));
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget<>(this, EntityPlayer.class, true));
}
use of net.minecraft.entity.ai.EntityAIHurtByTarget in project ArsMagica2 by Mithion.
the class EntityUtilities method makeSummon_MonsterFaction.
public static void makeSummon_MonsterFaction(EntityCreature entityliving, boolean storeForRevert) {
if (isAIEnabled(entityliving) && !(entityliving instanceof IBossDisplayData)) {
if (storeForRevert)
storedTasks.put(entityliving.getEntityId(), new ArrayList(entityliving.targetTasks.taskEntries));
entityliving.targetTasks.taskEntries.clear();
entityliving.targetTasks.addTask(1, new EntityAIHurtByTarget(entityliving, true));
entityliving.targetTasks.addTask(2, new EntityAINearestAttackableTarget(entityliving, EntityPlayer.class, 0, true));
if (!entityliving.worldObj.isRemote && entityliving.getAttackTarget() != null && entityliving.getAttackTarget() instanceof EntityMob)
AMCore.proxy.addDeferredTargetSet(entityliving, null);
entityliving.getEntityData().setBoolean(isSummonKey, true);
}
}
Aggregations