use of net.minecraft.entity.monster.EntityZombie in project Wizardry by TeamWizardry.
the class EntityAINearestAttackableTargetFiltered method shouldExecute.
/**
* Returns whether the EntityAIBase should begin execution.
*/
@SuppressWarnings("unchecked")
public boolean shouldExecute() {
if (this.targetChance > 0 && this.taskOwner.getRNG().nextInt(this.targetChance) != 0) {
return false;
} else if (this.targetClass != EntityPlayer.class && this.targetClass != EntityPlayerMP.class) {
List<T> list = this.taskOwner.world.getEntitiesWithinAABB(this.targetClass, this.getTargetableArea(this.getTargetDistance()), this.targetEntitySelector);
if (list.isEmpty()) {
return false;
} else {
list.sort(this.sorter);
this.targetEntity = list.get(0);
return true;
}
} else {
this.targetEntity = (T) this.taskOwner.world.getNearestAttackablePlayer(this.taskOwner.posX, this.taskOwner.posY + (double) this.taskOwner.getEyeHeight(), this.taskOwner.posZ, this.getTargetDistance(), this.getTargetDistance(), new Function<EntityPlayer, Double>() {
@Nullable
public Double apply(@Nullable EntityPlayer p_apply_1_) {
ItemStack itemstack = p_apply_1_.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
if (itemstack.getItem() == Items.SKULL) {
int i = itemstack.getItemDamage();
boolean flag = EntityAINearestAttackableTargetFiltered.this.taskOwner instanceof EntitySkeleton && i == 0;
boolean flag1 = EntityAINearestAttackableTargetFiltered.this.taskOwner instanceof EntityZombie && i == 2;
boolean flag2 = EntityAINearestAttackableTargetFiltered.this.taskOwner instanceof EntityCreeper && i == 4;
if (flag || flag1 || flag2) {
return Double.valueOf(0.5D);
}
}
return Double.valueOf(1.0D);
}
}, (Predicate<EntityPlayer>) this.targetEntitySelector);
return this.targetEntity != null;
}
}
use of net.minecraft.entity.monster.EntityZombie in project BloodMagic by WayofTime.
the class ImperfectRitualZombie method onActivate.
@Override
public boolean onActivate(IImperfectRitualStone imperfectRitualStone, EntityPlayer player) {
EntityZombie zombie = new EntityZombie(imperfectRitualStone.getRitualWorld());
zombie.setPosition(imperfectRitualStone.getRitualPos().getX() + 0.5, imperfectRitualStone.getRitualPos().getY() + 2.1, imperfectRitualStone.getRitualPos().getZ() + 0.5);
zombie.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 2000));
zombie.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 20000, 7));
zombie.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 20000, 3));
if (!imperfectRitualStone.getRitualWorld().isRemote)
imperfectRitualStone.getRitualWorld().spawnEntity(zombie);
return true;
}
Aggregations