Search in sources :

Example 26 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project ICBM-Classic by BuiltBrokenModding.

the class RenderShrapnel method renderArrow.

public void renderArrow(EntityFragments suiPian, double par2, double par4, double par6, float par8, float par9) {
    if (suiPian.isAnvil) {
        GL11.glPushMatrix();
        GL11.glTranslatef((float) par2, (float) par4, (float) par6);
        RenderUtility.setTerrainTexture();
        Block block = Blocks.anvil;
        World world = suiPian.worldObj;
        GL11.glDisable(GL11.GL_LIGHTING);
        RenderUtility.renderBlocks.blockAccess = world;
        Tessellator var12 = Tessellator.instance;
        var12.startDrawingQuads();
        var12.setTranslation((-MathHelper.floor_double(suiPian.posX)) - 0.5F, (-MathHelper.floor_double(suiPian.posY)) - 0.5F, (-MathHelper.floor_double(suiPian.posZ)) - 0.5F);
        RenderUtility.renderBlocks.renderBlockByRenderType(block, MathHelper.floor_double(suiPian.posX), MathHelper.floor_double(suiPian.posY), MathHelper.floor_double(suiPian.posZ));
        var12.setTranslation(0.0D, 0.0D, 0.0D);
        var12.draw();
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopMatrix();
    } else {
        this.bindTexture(TEXTURE_FILE);
        GL11.glPushMatrix();
        GL11.glTranslatef((float) par2, (float) par4, (float) par6);
        GL11.glRotatef(suiPian.prevRotationYaw + (suiPian.rotationYaw - suiPian.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(suiPian.prevRotationPitch + (suiPian.rotationPitch - suiPian.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
        Tessellator var10 = Tessellator.instance;
        byte var11 = 0;
        float var12 = 0.0F;
        float var13 = 0.5F;
        float var14 = (0 + var11 * 10) / 32.0F;
        float var15 = (5 + var11 * 10) / 32.0F;
        float var16 = 0.0F;
        float var17 = 0.15625F;
        float var18 = (5 + var11 * 10) / 32.0F;
        float var19 = (10 + var11 * 10) / 32.0F;
        float var20 = 0.05625F;
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        float var21 = suiPian.arrowShake - par9;
        if (var21 > 0.0F) {
            float var22 = -MathHelper.sin(var21 * 3.0F) * var21;
            GL11.glRotatef(var22, 0.0F, 0.0F, 1.0F);
        }
        GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
        GL11.glScalef(var20, var20, var20);
        GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
        GL11.glNormal3f(var20, 0.0F, 0.0F);
        var10.startDrawingQuads();
        var10.addVertexWithUV(-7.0D, -2.0D, -2.0D, var16, var18);
        var10.addVertexWithUV(-7.0D, -2.0D, 2.0D, var17, var18);
        var10.addVertexWithUV(-7.0D, 2.0D, 2.0D, var17, var19);
        var10.addVertexWithUV(-7.0D, 2.0D, -2.0D, var16, var19);
        var10.draw();
        GL11.glNormal3f(-var20, 0.0F, 0.0F);
        var10.startDrawingQuads();
        var10.addVertexWithUV(-7.0D, 2.0D, -2.0D, var16, var18);
        var10.addVertexWithUV(-7.0D, 2.0D, 2.0D, var17, var18);
        var10.addVertexWithUV(-7.0D, -2.0D, 2.0D, var17, var19);
        var10.addVertexWithUV(-7.0D, -2.0D, -2.0D, var16, var19);
        var10.draw();
        for (int var23 = 0; var23 < 4; ++var23) {
            GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
            GL11.glNormal3f(0.0F, 0.0F, var20);
            var10.startDrawingQuads();
            var10.addVertexWithUV(-8.0D, -2.0D, 0.0D, var12, var14);
            var10.addVertexWithUV(8.0D, -2.0D, 0.0D, var13, var14);
            var10.addVertexWithUV(8.0D, 2.0D, 0.0D, var13, var15);
            var10.addVertexWithUV(-8.0D, 2.0D, 0.0D, var12, var15);
            var10.draw();
        }
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) Block(net.minecraft.block.Block) World(net.minecraft.world.World)

Example 27 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project ICBM-Classic by BuiltBrokenModding.

the class RenderExplosion method doRender.

@Override
public void doRender(Entity entity, double x, double y, double z, float par8, float par9) {
    EntityExplosion entityExplosion = (EntityExplosion) entity;
    if (entityExplosion.getBlast() != null) {
        // RedM atter Render
        if (entityExplosion.getBlast() instanceof BlastRedmatter) {
            Tessellator tessellator = Tessellator.instance;
            /** Draw Sphere */
            GL11.glPushMatrix();
            GL11.glTranslatef((float) x, (float) y + entityExplosion.yOffset, (float) z);
            RenderUtility.enableBlending();
            RenderUtility.disableLighting();
            GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.9f);
            bindTexture(SharedAssets.GREY_TEXTURE);
            Sphere sphere = new Sphere();
            float radius = Math.max((BlastRedmatter.ENTITY_DESTROY_RADIUS * (entityExplosion.getBlast().getRadius() / BlastRedmatter.NORMAL_RADIUS)), 6);
            sphere.draw(radius, 32, 32);
            // Enable Lighting/Glow Off
            RenderUtility.enableLighting();
            // Disable Blending
            RenderUtility.disableBlending();
            GL11.glPopMatrix();
            /** Draw Vortex
                 *
                 * GL11.glPushMatrix(); GL11.glDepthMask(false);
                 *
                 * CalclaviaRenderHelper.enableBlending(); CalclaviaRenderHelper.disableLighting();
                 *
                 * GL11.glTranslated(x, y, z); GL11.glRotatef(-entity.ticksExisted, 0, 1, 0);
                 *
                 * float size = 10; float f10 = 1.0F;
                 *
                 * int textureSize = 50; float size4 = size * 5; float float_sizeMinus0_01 =
                 * textureSize - 0.01F;
                 *
                 * float x0 = (textureSize + 0.0F) / size4; float x1 = (textureSize +
                 * float_sizeMinus0_01) / size4; float x2 = (textureSize + 0.0F) / size4; float x3 =
                 * (textureSize + float_sizeMinus0_01) / size4;
                 *
                 * float renderX = (float) x; float renderY = (float) y; float renderZ = (float) z;
                 *
                 * this.bindTexture(TEXTURE_FILE); tessellator.startDrawingQuads();
                 * tessellator.setBrightness(240); tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1F);
                 * tessellator.addVertexWithUV(-size, 0, -size, x1, x3);
                 * tessellator.addVertexWithUV(-size, 0, +size, x1, x2);
                 * tessellator.addVertexWithUV(+size, 0, +size, x0, x2);
                 * tessellator.addVertexWithUV(+size, 0, -size, x0, x3); tessellator.draw();
                 *
                 * // Enable Lighting/Glow Off CalclaviaRenderHelper.enableLighting();
                 *
                 * // Disable Blending CalclaviaRenderHelper.disableBlending();
                 *
                 * GL11.glDepthMask(true); GL11.glPopMatrix(); */
            /** Enderdragon Light */
            float par2 = (entity.ticksExisted);
            while (par2 > 200) par2 -= 100;
            RenderHelper.disableStandardItemLighting();
            float var41 = (5 + par2) / 200.0F;
            float var51 = 0.0F;
            if (var41 > 0.8F) {
                var51 = (var41 - 0.8F) / 0.2F;
            }
            Random rand = new Random(432L);
            GL11.glPushMatrix();
            GL11.glTranslatef((float) x, (float) y, (float) z);
            GL11.glDisable(GL11.GL_TEXTURE_2D);
            GL11.glShadeModel(GL11.GL_SMOOTH);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
            GL11.glDisable(GL11.GL_ALPHA_TEST);
            GL11.glEnable(GL11.GL_CULL_FACE);
            GL11.glDepthMask(false);
            GL11.glPushMatrix();
            GL11.glTranslatef(0.0F, -1.0F, -2.0F);
            for (int i1 = 0; i1 < (var41 + var41 * var41) / 2.0F * 60.0F; ++i1) {
                GL11.glRotatef(rand.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
                GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
                GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
                GL11.glRotatef(rand.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
                GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
                GL11.glRotatef(rand.nextFloat() * 360.0F + var41 * 90.0F, 0.0F, 0.0F, 1.0F);
                tessellator.startDrawing(6);
                float var81 = rand.nextFloat() * 20.0F + 5.0F + var51 * 10.0F;
                float var91 = rand.nextFloat() * 2.0F + 1.0F + var51 * 2.0F;
                tessellator.setColorRGBA_I(16777215, (int) (255.0F * (1.0F - var51)));
                tessellator.addVertex(0.0D, 0.0D, 0.0D);
                tessellator.setColorRGBA_I(0, 0);
                tessellator.addVertex(-0.866D * var91, var81, -0.5F * var91);
                tessellator.addVertex(0.866D * var91, var81, -0.5F * var91);
                tessellator.addVertex(0.0D, var81, 1.0F * var91);
                tessellator.addVertex(-0.866D * var91, var81, -0.5F * var91);
                tessellator.draw();
            }
            GL11.glPopMatrix();
            GL11.glDepthMask(true);
            GL11.glDisable(GL11.GL_CULL_FACE);
            GL11.glDisable(GL11.GL_BLEND);
            GL11.glShadeModel(GL11.GL_FLAT);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glEnable(GL11.GL_TEXTURE_2D);
            GL11.glEnable(GL11.GL_ALPHA_TEST);
            RenderHelper.enableStandardItemLighting();
            GL11.glPopMatrix();
        } else {
            if (entityExplosion.getBlast().getRenderModel() != null && entityExplosion.getBlast().getRenderResource() != null) {
                GL11.glPushMatrix();
                GL11.glTranslatef((float) x, (float) y + 1F, (float) z);
                GL11.glRotatef(entityExplosion.rotationPitch, 0.0F, 0.0F, 1.0F);
                this.bindTexture(entityExplosion.getBlast().getRenderResource());
                entityExplosion.getBlast().getRenderModel().render(entityExplosion, (float) x, (float) y, (float) z, par8, par9, 0.0625F);
                GL11.glPopMatrix();
            }
        }
    }
}
Also used : Sphere(org.lwjgl.util.glu.Sphere) Tessellator(net.minecraft.client.renderer.Tessellator) Random(java.util.Random) EntityExplosion(icbm.classic.content.entity.EntityExplosion) BlastRedmatter(icbm.classic.content.explosive.blast.BlastRedmatter)

Example 28 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project ICBM-Classic by BuiltBrokenModding.

the class RenderGrenade method doRender.

@Override
public void doRender(Entity entity, double x, double y, double z, float par8, float par9) {
    /** Renders the grenade based on the explosive ID. */
    IIcon icon = ICBMClassic.itemGrenade.getIconFromDamage(((EntityGrenade) entity).haoMa.ordinal());
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x, (float) y + 0.4f, (float) z);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glScalef(0.6F, 0.6F, 0.6F);
    RenderUtility.setSpriteTexture(new ItemStack(ICBMClassic.itemGrenade));
    Tessellator tessellator = Tessellator.instance;
    this.renderIcon(tessellator, icon);
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) IIcon(net.minecraft.util.IIcon) EntityGrenade(icbm.classic.content.entity.EntityGrenade) ItemStack(net.minecraft.item.ItemStack)

Example 29 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project ICBM-Classic by BuiltBrokenModding.

the class RenderEntityBlock method renderBlockGravity.

public void renderBlockGravity(Block block, int metadata, RenderBlocks renderer) {
    float var6 = 0.5F;
    float var7 = 1.0F;
    float var8 = 0.8F;
    float var9 = 0.6F;
    Tessellator tess = Tessellator.instance;
    tess.startDrawingQuads();
    float var12 = 1.0F;
    tess.setColorOpaque_F(var6 * var12, var6 * var12, var6 * var12);
    renderer.renderFaceYNeg(block, -0.5D, -0.5D, -0.5D, renderer.getBlockIconFromSideAndMetadata(block, 0, metadata));
    tess.setColorOpaque_F(var7 * var12, var7 * var12, var7 * var12);
    renderer.renderFaceYPos(block, -0.5D, -0.5D, -0.5D, renderer.getBlockIconFromSideAndMetadata(block, 1, metadata));
    tess.setColorOpaque_F(var8 * var12, var8 * var12, var8 * var12);
    renderer.renderFaceZNeg(block, -0.5D, -0.5D, -0.5D, renderer.getBlockIconFromSideAndMetadata(block, 2, metadata));
    tess.setColorOpaque_F(var8 * var12, var8 * var12, var8 * var12);
    renderer.renderFaceZPos(block, -0.5D, -0.5D, -0.5D, renderer.getBlockIconFromSideAndMetadata(block, 3, metadata));
    tess.setColorOpaque_F(var9 * var12, var9 * var12, var9 * var12);
    renderer.renderFaceXNeg(block, -0.5D, -0.5D, -0.5D, renderer.getBlockIconFromSideAndMetadata(block, 4, metadata));
    tess.setColorOpaque_F(var9 * var12, var9 * var12, var9 * var12);
    renderer.renderFaceXPos(block, -0.5D, -0.5D, -0.5D, renderer.getBlockIconFromSideAndMetadata(block, 5, metadata));
    tess.draw();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator)

Example 30 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project Overloaded by CJ-MC-Mods.

the class ModelUtils method renderQuadsRGB.

public static void renderQuadsRGB(List<BakedQuad> listQuads, float r, float g, float b) {
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    int i = 0;
    for (int j = listQuads.size(); i < j; ++i) {
        BakedQuad bakedquad = (BakedQuad) listQuads.get(i);
        vertexbuffer.begin(7, DefaultVertexFormats.ITEM);
        vertexbuffer.addVertexData(bakedquad.getVertexData());
        vertexbuffer.putColorRGB_F4(r, g, b);
        Vec3i vec3i = bakedquad.getFace().getDirectionVec();
        vertexbuffer.putNormal((float) vec3i.getX(), (float) vec3i.getY(), (float) vec3i.getZ());
        tessellator.draw();
    }
}
Also used : BakedQuad(net.minecraft.client.renderer.block.model.BakedQuad) Vec3i(net.minecraft.util.math.Vec3i) Tessellator(net.minecraft.client.renderer.Tessellator) VertexBuffer(net.minecraft.client.renderer.VertexBuffer)

Aggregations

Tessellator (net.minecraft.client.renderer.Tessellator)618 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)290 WorldRenderer (net.minecraft.client.renderer.WorldRenderer)54 VertexBuffer (net.minecraft.client.renderer.VertexBuffer)42 BlockPos (net.minecraft.util.math.BlockPos)37 ResourceLocation (net.minecraft.util.ResourceLocation)31 Vec3d (net.minecraft.util.math.Vec3d)30 EnumFacing (net.minecraft.util.EnumFacing)24 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)23 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)19 IIcon (net.minecraft.util.IIcon)19 Random (java.util.Random)18 IBlockState (net.minecraft.block.state.IBlockState)17 Minecraft (net.minecraft.client.Minecraft)15 EntityPlayer (net.minecraft.entity.player.EntityPlayer)14 World (net.minecraft.world.World)14 Block (net.minecraft.block.Block)13 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)13 ArrayList (java.util.ArrayList)12 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)12