Search in sources :

Example 1 with InterpScale

use of com.teamwizardry.wizardry.api.util.interp.InterpScale 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));
    });
}
Also used : InterpColorHSV(com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV) InterpScale(com.teamwizardry.wizardry.api.util.interp.InterpScale) InterpLine(com.teamwizardry.librarianlib.features.math.interpolate.position.InterpLine) ResourceLocation(net.minecraft.util.ResourceLocation) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) Vec3d(net.minecraft.util.math.Vec3d) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with InterpScale

use of com.teamwizardry.wizardry.api.util.interp.InterpScale 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));
    });
}
Also used : Entity(net.minecraft.entity.Entity) InterpCircle(com.teamwizardry.librarianlib.features.math.interpolate.position.InterpCircle) InterpScale(com.teamwizardry.wizardry.api.util.interp.InterpScale) ResourceLocation(net.minecraft.util.ResourceLocation) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) Vec3d(net.minecraft.util.math.Vec3d) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 3 with InterpScale

use of com.teamwizardry.wizardry.api.util.interp.InterpScale 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));
    });
}
Also used : Entity(net.minecraft.entity.Entity) InterpCircle(com.teamwizardry.librarianlib.features.math.interpolate.position.InterpCircle) InterpScale(com.teamwizardry.wizardry.api.util.interp.InterpScale) ResourceLocation(net.minecraft.util.ResourceLocation) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) Vec3d(net.minecraft.util.math.Vec3d) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 4 with InterpScale

use of com.teamwizardry.wizardry.api.util.interp.InterpScale in project Wizardry by TeamWizardry.

the class LibParticles method SPIRIT_WIGHT_FLAME_NORMAL.

public static void SPIRIT_WIGHT_FLAME_NORMAL(World world, Vec3d pos) {
    ParticleBuilder glitter = new ParticleBuilder(30);
    glitter.setRender(new ResourceLocation(Wizardry.MODID, MISC.SPARKLE_BLURRED));
    glitter.setAlphaFunction(new InterpFadeInOut(1f, 1f));
    ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), 10, 0, (i, build) -> {
        double radius = 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);
        glitter.setLifetime(RandUtil.nextInt(10, 40));
        glitter.setColor(new Color(0x4DFFFFFF, true));
        glitter.setScaleFunction(new InterpScale(0, (float) RandUtil.nextDouble(3, 4)));
        glitter.setPositionOffset(new Vec3d(x, RandUtil.nextDouble(0, 0.2), z));
        if (RandUtil.nextInt(15) == 0)
            glitter.addMotion(new Vec3d(RandUtil.nextDouble(-0.01, 0.01), RandUtil.nextDouble(0, 0.03), RandUtil.nextDouble(-0.01, 0.01)));
    });
}
Also used : InterpScale(com.teamwizardry.wizardry.api.util.interp.InterpScale) ResourceLocation(net.minecraft.util.ResourceLocation) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) Vec3d(net.minecraft.util.math.Vec3d)

Example 5 with InterpScale

use of com.teamwizardry.wizardry.api.util.interp.InterpScale in project Wizardry by TeamWizardry.

the class LibParticles method EFFECT_BURN.

public static void EFFECT_BURN(World world, @Nonnull Vec3d pos, Color color) {
    ParticleBuilder glitter = new ParticleBuilder(3);
    glitter.setScale(1);
    glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
    ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), 4, 0, (aFloat, particleBuilder) -> {
        glitter.setColor(ColorUtils.changeColorAlpha(color, RandUtil.nextInt(200, 255)));
        glitter.setLifetime(RandUtil.nextInt(10, 30));
        glitter.setScaleFunction(new InterpScale((float) RandUtil.nextDouble(3, 10), 0f));
        glitter.setAlphaFunction(new InterpFadeInOut(0.3f, RandUtil.nextFloat()));
        glitter.addMotion(new Vec3d(RandUtil.nextDouble(-0.05, 0.05), RandUtil.nextDouble(0.05), RandUtil.nextDouble(-0.05, 0.05)));
        glitter.setPositionOffset(new Vec3d(RandUtil.nextDouble(-0.3, 0.3), RandUtil.nextDouble(-0.3, 0.3), RandUtil.nextDouble(-0.3, 0.3)));
    });
    ParticleBuilder dust = new ParticleBuilder(3);
    dust.setScale(1);
    dust.setRenderNormalLayer(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
    ParticleSpawner.spawn(dust, world, new StaticInterp<>(pos), 3, 0, (aFloat, particleBuilder) -> {
        dust.setLifetime(RandUtil.nextInt(10, 30));
        dust.setScaleFunction(new InterpScale(3f, 0.5f));
        dust.setAlphaFunction(new InterpFadeInOut(1, 1));
        dust.setColor(Color.DARK_GRAY);
        dust.addMotion(new Vec3d(RandUtil.nextDouble(-0.05, 0.05), RandUtil.nextDouble(0.05), RandUtil.nextDouble(-0.05, 0.05)));
    });
// ParticleBuilder dust = new ParticleBuilder(3);
// dust.setScale(1);
// dust.setRenderNormalLayer(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
// 
// ParticleSpawner.spawn(dust, world, new StaticInterp<>(pos), 10, 0, (aFloat, particleBuilder) -> {
// dust.setColor(Color.DARK_GRAY);
// dust.setLifetime(RandUtil.nextInt(20, 30));
// dust.setScale(1);
// dust.setScaleFunction(new InterpFadeInOut(0, 0.9f));
// //dust.setAlphaFunction(new InterpFadeInOut(0.3f, RandUtil.nextFloat()));
// double x = RandUtil.nextDouble(-4, 4),
// z = RandUtil.nextDouble(-4, 4);
// dust.setPositionFunction(new InterpBezier3D(Vec3d.ZERO,
// new Vec3d(x, RandUtil.nextDouble(4), z),
// new Vec3d(x, -5, z), new Vec3d(0, 1, 0)));
// 
// //double radius = 3;
// //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(-1, 1), z);
// //glitter.setPositionFunction(new InterpBezier3D(Vec3d.ZERO, dest,
// //		new Vec3d(0, RandUtil.nextDouble(0, 1), 0),
// //		new Vec3d(0, RandUtil.nextDouble(-2, 0), 0)));
// });
}
Also used : InterpScale(com.teamwizardry.wizardry.api.util.interp.InterpScale) ResourceLocation(net.minecraft.util.ResourceLocation) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) Vec3d(net.minecraft.util.math.Vec3d)

Aggregations

ParticleBuilder (com.teamwizardry.librarianlib.features.particle.ParticleBuilder)25 InterpFadeInOut (com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut)25 InterpScale (com.teamwizardry.wizardry.api.util.interp.InterpScale)25 ResourceLocation (net.minecraft.util.ResourceLocation)25 Vec3d (net.minecraft.util.math.Vec3d)24 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)16 InterpColorHSV (com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV)10 World (net.minecraft.world.World)10 Entity (net.minecraft.entity.Entity)6 StaticInterp (com.teamwizardry.librarianlib.features.math.interpolate.StaticInterp)5 ParticleSpawner (com.teamwizardry.librarianlib.features.particle.ParticleSpawner)5 ClientRunnable (com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable)5 Wizardry (com.teamwizardry.wizardry.Wizardry)5 Constants (com.teamwizardry.wizardry.api.Constants)5 RandUtil (com.teamwizardry.wizardry.api.util.RandUtil)5 Side (net.minecraftforge.fml.relauncher.Side)5 ModSounds (com.teamwizardry.wizardry.init.ModSounds)4 java.awt (java.awt)4 Nonnull (javax.annotation.Nonnull)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4