Search in sources :

Example 1 with InterpColorHSV

use of com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV 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 InterpColorHSV

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

the class RenderSpellProjectile method doRender.

@Override
public void doRender(@Nonnull EntitySpellProjectile entity, double x, double y, double z, float entityYaw, float partialTicks) {
    super.doRender(entity, x, y, z, entityYaw, partialTicks);
    if (entity.spellRing != null)
        for (SpellRing ring : SpellUtils.getAllSpellRings(entity.spellRing)) {
            if (ring.overrideParentRenders()) {
                return;
            }
        }
    Color color = new Color(entity.getDataManager().get(DATA_COLOR), true);
    Color color2 = new Color(entity.getDataManager().get(DATA_COLOR2), true);
    ParticleBuilder glitter = new ParticleBuilder(10);
    glitter.setAlphaFunction(new InterpFadeInOut(0f, 0.3f));
    glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
    glitter.enableMotionCalculation();
    glitter.setCollision(true);
    glitter.setCanBounce(true);
    glitter.setColorFunction(new InterpColorHSV(color, color2));
    glitter.setAcceleration(new Vec3d(0, -0.015, 0));
    ParticleSpawner.spawn(glitter, entity.world, new StaticInterp<>(entity.getPositionVector().add(new Vec3d(entity.motionX, entity.motionY, entity.motionZ))), 5, 0, (aFloat, particleBuilder) -> {
        particleBuilder.setScaleFunction(new InterpScale((float) RandUtil.nextDouble(0.3, 0.8), 0));
        particleBuilder.setLifetime(RandUtil.nextInt(40, 60));
        particleBuilder.addMotion(new Vec3d(RandUtil.nextDouble(-0.03, 0.03), RandUtil.nextDouble(-0.01, 0.05), RandUtil.nextDouble(-0.03, 0.03)));
    });
    glitter.disableMotionCalculation();
    glitter.setMotion(Vec3d.ZERO);
    glitter.setLifetime(20);
    glitter.setScaleFunction(new InterpFadeInOut(0f, 1f));
    glitter.setAlphaFunction(new InterpFadeInOut(0f, 1f));
    ParticleSpawner.spawn(glitter, entity.world, new StaticInterp<>(entity.getPositionVector()), 5, 0, (aFloat, particleBuilder) -> {
        particleBuilder.setScale(RandUtil.nextFloat(0.5f, 2));
        particleBuilder.setLifetime(RandUtil.nextInt(5, 10));
    // particleBuilder.addMotion()
    });
}
Also used : InterpColorHSV(com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV) SpellRing(com.teamwizardry.wizardry.api.spell.SpellRing) 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 3 with InterpColorHSV

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

the class ModuleEffectSubstitution method render.

@Override
@SuppressWarnings("unused")
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
    World world = spell.world;
    Entity caster = spell.getCaster();
    BlockPos targetBlock = spell.getTargetPos();
    Entity targetEntity = spell.getVictim();
    if (targetEntity != null && caster != null) {
        ParticleBuilder glitter = new ParticleBuilder(RandUtil.nextInt(20, 30));
        glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
        glitter.setColorFunction(new InterpColorHSV(getPrimaryColor(), getSecondaryColor()));
        ParticleSpawner.spawn(glitter, spell.world, new StaticInterp<>(new Vec3d(targetEntity.posX, targetEntity.posY, targetEntity.posZ)), 50, RandUtil.nextInt(20, 30), (aFloat, particleBuilder) -> {
            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));
            glitter.setPositionFunction(new InterpHelix(new Vec3d(0, 0, 0), new Vec3d(0, 2, 0), 0.5f, 0f, 1, RandUtil.nextFloat()));
        });
        glitter.setColorFunction(new InterpColorHSV(getSecondaryColor(), getPrimaryColor()));
        ParticleSpawner.spawn(glitter, spell.world, new StaticInterp<>(new Vec3d(caster.posX, caster.posY, caster.posZ)), 50, RandUtil.nextInt(20, 30), (aFloat, particleBuilder) -> {
            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));
            glitter.setPositionFunction(new InterpHelix(new Vec3d(0, 0, 0), new Vec3d(0, 4, 0), 1f, 0f, 1, RandUtil.nextFloat()));
        });
    } else if (targetBlock != null) {
        ParticleBuilder glitter = new ParticleBuilder(RandUtil.nextInt(20, 30));
        glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
        glitter.setColorFunction(new InterpColorHSV(getPrimaryColor(), getSecondaryColor()));
        ParticleSpawner.spawn(glitter, spell.world, new StaticInterp<>(new Vec3d(targetBlock).addVector(0.5, 0.5, 0.5)), 20, RandUtil.nextInt(20, 30), (aFloat, particleBuilder) -> {
            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));
            glitter.setMotion(new Vec3d(RandUtil.nextDouble(-0.001, 0.001), RandUtil.nextDouble(-0.001, 0.001), RandUtil.nextDouble(-0.001, 0.001)));
        });
    }
}
Also used : InterpScale(com.teamwizardry.wizardry.api.util.interp.InterpScale) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) StaticInterp(com.teamwizardry.librarianlib.features.math.interpolate.StaticInterp) RegisterModule(com.teamwizardry.wizardry.api.spell.module.RegisterModule) ParticleSpawner(com.teamwizardry.librarianlib.features.particle.ParticleSpawner) ModuleModifier(com.teamwizardry.wizardry.api.spell.module.ModuleModifier) ModuleEffect(com.teamwizardry.wizardry.api.spell.module.ModuleEffect) PosUtils(com.teamwizardry.wizardry.api.util.PosUtils) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) SpellRing(com.teamwizardry.wizardry.api.spell.SpellRing) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) HashSet(java.util.HashSet) ItemStack(net.minecraft.item.ItemStack) Block(net.minecraft.block.Block) Vec3d(net.minecraft.util.math.Vec3d) Side(net.minecraftforge.fml.relauncher.Side) ModSounds(com.teamwizardry.wizardry.init.ModSounds) SpellData(com.teamwizardry.wizardry.api.spell.SpellData) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) SoundCategory(net.minecraft.util.SoundCategory) Nonnull(javax.annotation.Nonnull) Entity(net.minecraft.entity.Entity) FACE_HIT(com.teamwizardry.wizardry.api.spell.SpellData.DefaultKeys.FACE_HIT) IBlockSelectable(com.teamwizardry.wizardry.api.spell.IBlockSelectable) World(net.minecraft.world.World) Wizardry(com.teamwizardry.wizardry.Wizardry) ModuleModifierIncreaseRange(com.teamwizardry.wizardry.common.module.modifiers.ModuleModifierIncreaseRange) EnumFacing(net.minecraft.util.EnumFacing) InterpHelix(com.teamwizardry.librarianlib.features.math.interpolate.position.InterpHelix) BlockPos(net.minecraft.util.math.BlockPos) InterpColorHSV(com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV) IBlockState(net.minecraft.block.state.IBlockState) AttributeRegistry(com.teamwizardry.wizardry.api.spell.attribute.AttributeRegistry) BlockUtils(com.teamwizardry.wizardry.api.util.BlockUtils) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ResourceLocation(net.minecraft.util.ResourceLocation) RandUtil(com.teamwizardry.wizardry.api.util.RandUtil) ItemBlock(net.minecraft.item.ItemBlock) NBTUtil(net.minecraft.nbt.NBTUtil) Constants(com.teamwizardry.wizardry.api.Constants) Entity(net.minecraft.entity.Entity) InterpHelix(com.teamwizardry.librarianlib.features.math.interpolate.position.InterpHelix) StaticInterp(com.teamwizardry.librarianlib.features.math.interpolate.StaticInterp) 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) InterpColorHSV(com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV) InterpScale(com.teamwizardry.wizardry.api.util.interp.InterpScale) ResourceLocation(net.minecraft.util.ResourceLocation) BlockPos(net.minecraft.util.math.BlockPos) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 4 with InterpColorHSV

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

the class ModuleEffectTelekinesis 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(50);
    glitter.setColorFunction(new InterpColorHSV(getPrimaryColor(), getSecondaryColor()));
    glitter.setScale(1);
    glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
    ParticleSpawner.spawn(glitter, world, new StaticInterp<>(position), 5, 0, (aFloat, particleBuilder) -> {
        glitter.setLifetime(RandUtil.nextInt(10, 20));
        glitter.setScale(RandUtil.nextFloat());
        glitter.setScaleFunction(new InterpScale(1, 0));
        glitter.setAlphaFunction(new InterpFadeInOut(0.3f, RandUtil.nextFloat()));
        glitter.setMotion(new Vec3d(RandUtil.nextDouble(-0.1, 0.1), RandUtil.nextDouble(-0.1, 0.1), RandUtil.nextDouble(-0.1, 0.1)));
    });
}
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)

Example 5 with InterpColorHSV

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

the class ModuleEffectTimeSlow 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(30);
    glitter.setColorFunction(new InterpColorHSV(getPrimaryColor(), getSecondaryColor()));
    glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
    glitter.disableRandom();
    glitter.setScaleFunction(new InterpScale(1, 0));
    glitter.setCollision(true);
    glitter.enableMotionCalculation();
    glitter.setAcceleration(new Vec3d(0, -0.001, 0));
    ParticleSpawner.spawn(glitter, world, new StaticInterp<>(position.addVector(0, 1, 0)), 3, 0, (aFloat, particleBuilder) -> {
        glitter.setLifetime(RandUtil.nextInt(30, 40));
        glitter.setScale(RandUtil.nextFloat());
        glitter.setAlphaFunction(new InterpFadeInOut(0.5f, RandUtil.nextFloat()));
        double radius = RandUtil.nextDouble(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);
        Vec3d dest = new Vec3d(x, RandUtil.nextDouble(-radius, radius), z);
        glitter.setPositionOffset(dest);
    // glitter.setPositionFunction(new InterpSlowDown(Vec3d.ZERO, new Vec3d(0, RandUtil.nextDouble(-1, 1), 0)));
    // glitter.setPositionFunction(new InterpBezier3D(Vec3d.ZERO, position.subtract(dest), dest.scale(2), new Vec3d(position.x, radius, position.z)));
    });
}
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