use of com.teamwizardry.wizardry.common.entity.EntityBackupZombie in project Wizardry by TeamWizardry.
the class ModuleEffectBackup method run.
@Override
@SuppressWarnings("unused")
public boolean run(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
World world = spell.world;
Entity targetEntity = spell.getVictim();
Vec3d targetPos = spell.getTarget();
EnumFacing facing = spell.getData(FACE_HIT);
Entity caster = spell.getCaster();
double range = spellRing.getAttributeValue(AttributeRegistry.AREA, spell) / 2.0;
double time = spellRing.getAttributeValue(AttributeRegistry.DURATION, spell);
if (!spellRing.taxCaster(spell))
return false;
if (targetPos == null)
return true;
if (!(caster instanceof EntityLivingBase))
return true;
if (facing != null && !world.isAirBlock(new BlockPos(targetPos))) {
targetPos = new Vec3d(new BlockPos(targetPos).offset(facing)).addVector(0.5, 0.5, 0.5);
}
EntityBackupZombie zombie = new EntityBackupZombie(world, (EntityLivingBase) caster, (int) time);
zombie.setPosition(targetPos.x, targetPos.y, targetPos.z);
zombie.forceSpawn = true;
world.spawnEntity(zombie);
return true;
}
use of com.teamwizardry.wizardry.common.entity.EntityBackupZombie in project Wizardry by TeamWizardry.
the class ModuleEffectBackup method run.
@Override
public boolean run(@NotNull World world, ModuleInstanceEffect instance, @Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
if (world.isRemote)
return true;
Vec3d targetPos = spell.getTarget(world);
EnumFacing facing = spell.getData(FACE_HIT);
Entity caster = spell.getCaster(world);
double duration = spellRing.getAttributeValue(world, AttributeRegistry.DURATION, spell) * 20;
if (!spellRing.taxCaster(world, spell, true))
return false;
if (targetPos == null)
return true;
if (!(caster instanceof EntityLivingBase))
return true;
if (facing != null && !world.isAirBlock(new BlockPos(targetPos))) {
targetPos = new Vec3d(new BlockPos(targetPos).offset(facing)).add(0.5, 0.5, 0.5);
}
UUID player = caster.getUniqueID();
WizardryWorld world1 = WizardryWorldCapability.get(world);
if (world1 == null)
return true;
if (world1.getBackupCount(player) < ConfigValues.maxZombies) {
EntityBackupZombie zombie = new EntityBackupZombie(world, (EntityLivingBase) caster, (int) duration);
zombie.setPosition(targetPos.x, targetPos.y, targetPos.z);
zombie.forceSpawn = true;
world.spawnEntity(zombie);
world1.incBackupCount(player);
}
return true;
}
Aggregations