Search in sources :

Example 11 with InterpColorHSV

use of com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV in project Wizardry by TeamWizardry.

the class ModuleEffectGravityWell method render.

@Override
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
    Vec3d position = spell.getTarget();
    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()));
    });
}
Also used : InterpHelix(com.teamwizardry.librarianlib.features.math.interpolate.position.InterpHelix) InterpColorHSV(com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV) 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 12 with InterpColorHSV

use of com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV 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));
        });
    });
}
Also used : Entity(net.minecraft.entity.Entity) InterpColorHSV(com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV) InterpLine(com.teamwizardry.librarianlib.features.math.interpolate.position.InterpLine) ResourceLocation(net.minecraft.util.ResourceLocation) World(net.minecraft.world.World) 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 13 with InterpColorHSV

use of com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV 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()));
    });
}
Also used : InterpHelix(com.teamwizardry.librarianlib.features.math.interpolate.position.InterpHelix) InterpColorHSV(com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV) 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 14 with InterpColorHSV

use of com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV 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)));
    });
}
Also used : InterpColorHSV(com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV) InterpScale(com.teamwizardry.wizardry.api.util.interp.InterpScale) ResourceLocation(net.minecraft.util.ResourceLocation) World(net.minecraft.world.World) 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)

Aggregations

ParticleBuilder (com.teamwizardry.librarianlib.features.particle.ParticleBuilder)14 InterpColorHSV (com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV)14 InterpFadeInOut (com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut)14 ResourceLocation (net.minecraft.util.ResourceLocation)14 Vec3d (net.minecraft.util.math.Vec3d)13 InterpScale (com.teamwizardry.wizardry.api.util.interp.InterpScale)10 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)8 World (net.minecraft.world.World)5 InterpHelix (com.teamwizardry.librarianlib.features.math.interpolate.position.InterpHelix)3 InterpLine (com.teamwizardry.librarianlib.features.math.interpolate.position.InterpLine)2 SpellRing (com.teamwizardry.wizardry.api.spell.SpellRing)2 Entity (net.minecraft.entity.Entity)2 StaticInterp (com.teamwizardry.librarianlib.features.math.interpolate.StaticInterp)1 InterpBezier3D (com.teamwizardry.librarianlib.features.math.interpolate.position.InterpBezier3D)1 ParticleSpawner (com.teamwizardry.librarianlib.features.particle.ParticleSpawner)1 Wizardry (com.teamwizardry.wizardry.Wizardry)1 Constants (com.teamwizardry.wizardry.api.Constants)1 IBlockSelectable (com.teamwizardry.wizardry.api.spell.IBlockSelectable)1 SpellData (com.teamwizardry.wizardry.api.spell.SpellData)1 FACE_HIT (com.teamwizardry.wizardry.api.spell.SpellData.DefaultKeys.FACE_HIT)1