use of net.minecraft.util.math.Vec3d in project Wizardry by TeamWizardry.
the class ModuleShapeBeam method render.
@Override
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
World world = spell.world;
Vec3d target = spell.getTargetWithFallback();
if (target == null)
return;
LibParticles.SHAPE_BEAM(world, target, spell.getOriginHand(), spellRing.getPrimaryColor());
}
use of net.minecraft.util.math.Vec3d in project Wizardry by TeamWizardry.
the class ModuleShapeBeam method run.
@Override
public boolean run(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) throws NullPointerException {
World world = spell.world;
Vec3d look = spell.getData(LOOK);
Vec3d position = spell.getOrigin();
Entity caster = spell.getCaster();
if (look == null || position == null)
return false;
double range = spellRing.getAttributeValue(AttributeRegistry.RANGE, spell);
double potency = 30 - spellRing.getAttributeValue(AttributeRegistry.POTENCY, spell);
spellRing.multiplyMultiplierForAll((float) (potency / 25.0 * range / 75.0));
RayTraceResult trace = new RayTrace(world, look, position, range).setSkipEntity(caster).setReturnLastUncollidableBlock(true).setIgnoreBlocksWithoutBoundingBoxes(true).trace();
spell.processTrace(trace, look.scale(range));
sendRenderPacket(spell, spellRing);
if (spell.world.getTotalWorldTime() % potency == 0) {
if (spellRing.getChildRing() != null) {
spellRing.getChildRing().runSpellRing(spell);
}
}
return true;
}
use of net.minecraft.util.math.Vec3d in project Wizardry by TeamWizardry.
the class ModuleShapeCone method render.
@Override
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
Vec3d target = spell.getTarget();
if (target == null)
return;
Vec3d origin = spell.getOriginHand();
if (origin == null)
return;
ParticleBuilder lines = new ParticleBuilder(10);
lines.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
lines.setScaleFunction(new InterpScale(0.5f, 0));
lines.setColorFunction(new InterpColorHSV(spellRing.getPrimaryColor(), spellRing.getSecondaryColor()));
ParticleSpawner.spawn(lines, spell.world, new InterpLine(origin, target), (int) target.distanceTo(origin) * 4, 0, (aFloat, particleBuilder) -> {
lines.setAlphaFunction(new InterpFadeInOut(0.3f, 0.3f));
lines.setLifetime(RandUtil.nextInt(10, 20));
});
}
use of net.minecraft.util.math.Vec3d 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;
}
use of net.minecraft.util.math.Vec3d in project Wizardry by TeamWizardry.
the class ModuleShapeSelf method render.
@Override
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
Entity caster = spell.getCaster();
if (caster == null)
return;
ParticleBuilder glitter = new ParticleBuilder(1);
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
ParticleSpawner.spawn(glitter, spell.world, new InterpCircle(caster.getPositionVector().addVector(0, caster.height / 2.0, 0), new Vec3d(0, 1, 0), 1, 10), 50, RandUtil.nextInt(10, 15), (aFloat, particleBuilder) -> {
if (RandUtil.nextBoolean()) {
glitter.setColor(getPrimaryColor());
glitter.setMotion(new Vec3d(0, RandUtil.nextDouble(0.01, 0.1), 0));
} else {
glitter.setColor(getSecondaryColor());
glitter.setMotion(new Vec3d(0, RandUtil.nextDouble(-0.1, -0.01), 0));
}
glitter.setLifetime(RandUtil.nextInt(20, 30));
glitter.setScale((float) RandUtil.nextDouble(0.3, 1));
glitter.setAlphaFunction(new InterpFadeInOut(0.3f, (float) RandUtil.nextDouble(0.6, 1)));
glitter.setLifetime(RandUtil.nextInt(10, 20));
glitter.setScaleFunction(new InterpScale(1, 0));
});
}
Aggregations