Search in sources :

Example 6 with InterpFadeInOut

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

the class TileJarRenderer method render.

@Override
public void render(TileJar te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
    // LightEffectUtil.renderBilinearGradient(bezier.list(50), Color.CYAN, 1.5, new Vec3d(0, 1, 0));
    if (!te.hasFairy)
        return;
    double timeDifference = (ClientTickHandler.getTicks() + partialTicks) / 20.0;
    Vec3d pos = new Vec3d(te.getPos()).addVector(0.5, 0.35 + 0.2 * MathHelper.sin((float) timeDifference), 0.5);
    Color color = te.color;
    ParticleBuilder glitter = new ParticleBuilder(10);
    glitter.setColor(color);
    glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
    glitter.setAlphaFunction(new InterpFadeInOut(0.2f, 1f));
    glitter.setScale(0.3f);
    ParticleSpawner.spawn(glitter, te.getWorld(), new StaticInterp<>(pos), 1);
    if (RandUtil.nextInt(10) == 0) {
        ParticleBuilder trail = new ParticleBuilder(20);
        trail.setColor(te.color);
        trail.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
        trail.setAlphaFunction(new InterpFadeInOut(0.2f, 1f));
        trail.setScale(0.2f);
        // trail.enableMotionCalculation();
        ParticleSpawner.spawn(trail, te.getWorld(), new StaticInterp<>(pos), 1, 0, (aFloat, particleBuilder) -> {
            trail.setMotion(new Vec3d(RandUtil.nextDouble(-0.005, 0.005), RandUtil.nextDouble(-0.005, 0.005), RandUtil.nextDouble(-0.005, 0.005)));
        });
    }
}
Also used : 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 7 with InterpFadeInOut

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

the class TileManaBatteryRenderer method render.

@Override
public void render(float partialTicks, int destroyStage, float alpha) {
    super.render(partialTicks, destroyStage, alpha);
    if (!getBakedModels())
        return;
    GlStateManager.pushMatrix();
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    TextureManager texturemanager = Minecraft.getMinecraft().renderEngine;
    if (texturemanager != null) {
        texturemanager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    }
    if (Minecraft.isAmbientOcclusionEnabled())
        GlStateManager.shadeModel(GL11.GL_SMOOTH);
    else
        GlStateManager.shadeModel(GL11.GL_FLAT);
    CapManager manager = new CapManager(tile.getWizardryCap());
    float fill = (float) (manager.getMana() / manager.getMaxMana()) / 50.0f;
    GlStateManager.translate(0, 0.5, 0);
    GlStateManager.disableRescaleNormal();
    {
        double x = RandUtil.nextDouble(-fill, fill), y = RandUtil.nextDouble(-fill, fill), z = RandUtil.nextDouble(-fill, fill);
        GlStateManager.translate(0, Math.sin((tile.getWorld().getTotalWorldTime() + ClientTickHandler.getPartialTicks()) / 40) / 8, 0);
        GlStateManager.translate(x, y, z);
        Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor(modelCrystal, 1.0F, 1, 1, 1);
        GlStateManager.translate(-x, -y, -z);
    }
    GlStateManager.translate(0.5, 0, 0.5);
    GlStateManager.rotate(tile.getWorld().getTotalWorldTime() + ClientTickHandler.getPartialTicks(), 0, 1, 0);
    GlStateManager.translate(-0.5, 0, -0.5);
    Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor(modelRing, 1.0F, 1, 1, 1);
    GlStateManager.translate(0.5, 0, 0.5);
    GlStateManager.rotate(tile.getWorld().getTotalWorldTime() + ClientTickHandler.getPartialTicks(), 0, -1, 0);
    GlStateManager.rotate(tile.getWorld().getTotalWorldTime() + ClientTickHandler.getPartialTicks(), 0, -1, 0);
    GlStateManager.translate(-0.5, 0, -0.5);
    Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor(modelRingOuter, 1.0F, 1, 1, 1);
    GlStateManager.disableBlend();
    GlStateManager.popMatrix();
    HashSet<BlockPos> errors = ((IStructure) tile.getBlockType()).getErroredBlocks(tile.getWorld(), tile.getPos());
    if (tile.revealStructure && tile.getBlockType() instanceof IStructure && !errors.isEmpty()) {
        IStructure structure = ((IStructure) tile.getBlockType());
        GlStateManager.pushMatrix();
        GlStateManager.enableBlend();
        GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GlStateManager.enablePolygonOffset();
        GlStateManager.doPolygonOffset(1f, -0.05f);
        GlStateManager.translate(-structure.offsetToCenter().getX(), -structure.offsetToCenter().getY(), -structure.offsetToCenter().getZ());
        Minecraft mc = Minecraft.getMinecraft();
        Tessellator tes = Tessellator.getInstance();
        BufferBuilder buffer = tes.getBuffer();
        mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        for (BlockRenderLayer layer : cachedStructure.blocks.keySet()) {
            buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
            buffer.addVertexData(cachedStructure.vboCaches.get(layer));
            for (int i = 0; i < buffer.getVertexCount(); i++) {
                int idx = buffer.getColorIndex(i + 1);
                buffer.putColorRGBA(idx, 255, 255, 255, 200);
            }
            tes.draw();
        }
        GlStateManager.disablePolygonOffset();
        GlStateManager.color(1F, 1F, 1F, 1F);
        GlStateManager.enableDepth();
        GlStateManager.popMatrix();
    } else if (!tile.revealStructure && !errors.isEmpty()) {
        for (BlockPos error : errors) StructureErrorRenderer.INSTANCE.addError(error);
    }
    if (tile.getBlockType() == ModBlocks.CREATIVE_MANA_BATTERY) {
        double angle = tile.getWorld().getTotalWorldTime() / 10.0;
        double x1 = Math.cos((float) angle);
        double y1 = Math.sin((float) angle);
        ParticleBuilder builder = new ParticleBuilder(10);
        builder.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
        builder.setCollision(true);
        builder.disableRandom();
        builder.disableMotionCalculation();
        ParticleSpawner.spawn(builder, tile.getWorld(), new InterpCircle(new Vec3d(tile.getPos()).addVector(0.5, 0.5, 0.5), new Vec3d(x1, x1, y1), 1.5f), 20, 0, (aFloat, particleBuilder) -> {
            particleBuilder.setScale(0.5f);
            particleBuilder.setColor(new Color(0xd600d2));
            particleBuilder.setAlphaFunction(new InterpFadeInOut(1, 1));
            particleBuilder.setLifetime(RandUtil.nextInt(5, 10));
        });
    }
}
Also used : InterpCircle(com.teamwizardry.librarianlib.features.math.interpolate.position.InterpCircle) Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) IStructure(com.teamwizardry.wizardry.api.block.IStructure) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) Minecraft(net.minecraft.client.Minecraft) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) Vec3d(net.minecraft.util.math.Vec3d) CapManager(com.teamwizardry.wizardry.api.capability.CapManager) TextureManager(net.minecraft.client.renderer.texture.TextureManager) ResourceLocation(net.minecraft.util.ResourceLocation) BlockPos(net.minecraft.util.math.BlockPos) BlockRenderLayer(net.minecraft.util.BlockRenderLayer)

Example 8 with InterpFadeInOut

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

the class LibParticles method CLUSTER_DRAPE.

public static void CLUSTER_DRAPE(World world, Vec3d pos) {
    ParticleBuilder glitter = new ParticleBuilder(200);
    glitter.setRender(new ResourceLocation(Wizardry.MODID, MISC.SPARKLE_BLURRED));
    glitter.setAlphaFunction(new InterpFadeInOut(0.3f, 0.3f));
    glitter.enableMotionCalculation();
    ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), 1, 0, (aFloat, particleBuilder) -> {
        glitter.setColor(ColorUtils.changeColorAlpha(new Color(0x0097FF), RandUtil.nextInt(100, 255)));
        glitter.setScale(RandUtil.nextFloat());
        glitter.addMotion(new Vec3d(RandUtil.nextDouble(-0.01, 0.01), RandUtil.nextDouble(-0.01, 0.01), RandUtil.nextDouble(-0.01, 0.01)));
        glitter.setLifetime(RandUtil.nextInt(30, 60));
    });
}
Also used : 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 9 with InterpFadeInOut

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

the class LibParticles method BOOK_BEAM_NORMAL.

public static void BOOK_BEAM_NORMAL(World world, Vec3d pos) {
    ParticleBuilder glitter = new ParticleBuilder(50);
    glitter.setRender(new ResourceLocation(Wizardry.MODID, MISC.SPARKLE_BLURRED));
    glitter.setAlphaFunction(new InterpFadeInOut(0.0f, 0.3f));
    ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), 10, 0, (aFloat, particleBuilder) -> {
        glitter.setMotion(new Vec3d(RandUtil.nextDouble(-0.02, 0.02), RandUtil.nextDouble(0, 1.0), RandUtil.nextDouble(-0.02, 0.02)));
        glitter.setColor(new Color(255, 255, 255, RandUtil.nextInt(0, 255)));
        glitter.setScale(RandUtil.nextFloat());
        glitter.setLifetime(RandUtil.nextInt(0, 50));
    });
}
Also used : 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 10 with InterpFadeInOut

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

the class LibParticles method STRUCTURE_BOUNDS.

public static void STRUCTURE_BOUNDS(World world, Vec3d pos, Color color) {
    ParticleBuilder glitter = new ParticleBuilder(RandUtil.nextInt(10));
    glitter.setScale(RandUtil.nextFloat());
    glitter.setRenderNormalLayer(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
    glitter.setAlphaFunction(new InterpFadeInOut(0.9F, 0.9F));
    glitter.setScale(2);
    glitter.setLifetime(40);
    glitter.setColor(color);
    ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), 1);
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder)

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