Search in sources :

Example 21 with InterpFadeInOut

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

the class LibParticles method AIR_THROTTLE.

public static void AIR_THROTTLE(World world, Vec3d pos, Vec3d normal, Color color1, Color color2, double scatter) {
    ParticleBuilder glitter = new ParticleBuilder(RandUtil.nextInt(30, 50));
    glitter.setRender(new ResourceLocation(Wizardry.MODID, MISC.SPARKLE_BLURRED));
    glitter.setAlphaFunction(new InterpFadeInOut(0.1f, 0.3f));
    glitter.enableMotionCalculation();
    glitter.setCollision(true);
    glitter.setAcceleration(new Vec3d(0, -0.01, 0));
    glitter.setScaleFunction(new InterpScale(1, 0));
    ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), RandUtil.nextInt(40, 50), 1, (i, build) -> {
        glitter.setMotion(new Vec3d(normal.x + RandUtil.nextDouble(-0.01, 0.01), normal.y + RandUtil.nextDouble(-0.01, 0.01), normal.z + RandUtil.nextDouble(-0.01, 0.01)));
        if (RandUtil.nextBoolean())
            glitter.setColor(color1);
        else
            glitter.setColor(color2);
        if (scatter > 0) {
            double theta = 2.0f * (float) Math.PI * RandUtil.nextFloat();
            double r = scatter * RandUtil.nextFloat();
            double x = r * MathHelper.cos((float) theta);
            double z = r * MathHelper.sin((float) theta);
            glitter.setPositionOffset(new Vec3d(x, RandUtil.nextDouble(-scatter, scatter), z));
        }
    });
}
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 22 with InterpFadeInOut

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

the class EntityBomb method onImpact.

@Override
protected void onImpact(RayTraceResult result) {
    if (getThrower() == null)
        return;
    if (result.entityHit != null && getThrower() != null && getThrower().getEntityId() == result.entityHit.getEntityId())
        return;
    int type = getDataManager().get(DATA_BOMB_TYPE);
    if (type == 0)
        PosUtils.boom(getEntityWorld(), getPositionVector(), null, 10, true);
    else
        PosUtils.boom(getEntityWorld(), getPositionVector(), null, 10, false);
    ClientRunnable.run(new ClientRunnable() {

        @SideOnly(Side.CLIENT)
        @Override
        public void runIfClient() {
            Color color, color2;
            if (type == 1) {
                color = Color.CYAN;
                color2 = Color.BLUE;
            } else {
                color = Color.RED;
                color2 = Color.ORANGE;
            }
            ParticleBuilder glitter = new ParticleBuilder(10);
            glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
            glitter.setCollision(true);
            glitter.setAcceleration(new Vec3d(0, RandUtil.nextDouble(-0.03, -0.04), 0));
            glitter.setCanBounce(true);
            glitter.enableMotionCalculation();
            ParticleSpawner.spawn(glitter, world, new StaticInterp<>(getPositionVector()), 500, 0, (i, build) -> {
                build.setMotion(Vec3d.ZERO);
                build.setLifetime(RandUtil.nextInt(50, 100));
                build.setAlphaFunction(new InterpFadeInOut(RandUtil.nextFloat(), RandUtil.nextFloat()));
                build.setScale(RandUtil.nextFloat(0.2f, 1));
                if (type == 0) {
                    double radius = RandUtil.nextDouble(20, 40);
                    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);
                    build.setPositionOffset(new Vec3d(x, RandUtil.nextDouble(-radius, radius), z));
                    build.addMotion(build.getPositionOffset().scale(-1.0 / RandUtil.nextDouble(10, 30)));
                } else {
                    double radius = RandUtil.nextDouble(1, 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);
                    build.addMotion(new Vec3d(x, RandUtil.nextDouble(-radius, radius), z));
                }
                if (RandUtil.nextBoolean())
                    build.setColor(color);
                else
                    build.setColor(color2);
            });
        }
    });
    setDead();
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) EntityDataManager(net.minecraft.network.datasync.EntityDataManager) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) StaticInterp(com.teamwizardry.librarianlib.features.math.interpolate.StaticInterp) ClientRunnable(com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable) World(net.minecraft.world.World) Wizardry(com.teamwizardry.wizardry.Wizardry) ParticleSpawner(com.teamwizardry.librarianlib.features.particle.ParticleSpawner) DataParameter(net.minecraft.network.datasync.DataParameter) PosUtils(com.teamwizardry.wizardry.api.util.PosUtils) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) java.awt(java.awt) EntityThrowable(net.minecraft.entity.projectile.EntityThrowable) ItemStack(net.minecraft.item.ItemStack) RayTraceResult(net.minecraft.util.math.RayTraceResult) DataSerializers(net.minecraft.network.datasync.DataSerializers) Vec3d(net.minecraft.util.math.Vec3d) EntityLivingBase(net.minecraft.entity.EntityLivingBase) Side(net.minecraftforge.fml.relauncher.Side) MathHelper(net.minecraft.util.math.MathHelper) ResourceLocation(net.minecraft.util.ResourceLocation) RandUtil(com.teamwizardry.wizardry.api.util.RandUtil) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) Constants(com.teamwizardry.wizardry.api.Constants) ResourceLocation(net.minecraft.util.ResourceLocation) StaticInterp(com.teamwizardry.librarianlib.features.math.interpolate.StaticInterp) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) ClientRunnable(com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) Vec3d(net.minecraft.util.math.Vec3d)

Example 23 with InterpFadeInOut

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

the class EntitySpiritBlight method onDeath.

@Override
public void onDeath(DamageSource cause) {
    ClientRunnable.run(new ClientRunnable() {

        @Override
        @SideOnly(Side.CLIENT)
        public void runIfClient() {
            ParticleBuilder glitter = new ParticleBuilder(RandUtil.nextInt(100, 150));
            glitter.setColor(Color.WHITE);
            glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
            glitter.setAlphaFunction(new InterpFadeInOut(0.1f, 0.1f));
            glitter.setAcceleration(Vec3d.ZERO);
            ParticleSpawner.spawn(glitter, world, new StaticInterp<>(getPositionVector().addVector(0, height, 0)), 1000, 0, (i, build) -> {
                double radius = 0.2;
                build.setDeceleration(new Vec3d(RandUtil.nextDouble(0.8, 0.95), RandUtil.nextDouble(0.8, 0.95), RandUtil.nextDouble(0.8, 0.95)));
                build.addMotion(new Vec3d(RandUtil.nextDouble(-radius, radius), RandUtil.nextDouble(-radius, radius), RandUtil.nextDouble(-radius, radius)));
                build.setLifetime(RandUtil.nextInt(200, 250));
                build.setScaleFunction(new InterpScale(RandUtil.nextFloat(0.6f, 1.5f), 0));
                if (RandUtil.nextBoolean())
                    build.setColor(Color.WHITE);
                else
                    build.setColor(new Color(0xf404d4));
            });
        }
    });
    playSound(ModSounds.BASS_BOOM, 3, 0.5f);
    playSound(ModSounds.BASS_BOOM, 1, RandUtil.nextFloat(1, 1.5f));
    super.onDeath(cause);
}
Also used : Matrix4(com.teamwizardry.librarianlib.features.math.Matrix4) EntityDataManager(net.minecraft.network.datasync.EntityDataManager) InterpScale(com.teamwizardry.wizardry.api.util.interp.InterpScale) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) StaticInterp(com.teamwizardry.librarianlib.features.math.interpolate.StaticInterp) ParticleSpawner(com.teamwizardry.librarianlib.features.particle.ParticleSpawner) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) Vec3d(net.minecraft.util.math.Vec3d) Side(net.minecraftforge.fml.relauncher.Side) RandUtilSeed(com.teamwizardry.wizardry.api.util.RandUtilSeed) ModSounds(com.teamwizardry.wizardry.init.ModSounds) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) Nonnull(javax.annotation.Nonnull) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Entity(net.minecraft.entity.Entity) ClientRunnable(com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable) World(net.minecraft.world.World) Wizardry(com.teamwizardry.wizardry.Wizardry) DataParameter(net.minecraft.network.datasync.DataParameter) DamageSource(net.minecraft.util.DamageSource) SharedMonsterAttributes(net.minecraft.entity.SharedMonsterAttributes) java.awt(java.awt) DataSerializers(net.minecraft.network.datasync.DataSerializers) EntityMob(net.minecraft.entity.monster.EntityMob) LibParticles(com.teamwizardry.wizardry.client.fx.LibParticles) EntityPlayer(net.minecraft.entity.player.EntityPlayer) MathHelper(net.minecraft.util.math.MathHelper) ResourceLocation(net.minecraft.util.ResourceLocation) RandUtil(com.teamwizardry.wizardry.api.util.RandUtil) Constants(com.teamwizardry.wizardry.api.Constants) InterpScale(com.teamwizardry.wizardry.api.util.interp.InterpScale) ResourceLocation(net.minecraft.util.ResourceLocation) StaticInterp(com.teamwizardry.librarianlib.features.math.interpolate.StaticInterp) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) ClientRunnable(com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) Vec3d(net.minecraft.util.math.Vec3d)

Example 24 with InterpFadeInOut

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

the class EntitySpiritWight method onDeath.

@Override
public void onDeath(DamageSource cause) {
    ClientRunnable.run(new ClientRunnable() {

        @Override
        @SideOnly(Side.CLIENT)
        public void runIfClient() {
            ParticleBuilder glitter = new ParticleBuilder(RandUtil.nextInt(100, 150));
            glitter.setColor(Color.WHITE);
            glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
            glitter.setAlphaFunction(new InterpFadeInOut(0.1f, 0.1f));
            glitter.setAcceleration(Vec3d.ZERO);
            ParticleSpawner.spawn(glitter, world, new StaticInterp<>(getPositionVector().addVector(0, height, 0)), 1000, 0, (i, build) -> {
                double radius = 0.2;
                build.setDeceleration(new Vec3d(RandUtil.nextDouble(0.8, 0.95), RandUtil.nextDouble(0.8, 0.95), RandUtil.nextDouble(0.8, 0.95)));
                build.addMotion(new Vec3d(RandUtil.nextDouble(-radius, radius), RandUtil.nextDouble(-radius, radius), RandUtil.nextDouble(-radius, radius)));
                build.setLifetime(RandUtil.nextInt(200, 250));
                build.setScaleFunction(new InterpScale(RandUtil.nextFloat(0.6f, 1.5f), 0));
                if (RandUtil.nextBoolean())
                    build.setColor(Color.WHITE);
                else
                    build.setColor(Color.YELLOW);
            });
        }
    });
    playSound(ModSounds.BASS_BOOM, 3, 0.5f);
    playSound(ModSounds.BASS_BOOM, 1, RandUtil.nextFloat(1, 1.5f));
    super.onDeath(cause);
}
Also used : InterpScale(com.teamwizardry.wizardry.api.util.interp.InterpScale) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) EntityAIWatchClosest(net.minecraft.entity.ai.EntityAIWatchClosest) StaticInterp(com.teamwizardry.librarianlib.features.math.interpolate.StaticInterp) ParticleSpawner(com.teamwizardry.librarianlib.features.particle.ParticleSpawner) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) Vec3d(net.minecraft.util.math.Vec3d) Side(net.minecraftforge.fml.relauncher.Side) ModSounds(com.teamwizardry.wizardry.init.ModSounds) EntityAINearestAttackableTarget(net.minecraft.entity.ai.EntityAINearestAttackableTarget) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) Nonnull(javax.annotation.Nonnull) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Entity(net.minecraft.entity.Entity) ClientRunnable(com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable) World(net.minecraft.world.World) Wizardry(com.teamwizardry.wizardry.Wizardry) DamageSource(net.minecraft.util.DamageSource) SharedMonsterAttributes(net.minecraft.entity.SharedMonsterAttributes) java.awt(java.awt) EntityMob(net.minecraft.entity.monster.EntityMob) EntityLivingBase(net.minecraft.entity.EntityLivingBase) LibParticles(com.teamwizardry.wizardry.client.fx.LibParticles) EntityPlayer(net.minecraft.entity.player.EntityPlayer) MathHelper(net.minecraft.util.math.MathHelper) ResourceLocation(net.minecraft.util.ResourceLocation) RandUtil(com.teamwizardry.wizardry.api.util.RandUtil) Constants(com.teamwizardry.wizardry.api.Constants) InterpScale(com.teamwizardry.wizardry.api.util.interp.InterpScale) ResourceLocation(net.minecraft.util.ResourceLocation) StaticInterp(com.teamwizardry.librarianlib.features.math.interpolate.StaticInterp) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) ClientRunnable(com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) Vec3d(net.minecraft.util.math.Vec3d)

Example 25 with InterpFadeInOut

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

Aggregations

ParticleBuilder (com.teamwizardry.librarianlib.features.particle.ParticleBuilder)62 InterpFadeInOut (com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut)62 ResourceLocation (net.minecraft.util.ResourceLocation)61 Vec3d (net.minecraft.util.math.Vec3d)59 InterpScale (com.teamwizardry.wizardry.api.util.interp.InterpScale)25 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)22 World (net.minecraft.world.World)15 InterpColorHSV (com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV)14 ClientRunnable (com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable)11 StaticInterp (com.teamwizardry.librarianlib.features.math.interpolate.StaticInterp)9 ParticleSpawner (com.teamwizardry.librarianlib.features.particle.ParticleSpawner)9 Wizardry (com.teamwizardry.wizardry.Wizardry)9 Constants (com.teamwizardry.wizardry.api.Constants)9 RandUtil (com.teamwizardry.wizardry.api.util.RandUtil)9 Entity (net.minecraft.entity.Entity)9 Side (net.minecraftforge.fml.relauncher.Side)9 java.awt (java.awt)8 InterpCircle (com.teamwizardry.librarianlib.features.math.interpolate.position.InterpCircle)7 MathHelper (net.minecraft.util.math.MathHelper)7 InterpHelix (com.teamwizardry.librarianlib.features.math.interpolate.position.InterpHelix)6