use of com.teamwizardry.wizardry.common.entity.projectile.EntitySpellProjectile in project Wizardry by TeamWizardry.
the class ModuleShapeProjectile method run.
/**
* {@inheritDoc}
*/
@Override
public boolean run(@NotNull World world, ModuleInstanceShape instance, @Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
if (world.isRemote)
return true;
Vec3d origin = spell.getOriginWithFallback(world);
if (origin == null)
return false;
double dist = spellRing.getAttributeValue(world, AttributeRegistry.RANGE, spell);
double speed = spellRing.getAttributeValue(world, AttributeRegistry.SPEED, spell);
if (!spellRing.taxCaster(world, spell, true))
return false;
IShapeOverrides overrides = spellRing.getOverrideHandler().getConsumerInterface(IShapeOverrides.class);
EntitySpellProjectile proj = new EntitySpellProjectile(world, spellRing, spell, (float) dist, (float) speed, (float) 0.1, !overrides.onRunProjectile(world, spell, spellRing));
proj.setPosition(origin.x, origin.y, origin.z);
proj.velocityChanged = true;
boolean success = world.spawnEntity(proj);
if (success)
world.playSound(null, new BlockPos(origin), ModSounds.PROJECTILE_LAUNCH, SoundCategory.PLAYERS, 1f, (float) RandUtil.nextDouble(1, 1.5));
return success;
}
Aggregations