use of com.teamwizardry.wizardry.api.util.interp.InterpScale 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.wizardry.api.util.interp.InterpScale 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.wizardry.api.util.interp.InterpScale 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)));
});
}
});
}
}
use of com.teamwizardry.wizardry.api.util.interp.InterpScale in project Wizardry by TeamWizardry.
the class ModuleShapeZone method render.
@Override
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
Vec3d target = spell.getTarget();
if (target == null)
return;
if (RandUtil.nextInt(10) != 0)
return;
double aoe = spellRing.getAttributeValue(AttributeRegistry.AREA, spell);
ParticleBuilder glitter = new ParticleBuilder(10);
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.setScaleFunction(new InterpScale(1, 0));
glitter.setCollision(true);
ParticleSpawner.spawn(glitter, spell.world, new InterpCircle(target, new Vec3d(0, 1, 0), (float) aoe, 1, RandUtil.nextFloat()), (int) (aoe * 5), 0, (aFloat, particleBuilder) -> {
glitter.setAlphaFunction(new InterpFadeInOut(0.3f, 0.3f));
glitter.setLifetime(RandUtil.nextInt(10, 20));
if (RandUtil.nextBoolean()) {
glitter.setColor(getPrimaryColor());
} else {
glitter.setColor(getSecondaryColor());
}
glitter.addMotion(new Vec3d(RandUtil.nextDouble(-0.001, 0.001), RandUtil.nextDouble(-0.1, 0.1), RandUtil.nextDouble(-0.001, 0.001)));
});
}
use of com.teamwizardry.wizardry.api.util.interp.InterpScale in project Wizardry by TeamWizardry.
the class PacketDevilDustFizzle method handle.
@Override
public void handle(MessageContext messageContext) {
if (messageContext.side.isServer())
return;
World world = LibrarianLib.PROXY.getClientPlayer().world;
if (world == null)
return;
ClientRunnable.run(new ClientRunnable() {
@Override
@SideOnly(Side.CLIENT)
public void runIfClient() {
ParticleBuilder glitter = new ParticleBuilder(30);
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.setMotionCalculationEnabled(true);
glitter.setCollision(true);
glitter.setCanBounce(true);
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), 15, RandUtil.nextInt(10), (i, builder) -> {
builder.setAcceleration(new Vec3d(0, RandUtil.nextDouble(-0.05, -0.01), 0));
builder.setColor(new Color(RandUtil.nextFloat(0.9f, 1), RandUtil.nextFloat(0, 0.25f), 0));
builder.setAlphaFunction(new InterpFadeInOut(0.0f, RandUtil.nextFloat(1f, 0.3f)));
builder.setScaleFunction(new InterpScale(RandUtil.nextFloat(0.3f, 1f), RandUtil.nextFloat(0, 0.2f)));
Vec3d offset = new Vec3d(RandUtil.nextDouble(-0.3, 0.3), RandUtil.nextDouble(-0.3, 0), RandUtil.nextDouble(-0.3, 0.3));
builder.setPositionOffset(offset);
builder.setLifetime(RandUtil.nextInt(20, 60));
builder.setMotion(new Vec3d(RandUtil.nextDouble(-0.1, 0.1), RandUtil.nextDouble(0.1, 0.5), RandUtil.nextDouble(-0.1, 0.1)));
});
}
});
}
Aggregations