use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.
the class Haste method applyEffectEntity.
@Override
public boolean applyEffectEntity(ItemStack stack, World world, EntityLivingBase caster, Entity target) {
if (target instanceof EntityLivingBase) {
int duration = SpellUtils.instance.getModifiedInt_Mul(BuffList.default_buff_duration, stack, caster, target, world, 0, SpellModifiers.DURATION);
duration = SpellUtils.instance.modifyDurationBasedOnArmor(caster, duration);
int x = (int) Math.floor(target.posX);
int y = (int) Math.floor(target.posY);
int z = (int) Math.floor(target.posZ);
if (RitualShapeHelper.instance.checkForRitual(this, world, x, y, z) != null) {
duration += (3600 * (SpellUtils.instance.countModifiers(SpellModifiers.BUFF_POWER, stack, 0) + 1));
RitualShapeHelper.instance.consumeRitualReagents(this, world, x, y, z);
}
if (!world.isRemote)
((EntityLivingBase) target).addPotionEffect(new BuffEffectHaste(duration, SpellUtils.instance.countModifiers(SpellModifiers.BUFF_POWER, stack, 0)));
return true;
}
return false;
}
use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.
the class BossSpawnHelper method tick.
public void tick() {
ticksSinceLastDryadDeath++;
if (ticksSinceLastDryadDeath >= 400) {
ticksSinceLastDryadDeath = 0;
dryadsKilled = 0;
}
for (EntityLivingBase ent : queuedBosses.keySet()) {
World world = queuedBosses.get(ent);
if (!world.isRemote) {
world.spawnEntityInWorld(ent);
onBossSpawn(ent, world, (int) Math.floor(ent.posX), (int) Math.floor(ent.posY), (int) Math.floor(ent.posZ));
}
}
queuedBosses.clear();
}
use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.
the class EntityAISummonFollowOwner method getOwner.
private EntityLivingBase getOwner() {
int entityID = EntityUtilities.getOwner(theSummon);
if (entityID == -1)
return null;
Entity e = theSummon.worldObj.getEntityByID(entityID);
if (e instanceof EntityLivingBase)
return (EntityLivingBase) e;
return null;
}
use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.
the class EntitySpellProjectile method findHomingTarget.
private void findHomingTarget() {
List<EntityLivingBase> entities = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(this.posX - 15, this.posY - 15, this.posZ - 15, this.posX + 15, this.posY + 15, this.posZ + 15));
EntityLivingBase closest = null;
double curShortestDistance = 900;
AMVector3 me = new AMVector3(this);
for (EntityLivingBase e : entities) {
if (e == this.getShootingEntity())
continue;
double distance = new AMVector3(e).distanceSqTo(me);
if (distance < curShortestDistance) {
curShortestDistance = distance;
closest = e;
}
}
if (closest != null) {
setHomingTarget(closest);
}
}
use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.
the class EntitySpellProjectile method getHomingEntity.
private EntityLivingBase getHomingEntity() {
int entityID = this.dataWatcher.getWatchableObjectInt(DW_HOMING_TARGET);
Entity e = this.worldObj.getEntityByID(entityID);
if (e != null && e instanceof EntityLivingBase)
return (EntityLivingBase) e;
return null;
}
Aggregations