use of com.teamwizardry.librarianlib.features.particle.ParticleBuilder in project Wizardry by TeamWizardry.
the class EntityJumpPad method onUpdate.
@Override
public void onUpdate() {
super.onUpdate();
if (ticksExisted > 100)
setDead();
ClientRunnable.run(new ClientRunnable() {
@Override
@SideOnly(Side.CLIENT)
public void runIfClient() {
ParticleBuilder glitter = new ParticleBuilder(RandUtil.nextInt(30, 50));
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.setAlphaFunction(new InterpFadeInOut(0.9f, 0.9f));
glitter.enableMotionCalculation();
Color color1 = new Color(RandUtil.nextInt(100, 255), RandUtil.nextInt(100, 255), RandUtil.nextInt(100, 255), RandUtil.nextInt(100, 255));
Color color2 = new Color(RandUtil.nextInt(100, 255), RandUtil.nextInt(100, 255), RandUtil.nextInt(100, 255), RandUtil.nextInt(100, 255));
glitter.setCollision(true);
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(getPositionVector()), 1, 1, (i, build) -> {
if (RandUtil.nextBoolean())
glitter.setColor(color1);
else
glitter.setColor(color2);
double theta = 2.0f * (float) Math.PI * RandUtil.nextFloat();
double r = 1 * RandUtil.nextFloat();
double x = r * MathHelper.cos((float) theta);
double z = r * MathHelper.sin((float) theta);
glitter.setPositionOffset(new Vec3d(x, 0.3, z));
if (RandUtil.nextBoolean())
glitter.setMotion(new Vec3d(0, RandUtil.nextDouble(0.2), 0));
});
if (RandUtil.nextInt(30) == 0)
LibParticles.AIR_THROTTLE(world, getPositionVector(), new Vec3d(0, RandUtil.nextDouble(0.5), 0), color1, color2, 0.5);
}
});
}
use of com.teamwizardry.librarianlib.features.particle.ParticleBuilder in project Wizardry by TeamWizardry.
the class ModuleEffectZoom method render.
@Override
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
World world = spell.world;
Entity entity = spell.getVictim();
if (entity == null)
return;
Vec3d origin = spell.getData(ORIGINAL_LOC);
if (origin == null)
return;
Vec3d to = entity.getPositionVector();
ParticleBuilder glitter = new ParticleBuilder(10);
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.setAlphaFunction(new InterpFadeInOut(0.0f, 0.3f));
glitter.enableMotionCalculation();
glitter.disableRandom();
glitter.setCollision(true);
glitter.setTick(particle -> {
if (particle.getAge() >= particle.getLifetime() / RandUtil.nextDouble(2, 5)) {
if (particle.getAcceleration().y == 0)
particle.setAcceleration(new Vec3d(0, RandUtil.nextDouble(-0.05, -0.01), 0));
} else if (particle.getAcceleration().x != 0 || particle.getAcceleration().y != 0 || particle.getAcceleration().z != 0) {
particle.setAcceleration(Vec3d.ZERO);
}
});
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(origin.addVector(0, entity.height / 2.0, 0)), 10, 0, (aFloat, particleBuilder) -> {
glitter.setPositionOffset(new Vec3d(RandUtil.nextDouble(-0.5, 0.5), RandUtil.nextDouble(-0.5, 0.5), RandUtil.nextDouble(-0.5, 0.5)));
ParticleSpawner.spawn(glitter, world, new InterpLine(origin.add(particleBuilder.getPositionOffset()), to.add(particleBuilder.getPositionOffset()).addVector(0, entity.height / 2.0, 0)), (int) origin.distanceTo(to) * 5, 0, (aFloat2, particleBuilder2) -> {
glitter.setAlpha(RandUtil.nextFloat(0.5f, 0.8f));
glitter.setScale(RandUtil.nextFloat(0.3f, 0.6f));
glitter.setLifetime(RandUtil.nextInt(30, 50));
glitter.setColorFunction(new InterpColorHSV(getPrimaryColor(), getSecondaryColor()));
glitter.setAlphaFunction(new InterpFadeInOut(0f, 1f));
});
});
}
use of com.teamwizardry.librarianlib.features.particle.ParticleBuilder in project Wizardry by TeamWizardry.
the class ModuleEffectAntiGravityWell method render.
@Override
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
Vec3d position = spell.getData(ORIGIN);
if (position == null)
return;
if (RandUtil.nextInt(10) != 0)
return;
ParticleBuilder glitter = new ParticleBuilder(0);
glitter.setColorFunction(new InterpColorHSV(getPrimaryColor(), getSecondaryColor()));
ParticleSpawner.spawn(glitter, spell.world, new StaticInterp<>(position), 5, 0, (aFloat, particleBuilder) -> {
glitter.setScale((float) RandUtil.nextDouble(0.3, 1));
glitter.setAlphaFunction(new InterpFadeInOut(0.3f, (float) RandUtil.nextDouble(0.6, 1)));
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.setLifetime(RandUtil.nextInt(20, 40));
glitter.setScaleFunction(new InterpScale(1, 0));
if (RandUtil.nextBoolean())
glitter.setPositionFunction(new InterpHelix(new Vec3d(0, 0, 0), new Vec3d(0, 2, 0), 0.5f, 0, 1, RandUtil.nextFloat()));
else
glitter.setPositionFunction(new InterpHelix(new Vec3d(0, 0, 0), new Vec3d(0, -2, 0), 0.5f, 0, 1, RandUtil.nextFloat()));
});
}
use of com.teamwizardry.librarianlib.features.particle.ParticleBuilder in project Wizardry by TeamWizardry.
the class ModuleEffectBackup 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(1);
glitter.setAlphaFunction(new InterpFadeInOut(0.0f, 0.1f));
glitter.setColorFunction(new InterpColorHSV(getPrimaryColor(), getSecondaryColor()));
glitter.enableMotionCalculation();
glitter.setScaleFunction(new InterpScale(1, 0));
glitter.setAcceleration(new Vec3d(0, -0.05, 0));
glitter.setCollision(true);
glitter.setCanBounce(true);
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(position), RandUtil.nextInt(20, 30), 0, (aFloat, particleBuilder) -> {
if (RandUtil.nextInt(5) == 0) {
glitter.setRenderNormalLayer(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
} else {
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
}
glitter.setScale(RandUtil.nextFloat());
glitter.setLifetime(RandUtil.nextInt(50, 100));
glitter.addMotion(new Vec3d(RandUtil.nextDouble(-0.05, 0.05), RandUtil.nextDouble(0.01, 0.05), RandUtil.nextDouble(-0.05, 0.05)));
});
}
use of com.teamwizardry.librarianlib.features.particle.ParticleBuilder in project Wizardry by TeamWizardry.
the class TileUnicornTrail method update.
@Override
public void update() {
RandUtilSeed seed = new RandUtilSeed(getPos().toLong());
if (System.currentTimeMillis() - savedTime >= seed.nextInt(3000, 5000)) {
getWorld().setBlockToAir(getPos());
} else {
if (RandUtil.nextInt(20) == 0)
ClientRunnable.run(new ClientRunnable() {
@Override
@SideOnly(Side.CLIENT)
public void runIfClient() {
ParticleBuilder builder = new ParticleBuilder(50);
builder.setRender(new ResourceLocation(Wizardry.MODID, SPARKLE_BLURRED));
builder.disableMotionCalculation();
builder.setAlphaFunction(new InterpFadeInOut(0.3f, 0f));
builder.setScaleFunction(new InterpScale(0.3f, 0f));
ParticleSpawner.spawn(builder, world, new StaticInterp<>(new Vec3d(getPos()).addVector(0.5, 0.5, 0.5)), 2, 0, (aFloat, particleBuilder) -> {
particleBuilder.setPositionOffset(new Vec3d(RandUtil.nextDouble(-0.5, 0.5), RandUtil.nextDouble(-0.5, 0.5), RandUtil.nextDouble(-0.5, 0.5)));
particleBuilder.setMotion(new Vec3d(RandUtil.nextDouble(-0.1, 0.1), RandUtil.nextDouble(-0.1, 0.1), RandUtil.nextDouble(-0.1, 0.1)));
});
}
});
}
}
Aggregations