Search in sources :

Example 61 with ParticleBuilder

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

the class ModuleShapeZone method render.

@Override
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
    Vec3d target = spell.getTarget();
    if (target == null)
        return;
    if (RandUtil.nextInt(10) != 0)
        return;
    double aoe = spellRing.getAttributeValue(AttributeRegistry.AREA, spell);
    ParticleBuilder glitter = new ParticleBuilder(10);
    glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
    glitter.setScaleFunction(new InterpScale(1, 0));
    glitter.setCollision(true);
    ParticleSpawner.spawn(glitter, spell.world, new InterpCircle(target, new Vec3d(0, 1, 0), (float) aoe, 1, RandUtil.nextFloat()), (int) (aoe * 5), 0, (aFloat, particleBuilder) -> {
        glitter.setAlphaFunction(new InterpFadeInOut(0.3f, 0.3f));
        glitter.setLifetime(RandUtil.nextInt(10, 20));
        if (RandUtil.nextBoolean()) {
            glitter.setColor(getPrimaryColor());
        } else {
            glitter.setColor(getSecondaryColor());
        }
        glitter.addMotion(new Vec3d(RandUtil.nextDouble(-0.001, 0.001), RandUtil.nextDouble(-0.1, 0.1), RandUtil.nextDouble(-0.001, 0.001)));
    });
}
Also used : 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 62 with ParticleBuilder

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

the class PacketDevilDustFizzle method handle.

@Override
public void handle(MessageContext messageContext) {
    if (messageContext.side.isServer())
        return;
    World world = LibrarianLib.PROXY.getClientPlayer().world;
    if (world == null)
        return;
    ClientRunnable.run(new ClientRunnable() {

        @Override
        @SideOnly(Side.CLIENT)
        public void runIfClient() {
            ParticleBuilder glitter = new ParticleBuilder(30);
            glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
            glitter.setMotionCalculationEnabled(true);
            glitter.setCollision(true);
            glitter.setCanBounce(true);
            ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), 15, RandUtil.nextInt(10), (i, builder) -> {
                builder.setAcceleration(new Vec3d(0, RandUtil.nextDouble(-0.05, -0.01), 0));
                builder.setColor(new Color(RandUtil.nextFloat(0.9f, 1), RandUtil.nextFloat(0, 0.25f), 0));
                builder.setAlphaFunction(new InterpFadeInOut(0.0f, RandUtil.nextFloat(1f, 0.3f)));
                builder.setScaleFunction(new InterpScale(RandUtil.nextFloat(0.3f, 1f), RandUtil.nextFloat(0, 0.2f)));
                Vec3d offset = new Vec3d(RandUtil.nextDouble(-0.3, 0.3), RandUtil.nextDouble(-0.3, 0), RandUtil.nextDouble(-0.3, 0.3));
                builder.setPositionOffset(offset);
                builder.setLifetime(RandUtil.nextInt(20, 60));
                builder.setMotion(new Vec3d(RandUtil.nextDouble(-0.1, 0.1), RandUtil.nextDouble(0.1, 0.5), RandUtil.nextDouble(-0.1, 0.1)));
            });
        }
    });
}
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) 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) LibrarianLib(com.teamwizardry.librarianlib.core.LibrarianLib) PacketBase(com.teamwizardry.librarianlib.features.network.PacketBase) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) java.awt(java.awt) Vec3d(net.minecraft.util.math.Vec3d) MessageContext(net.minecraftforge.fml.common.network.simpleimpl.MessageContext) Side(net.minecraftforge.fml.relauncher.Side) ResourceLocation(net.minecraft.util.ResourceLocation) RandUtil(com.teamwizardry.wizardry.api.util.RandUtil) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) Save(com.teamwizardry.librarianlib.features.saving.Save) 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) World(net.minecraft.world.World) 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)

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