Search in sources :

Example 1 with InterpHelix

use of com.teamwizardry.librarianlib.features.math.interpolate.position.InterpHelix in project Wizardry by TeamWizardry.

the class LibParticles method EFFECT_NULL_GRAV.

public static void EFFECT_NULL_GRAV(World world, @Nonnull Vec3d pos, @Nullable EntityLivingBase caster, Color color) {
    ParticleBuilder glitter = new ParticleBuilder(RandUtil.nextInt(20, 30));
    glitter.setColor(color == null ? Color.WHITE : color);
    glitter.setAlphaFunction(new InterpFadeInOut(0.3f, 0.3f));
    ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), RandUtil.nextInt(5, 10), RandUtil.nextInt(0, 30), (aFloat, particleBuilder) -> {
        glitter.setScale((float) RandUtil.nextDouble(0.3, 0.8));
        glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
        if (RandUtil.nextBoolean())
            glitter.setPositionFunction(new InterpHelix(new Vec3d(0, caster == null ? 1 / 2 : caster.height / 2, 0), new Vec3d(0, caster == null ? -1 : -caster.height, 0), 1f, 0f, 1f, RandUtil.nextFloat()));
        else
            glitter.setPositionFunction(new InterpHelix(new Vec3d(0, caster == null ? 1 / 2 : caster.height / 2, 0), new Vec3d(0, caster == null ? 1.5 : caster.height + 0.5, 0), 1f, 0f, 1f, RandUtil.nextFloat()));
    });
}
Also used : InterpHelix(com.teamwizardry.librarianlib.features.math.interpolate.position.InterpHelix) 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 2 with InterpHelix

use of com.teamwizardry.librarianlib.features.math.interpolate.position.InterpHelix in project Wizardry by TeamWizardry.

the class LibParticles method BOOK_BEAM_HELIX.

public static void BOOK_BEAM_HELIX(World world, Vec3d pos) {
    ParticleBuilder helix = new ParticleBuilder(200);
    helix.setRender(new ResourceLocation(Wizardry.MODID, MISC.SPARKLE_BLURRED));
    helix.setAlphaFunction(new InterpFadeInOut(0.3f, 0.3f));
    ParticleSpawner.spawn(helix, world, new StaticInterp<>(pos), 30, 0, (aFloat, particleBuilder) -> {
        helix.setColor(new Color(255, 255, 255, RandUtil.nextInt(0, 255)));
        helix.setScale(RandUtil.nextFloat());
        helix.setPositionFunction(new InterpHelix(Vec3d.ZERO, new Vec3d(0, RandUtil.nextDouble(1.0, 255.0), 0), 0, RandUtil.nextInt(1, 5), RandUtil.nextInt(1, 5), 0));
        helix.setLifetime(RandUtil.nextInt(0, 200));
    });
}
Also used : InterpHelix(com.teamwizardry.librarianlib.features.math.interpolate.position.InterpHelix) 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 InterpHelix

use of com.teamwizardry.librarianlib.features.math.interpolate.position.InterpHelix 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 InterpHelix

use of com.teamwizardry.librarianlib.features.math.interpolate.position.InterpHelix in project Wizardry by TeamWizardry.

the class LibParticles method CRAFTING_ALTAR_HELIX.

public static void CRAFTING_ALTAR_HELIX(World world, Vec3d pos) {
    ParticleBuilder beam = new ParticleBuilder(200);
    beam.setRender(new ResourceLocation(Wizardry.MODID, MISC.SPARKLE_BLURRED));
    beam.setAlphaFunction(new InterpFadeInOut(1f, 1f));
    pos = pos.addVector(0, 0.75, 0);
    ParticleSpawner.spawn(beam, world, new StaticInterp<>(pos), 1, 0, (aFloat, particleBuilder) -> {
        beam.setScale(RandUtil.nextFloat());
        beam.setColor(ColorUtils.changeColorAlpha(new Color(0x0097FF), RandUtil.nextInt(100, 255)));
        beam.setMotion(new Vec3d(0, RandUtil.nextDouble(0.1, 0.8), 0));
        beam.setLifetime(RandUtil.nextInt(0, 40));
    });
    ParticleBuilder helix = new ParticleBuilder(200);
    helix.setRender(new ResourceLocation(Wizardry.MODID, MISC.SPARKLE_BLURRED));
    helix.setAlphaFunction(new InterpFadeInOut(1f, 1f));
    ParticleSpawner.spawn(helix, world, new StaticInterp<>(pos), 1, 0, (aFloat, particleBuilder) -> {
        helix.setScale(RandUtil.nextFloat());
        helix.setColor(ColorUtils.changeColorAlpha(new Color(0x0097FF), RandUtil.nextInt(200, 255)));
        helix.setPositionFunction(new InterpHelix(Vec3d.ZERO, new Vec3d(0, RandUtil.nextDouble(0.0, 255.0), 0), 0, RandUtil.nextInt(1, 5), RandUtil.nextInt(1, 5), 0));
        helix.setLifetime(RandUtil.nextInt(0, 100));
    });
}
Also used : InterpHelix(com.teamwizardry.librarianlib.features.math.interpolate.position.InterpHelix) 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 InterpHelix

use of com.teamwizardry.librarianlib.features.math.interpolate.position.InterpHelix 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)

Aggregations

InterpHelix (com.teamwizardry.librarianlib.features.math.interpolate.position.InterpHelix)6 ParticleBuilder (com.teamwizardry.librarianlib.features.particle.ParticleBuilder)6 InterpFadeInOut (com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut)6 ResourceLocation (net.minecraft.util.ResourceLocation)6 Vec3d (net.minecraft.util.math.Vec3d)6 InterpColorHSV (com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV)3 InterpScale (com.teamwizardry.wizardry.api.util.interp.InterpScale)3 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 StaticInterp (com.teamwizardry.librarianlib.features.math.interpolate.StaticInterp)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 SpellRing (com.teamwizardry.wizardry.api.spell.SpellRing)1 AttributeRegistry (com.teamwizardry.wizardry.api.spell.attribute.AttributeRegistry)1 ModuleEffect (com.teamwizardry.wizardry.api.spell.module.ModuleEffect)1 ModuleModifier (com.teamwizardry.wizardry.api.spell.module.ModuleModifier)1 RegisterModule (com.teamwizardry.wizardry.api.spell.module.RegisterModule)1