use of com.teamwizardry.librarianlib.features.particle.ParticleBuilder 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.ParticleBuilder 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));
});
}
use of com.teamwizardry.librarianlib.features.particle.ParticleBuilder in project Wizardry by TeamWizardry.
the class ModuleShapeTouch method render.
@Override
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
Entity targetEntity = spell.getVictim();
if (targetEntity == null)
return;
ParticleBuilder glitter = new ParticleBuilder(1);
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
ParticleSpawner.spawn(glitter, spell.world, new InterpCircle(targetEntity.getPositionVector().addVector(0, targetEntity.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));
});
}
use of com.teamwizardry.librarianlib.features.particle.ParticleBuilder in project Wizardry by TeamWizardry.
the class TileManaInteracter method suckManaFrom.
public boolean suckManaFrom(TileManaInteracter interacterFrom, SuckRule suckRule) {
if (getWizardryCap() == null || interacterFrom.getWizardryCap() == null)
return false;
if (!isAllowOutsideSucking() && interacterFrom.isAllowOutsideSucking())
return false;
if (!suckRule.condition.test(this, interacterFrom))
return false;
CapManager thisManager = new CapManager(getWizardryCap());
CapManager theirManager = new CapManager(interacterFrom.getWizardryCap());
if (thisManager.isManaFull())
return false;
if (theirManager.isManaEmpty())
return false;
if (suckRule.equalize && Math.abs(thisManager.getMana() - theirManager.getMana()) <= suckRule.idealAmount)
return false;
Vec3d thisPos = new Vec3d(getPos()).addVector(0.5, 0.5, 0.5);
Vec3d theirPos = new Vec3d(interacterFrom.getPos()).addVector(0.5, 0.5, 0.5);
// DEBUG
// ParticleBuilder helix = new ParticleBuilder(200);
// helix.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
// helix.setAlphaFunction(new InterpFadeInOut(0.1f, 0.1f));
// ParticleSpawner.spawn(helix, world, new StaticInterp<>(thisPos), 1, 0, (someFloat, particleBuilder) -> {
// particleBuilder.setColor(ColorUtils.changeColorAlpha(new Color(0xFF0000), RandUtil.nextInt(50, 200)));
// particleBuilder.setScale(RandUtil.nextFloat(0.3f, 0.8f));
// particleBuilder.disableRandom();
// particleBuilder.setPositionFunction(new InterpLine(Vec3d.ZERO, theirPos.subtract(thisPos)));
// particleBuilder.setLifetime(RandUtil.nextInt(50, 60));
// });
double ratio = theirManager.getMana() / thisManager.getMana();
if (suckRule.equalize && Double.isFinite(ratio) && ratio <= 1.2)
return false;
if (getCachedDistanceSq(interacterFrom) > ConfigValues.networkLinkDistance * ConfigValues.networkLinkDistance)
return false;
if (!suckRule.ignoreTrace) {
Vec3d thisSub = theirPos.subtract(thisPos.add(getOffset()));
Vec3d thisNorm = thisSub.normalize();
RayTraceResult trace = new RayTrace(world, thisNorm, thisPos.add(getOffset() == Vec3d.ZERO ? thisNorm : getOffset()), ConfigValues.networkLinkDistance * ConfigValues.networkLinkDistance).setSkipEntities(true).setIgnoreBlocksWithoutBoundingBoxes(true).trace();
if (!trace.getBlockPos().equals(interacterFrom.getPos()))
return false;
}
double amount = interacterFrom.drainMana(suckRule.idealAmount);
if (amount <= 0)
return false;
thisManager.addMana(amount);
ClientRunnable.run(new ClientRunnable() {
@Override
@SideOnly(Side.CLIENT)
public void runIfClient() {
ParticleBuilder helix = new ParticleBuilder(200);
helix.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
helix.setAlphaFunction(new InterpFadeInOut(0.1f, 0.1f));
ParticleSpawner.spawn(helix, world, new StaticInterp<>(new Vec3d(interacterFrom.getPos()).addVector(0.5, 1, 0.5)), 1, 0, (someFloat, particleBuilder) -> {
particleBuilder.setColor(ColorUtils.changeColorAlpha(new Color(0x0097FF), RandUtil.nextInt(50, 200)));
particleBuilder.setScale(RandUtil.nextFloat(0.3f, 0.8f));
particleBuilder.setPositionFunction(new InterpBezier3D(Vec3d.ZERO, new Vec3d(getPos().subtract(interacterFrom.getPos())), new Vec3d(0, 5, 0), new Vec3d(0, -5, 0)));
particleBuilder.setLifetime(RandUtil.nextInt(50, 60));
});
}
});
return true;
}
use of com.teamwizardry.librarianlib.features.particle.ParticleBuilder in project Wizardry by TeamWizardry.
the class Arena method tick.
public void tick(long timeMillis) {
if (timeMillis % 500 == 0)
ClientRunnable.run(new ClientRunnable() {
@Override
@SideOnly(Side.CLIENT)
public void runIfClient() {
ParticleBuilder glitter = new ParticleBuilder(10);
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.setAlphaFunction(new InterpFadeInOut(0.3f, 0.3f));
glitter.setCollision(true);
glitter.enableMotionCalculation();
ParticleSpawner.spawn(glitter, getWorld(), new InterpCircle(new Vec3d(getCenter()).addVector(0.5, getHeight(), 0.5), new Vec3d(0, 1, 0), (float) getRadius(), 1, RandUtil.nextFloat()), 10, RandUtil.nextInt(10), (aFloat, particleBuilder) -> {
particleBuilder.setColor(ColorUtils.changeColorAlpha(new Color(0x0097FF), RandUtil.nextInt(100, 255)));
particleBuilder.setScale(RandUtil.nextFloat(0.5f, 1));
particleBuilder.addMotion(new Vec3d(RandUtil.nextDouble(-0.01, 0.01), RandUtil.nextDouble(-0.01, 0.01), RandUtil.nextDouble(-0.01, 0.01)));
particleBuilder.setLifetime(RandUtil.nextInt(30, 60));
});
glitter.disableMotionCalculation();
ParticleSpawner.spawn(glitter, getWorld(), new InterpCircle(new Vec3d(getCenter()).addVector(0.5, 0, 0.5), new Vec3d(0, 1, 0), (float) getRadius(), 1, RandUtil.nextFloat()), 10, RandUtil.nextInt(10), (aFloat, particleBuilder) -> {
particleBuilder.setColor(ColorUtils.changeColorAlpha(new Color(0x0097FF), RandUtil.nextInt(100, 255)));
particleBuilder.setScale(RandUtil.nextFloat(0.5f, 1));
particleBuilder.addMotion(new Vec3d(RandUtil.nextDouble(-0.01, 0.01), RandUtil.nextDouble(0.01, 0.02), RandUtil.nextDouble(-0.01, 0.01)));
particleBuilder.setLifetime(RandUtil.nextInt(30, 60));
});
}
});
}
Aggregations