Search in sources :

Example 1 with EntitySpellProjectile

use of com.teamwizardry.wizardry.common.entity.EntitySpellProjectile in project Wizardry by TeamWizardry.

the class ModuleShapeProjectile method run.

@Override
public boolean run(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
    World world = spell.world;
    if (world.isRemote)
        return true;
    Vec3d origin = spell.getOriginWithFallback();
    if (origin == null)
        return false;
    double dist = spellRing.getAttributeValue(AttributeRegistry.RANGE, spell);
    double speed = spellRing.getAttributeValue(AttributeRegistry.SPEED, spell);
    EntitySpellProjectile proj = new EntitySpellProjectile(world, spellRing, spell, dist, speed, 0.1);
    proj.setPosition(origin.x, origin.y, origin.z);
    proj.velocityChanged = true;
    if (!spellRing.taxCaster(spell))
        return false;
    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;
}
Also used : EntitySpellProjectile(com.teamwizardry.wizardry.common.entity.EntitySpellProjectile) BlockPos(net.minecraft.util.math.BlockPos) World(net.minecraft.world.World) Vec3d(net.minecraft.util.math.Vec3d)

Aggregations

EntitySpellProjectile (com.teamwizardry.wizardry.common.entity.EntitySpellProjectile)1 BlockPos (net.minecraft.util.math.BlockPos)1 Vec3d (net.minecraft.util.math.Vec3d)1 World (net.minecraft.world.World)1