use of com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV 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 com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV in project Wizardry by TeamWizardry.
the class RenderSpellProjectile method doRender.
@Override
public void doRender(@Nonnull EntitySpellProjectile entity, double x, double y, double z, float entityYaw, float partialTicks) {
super.doRender(entity, x, y, z, entityYaw, partialTicks);
if (entity.spellRing != null)
for (SpellRing ring : SpellUtils.getAllSpellRings(entity.spellRing)) {
if (ring.overrideParentRenders()) {
return;
}
}
Color color = new Color(entity.getDataManager().get(DATA_COLOR), true);
Color color2 = new Color(entity.getDataManager().get(DATA_COLOR2), true);
ParticleBuilder glitter = new ParticleBuilder(10);
glitter.setAlphaFunction(new InterpFadeInOut(0f, 0.3f));
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.enableMotionCalculation();
glitter.setCollision(true);
glitter.setCanBounce(true);
glitter.setColorFunction(new InterpColorHSV(color, color2));
glitter.setAcceleration(new Vec3d(0, -0.015, 0));
ParticleSpawner.spawn(glitter, entity.world, new StaticInterp<>(entity.getPositionVector().add(new Vec3d(entity.motionX, entity.motionY, entity.motionZ))), 5, 0, (aFloat, particleBuilder) -> {
particleBuilder.setScaleFunction(new InterpScale((float) RandUtil.nextDouble(0.3, 0.8), 0));
particleBuilder.setLifetime(RandUtil.nextInt(40, 60));
particleBuilder.addMotion(new Vec3d(RandUtil.nextDouble(-0.03, 0.03), RandUtil.nextDouble(-0.01, 0.05), RandUtil.nextDouble(-0.03, 0.03)));
});
glitter.disableMotionCalculation();
glitter.setMotion(Vec3d.ZERO);
glitter.setLifetime(20);
glitter.setScaleFunction(new InterpFadeInOut(0f, 1f));
glitter.setAlphaFunction(new InterpFadeInOut(0f, 1f));
ParticleSpawner.spawn(glitter, entity.world, new StaticInterp<>(entity.getPositionVector()), 5, 0, (aFloat, particleBuilder) -> {
particleBuilder.setScale(RandUtil.nextFloat(0.5f, 2));
particleBuilder.setLifetime(RandUtil.nextInt(5, 10));
// particleBuilder.addMotion()
});
}
use of com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV in project Wizardry by TeamWizardry.
the class ModuleEffectSubstitution method render.
@Override
@SuppressWarnings("unused")
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
World world = spell.world;
Entity caster = spell.getCaster();
BlockPos targetBlock = spell.getTargetPos();
Entity targetEntity = spell.getVictim();
if (targetEntity != null && caster != null) {
ParticleBuilder glitter = new ParticleBuilder(RandUtil.nextInt(20, 30));
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.setColorFunction(new InterpColorHSV(getPrimaryColor(), getSecondaryColor()));
ParticleSpawner.spawn(glitter, spell.world, new StaticInterp<>(new Vec3d(targetEntity.posX, targetEntity.posY, targetEntity.posZ)), 50, RandUtil.nextInt(20, 30), (aFloat, particleBuilder) -> {
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));
glitter.setPositionFunction(new InterpHelix(new Vec3d(0, 0, 0), new Vec3d(0, 2, 0), 0.5f, 0f, 1, RandUtil.nextFloat()));
});
glitter.setColorFunction(new InterpColorHSV(getSecondaryColor(), getPrimaryColor()));
ParticleSpawner.spawn(glitter, spell.world, new StaticInterp<>(new Vec3d(caster.posX, caster.posY, caster.posZ)), 50, RandUtil.nextInt(20, 30), (aFloat, particleBuilder) -> {
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));
glitter.setPositionFunction(new InterpHelix(new Vec3d(0, 0, 0), new Vec3d(0, 4, 0), 1f, 0f, 1, RandUtil.nextFloat()));
});
} else if (targetBlock != null) {
ParticleBuilder glitter = new ParticleBuilder(RandUtil.nextInt(20, 30));
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.setColorFunction(new InterpColorHSV(getPrimaryColor(), getSecondaryColor()));
ParticleSpawner.spawn(glitter, spell.world, new StaticInterp<>(new Vec3d(targetBlock).addVector(0.5, 0.5, 0.5)), 20, RandUtil.nextInt(20, 30), (aFloat, particleBuilder) -> {
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));
glitter.setMotion(new Vec3d(RandUtil.nextDouble(-0.001, 0.001), RandUtil.nextDouble(-0.001, 0.001), RandUtil.nextDouble(-0.001, 0.001)));
});
}
}
use of com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV in project Wizardry by TeamWizardry.
the class ModuleEffectTelekinesis method render.
@Override
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
World world = spell.world;
Vec3d position = spell.getTarget();
if (position == null)
return;
ParticleBuilder glitter = new ParticleBuilder(50);
glitter.setColorFunction(new InterpColorHSV(getPrimaryColor(), getSecondaryColor()));
glitter.setScale(1);
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(position), 5, 0, (aFloat, particleBuilder) -> {
glitter.setLifetime(RandUtil.nextInt(10, 20));
glitter.setScale(RandUtil.nextFloat());
glitter.setScaleFunction(new InterpScale(1, 0));
glitter.setAlphaFunction(new InterpFadeInOut(0.3f, RandUtil.nextFloat()));
glitter.setMotion(new Vec3d(RandUtil.nextDouble(-0.1, 0.1), RandUtil.nextDouble(-0.1, 0.1), RandUtil.nextDouble(-0.1, 0.1)));
});
}
use of com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV in project Wizardry by TeamWizardry.
the class ModuleEffectTimeSlow method render.
@Override
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
World world = spell.world;
Vec3d position = spell.getTarget();
if (position == null)
return;
ParticleBuilder glitter = new ParticleBuilder(30);
glitter.setColorFunction(new InterpColorHSV(getPrimaryColor(), getSecondaryColor()));
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.disableRandom();
glitter.setScaleFunction(new InterpScale(1, 0));
glitter.setCollision(true);
glitter.enableMotionCalculation();
glitter.setAcceleration(new Vec3d(0, -0.001, 0));
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(position.addVector(0, 1, 0)), 3, 0, (aFloat, particleBuilder) -> {
glitter.setLifetime(RandUtil.nextInt(30, 40));
glitter.setScale(RandUtil.nextFloat());
glitter.setAlphaFunction(new InterpFadeInOut(0.5f, RandUtil.nextFloat()));
double radius = RandUtil.nextDouble(0, 1);
double theta = 2.0f * (float) Math.PI * RandUtil.nextFloat();
double r = radius * RandUtil.nextFloat();
double x = r * MathHelper.cos((float) theta);
double z = r * MathHelper.sin((float) theta);
Vec3d dest = new Vec3d(x, RandUtil.nextDouble(-radius, radius), z);
glitter.setPositionOffset(dest);
// glitter.setPositionFunction(new InterpSlowDown(Vec3d.ZERO, new Vec3d(0, RandUtil.nextDouble(-1, 1), 0)));
// glitter.setPositionFunction(new InterpBezier3D(Vec3d.ZERO, position.subtract(dest), dest.scale(2), new Vec3d(position.x, radius, position.z)));
});
}
Aggregations