Java Code Examples for net.minecraft.client.renderer.Tessellator#instance()

The following examples show how to use net.minecraft.client.renderer.Tessellator#instance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Render.java    From mapwriter with MIT License 7 votes vote down vote up
public static void drawCircleBorder(double x, double y, double r, double width) {
	GL11.glEnable(GL11.GL_BLEND);
       GL11.glDisable(GL11.GL_TEXTURE_2D);
       GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	Tessellator tes = Tessellator.instance;
       tes.startDrawing(GL11.GL_TRIANGLE_STRIP);
       // for some the circle is only drawn if theta is decreasing rather than ascending
       double end = Math.PI * 2.0;
       double incr = end / circleSteps;
       double r2 = r + width;
       for (double theta = -incr; theta < end; theta += incr) {
       	tes.addVertex(x + (r * Math.cos(-theta)), y + (r * Math.sin(-theta)), zDepth);
       	tes.addVertex(x + (r2 * Math.cos(-theta)), y + (r2 * Math.sin(-theta)), zDepth);
       }
       tes.draw();
       GL11.glEnable(GL11.GL_TEXTURE_2D);
       GL11.glDisable(GL11.GL_BLEND);
}
 
Example 2
Source File: Render.java    From mapwriter with MIT License 6 votes vote down vote up
public static void drawCircle(double x, double y, double r) {
	GL11.glEnable(GL11.GL_BLEND);
       GL11.glDisable(GL11.GL_TEXTURE_2D);
       GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	Tessellator tes = Tessellator.instance;
       tes.startDrawing(GL11.GL_TRIANGLE_FAN);
       tes.addVertex(x, y, zDepth);
       // for some the circle is only drawn if theta is decreasing rather than ascending
       double end = Math.PI * 2.0;
       double incr = end / circleSteps;
       for (double theta = -incr; theta < end; theta += incr) {
       	tes.addVertex(x + (r * Math.cos(-theta)), y + (r * Math.sin(-theta)), zDepth);
       }
       tes.draw();
       GL11.glEnable(GL11.GL_TEXTURE_2D);
       GL11.glDisable(GL11.GL_BLEND);
}
 
Example 3
Source File: RenderAutoChisel.java    From Chisel-2 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
	Tessellator tes = Tessellator.instance;
	IIcon icon = renderer.hasOverrideBlockTexture() ? renderer.overrideBlockTexture : block.getIcon(0, 0);
	tes.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
	tes.setColorOpaque_F(1, 1, 1);
	tes.addTranslation(x, y, z + 1);
	for (GroupObject go : model.groupObjects) {
		for (Face f : go.faces) {
			Vertex n = f.faceNormal;
			tes.setNormal(n.x, n.y, n.z);
			for (int i = 0; i < f.vertices.length; i++) {
				Vertex vert = f.vertices[i];
				TextureCoordinate t = f.textureCoordinates[i];
				if (!renderer.hasOverrideBlockTexture()) {
					tes.addVertexWithUV(vert.x, vert.y, vert.z, icon.getInterpolatedU(t.u * 16), icon.getInterpolatedV(t.v * 16));
				} else {
					tes.addVertexWithUV(vert.x, vert.y, vert.z, icon.getInterpolatedU((t.u * 64) % 16), icon.getInterpolatedV((t.v * 64) % 16));
				}
			}
		}
	}
	tes.addTranslation(-x, -y, -z - 1);
	return true;
}
 
Example 4
Source File: GuiCheckBox.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTick){
    drawRect(x, y, x + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT, enabled ? -6250336 : 0xFF999999);
    drawRect(x + 1, y + 1, x + CHECKBOX_WIDTH - 1, y + CHECKBOX_HEIGHT - 1, enabled ? -16777216 : 0xFFAAAAAA);
    if(checked) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        if(enabled) {
            GL11.glColor4d(1, 1, 1, 1);
        } else {
            GL11.glColor4d(0.8, 0.8, 0.8, 1);
        }
        Tessellator t = Tessellator.instance;

        t.startDrawing(GL11.GL_LINE_STRIP);
        t.addVertex(x + 2, y + 5, zLevel);
        t.addVertex(x + 5, y + 7, zLevel);
        t.addVertex(x + 8, y + 3, zLevel);
        t.draw();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
    fontRenderer.drawString(I18n.format(text), x + 1 + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT / 2 - fontRenderer.FONT_HEIGHT / 2, enabled ? color : 0xFF888888);
}
 
Example 5
Source File: BlockSpikesRenderer.java    From Chisel with GNU General Public License v2.0 5 votes vote down vote up
void drawSpike(IIcon icon, double r, double h, double x, double y, double z, double dx, double dz)
{
    Tessellator tessellator = Tessellator.instance;

    double u0 = icon.getMinU();
    double u1 = icon.getMaxU();
    double v0 = icon.getMaxV();
    double v1 = icon.getMinV();

    double tx = x + dx;
    double ty = y + h;
    double tz = z + dz;

    tessellator.addVertexWithUV(x + r, y + 0, z + r, u0, v0);
    tessellator.addVertexWithUV(x + r, y + 0, z - r, u1, v0);
    tessellator.addVertexWithUV(tx, ty, tz, u1, v1);
    tessellator.addVertexWithUV(tx, ty, tz, u0, v1);

    tessellator.addVertexWithUV(x - r, y + 0, z + r, u1, v0);
    tessellator.addVertexWithUV(x + r, y + 0, z + r, u0, v0);
    tessellator.addVertexWithUV(tx, ty, tz, u1, v1);
    tessellator.addVertexWithUV(tx, ty, tz, u0, v1);


    tessellator.addVertexWithUV(x + r, y + 0, z - r, u1, v0);
    tessellator.addVertexWithUV(x - r, y + 0, z - r, u0, v0);
    tessellator.addVertexWithUV(tx, ty, tz, u1, v1);
    tessellator.addVertexWithUV(tx, ty, tz, u0, v1);

    tessellator.addVertexWithUV(x - r, y + 0, z - r, u1, v0);
    tessellator.addVertexWithUV(x - r, y + 0, z + r, u0, v0);
    tessellator.addVertexWithUV(tx, ty, tz, u1, v1);
    tessellator.addVertexWithUV(tx, ty, tz, u0, v1);
}
 
Example 6
Source File: QCraftProxyClient.java    From qcraft-mod with Apache License 2.0 5 votes vote down vote up
private void renderInventoryQBlock( RenderBlocks renderblocks, BlockQBlock block, int type, BlockQBlock.Appearance appearance )
{
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    bindColor( block.getColorForType( 0, type ) );
    tessellator.setNormal( 0.0F, -1F, 0.0F );
    renderblocks.renderFaceYNeg( block, 0.0D, 0.0D, 0.0D, block.getIconForType( 0, type, appearance ) );
    tessellator.draw();

    tessellator.startDrawingQuads();
    bindColor( block.getColorForType( 1, type ) );
    tessellator.setNormal( 0.0F, 1.0F, 0.0F );
    renderblocks.renderFaceYPos( block, 0.0D, 0.0D, 0.0D, block.getIconForType( 1, type, appearance ) );
    tessellator.draw();

    tessellator.startDrawingQuads();
    bindColor( block.getColorForType( 2, type ) );
    tessellator.setNormal( 0.0F, 0.0F, -1F );
    renderblocks.renderFaceZNeg( block, 0.0D, 0.0D, 0.0D, block.getIconForType( 2, type, appearance ) );
    tessellator.draw();

    tessellator.startDrawingQuads();
    bindColor( block.getColorForType( 3, type ) );
    tessellator.setNormal( 0.0F, 0.0F, 1.0F );
    renderblocks.renderFaceZPos( block, 0.0D, 0.0D, 0.0D, block.getIconForType( 3, type, appearance ) );
    tessellator.draw();

    tessellator.startDrawingQuads();
    bindColor( block.getColorForType( 4, type ) );
    tessellator.setNormal( -1F, 0.0F, 0.0F );
    renderblocks.renderFaceXNeg( block, 0.0D, 0.0D, 0.0D, block.getIconForType( 4, type, appearance ) );
    tessellator.draw();

    tessellator.startDrawingQuads();
    bindColor( block.getColorForType( 5, type ) );
    tessellator.setNormal( 1.0F, 0.0F, 0.0F );
    renderblocks.renderFaceXPos( block, 0.0D, 0.0D, 0.0D, block.getIconForType( 5, type, appearance ) );
    tessellator.draw();
}
 
Example 7
Source File: RenderHelper.java    From GardenCollection with MIT License 5 votes vote down vote up
public void setColorAndBrightness (IBlockAccess blockAccess, Block block, int x, int y, int z) {
    Tessellator tessellator = Tessellator.instance;
    tessellator.setBrightness(block.getMixedBrightnessForBlock(blockAccess, x, y, z));

    calculateBaseColor(colorScratch, block.colorMultiplier(blockAccess, x, y, z));
    setTessellatorColor(tessellator, colorScratch);
}
 
Example 8
Source File: RenderProgressingLine.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@SideOnly(Side.CLIENT)
public void render(){
    Tessellator tess = Tessellator.instance;
    tess.startDrawing(GL11.GL_LINES);
    tess.addVertex(startX, startY, startZ);
    tess.addVertex(startX + (endX - startX) * progress, startY + (endY - startY) * progress, startZ + (endZ - startZ) * progress);
    tess.draw();
}
 
Example 9
Source File: RenderHelper.java    From GardenCollection with MIT License 5 votes vote down vote up
private void setupColorMult (int face, IBlockAccess blockAccess, Block block, int x, int y, int z, float r, float g, float b) {
    Tessellator tessellator = Tessellator.instance;
    float[] norm = normMap[face];
    float scale = state.getColorMult(face);

    if (blockAccess == null) {
        tessellator.startDrawingQuads();
        tessellator.setColorOpaque_F(r, g, b);
        tessellator.setNormal(norm[0], norm[1], norm[2]);
    }
    else {
        int brightX = x;
        int brightY = y;
        int brightZ = z;

        switch (face) {
            case YNEG: brightY = (state.renderMinY > 0) ? y : y - 1; break;
            case YPOS: brightY = (state.renderMaxY < 1) ? y : y + 1; break;
            case ZNEG: brightZ = (state.renderMinZ > 0) ? z : z - 1; break;
            case ZPOS: brightZ = (state.renderMaxZ < 1) ? z : z + 1; break;
            case XNEG: brightX = (state.renderMinX > 0) ? x : x - 1; break;
            case XPOS: brightX = (state.renderMaxX < 1) ? x : x + 1; break;
        }

        tessellator.setColorOpaque_F(scale * r, scale * g, scale * b);
        tessellator.setBrightness(block.getMixedBrightnessForBlock(blockAccess, brightX, brightY, brightZ));
    }

    state.enableAO = false;
}
 
Example 10
Source File: BlockOverlay.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
private static void drawOutlinedBoundingBox(AxisAlignedBB par1AxisAlignedBB) {
    Tessellator var2 = Tessellator.instance;
    var2.startDrawing(3);
    var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ);
    var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ);
    var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ);
    var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ);
    var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ);
    var2.draw();
    var2.startDrawing(3);
    var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ);
    var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ);
    var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ);
    var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ);
    var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ);
    var2.draw();
    var2.startDrawing(1);
    var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ);
    var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ);
    var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ);
    var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ);
    var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ);
    var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ);
    var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ);
    var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ);
    var2.draw();
    var2.startDrawing(1);
    var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ);
    var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ);
    var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ);
    var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ);
    var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ);
    var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ);
    var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ);
    var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ);
    var2.draw();
}
 
Example 11
Source File: MoCRenderShark.java    From mocreaturesdev with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void doRenderLiving(EntityLiving entityliving, double d, double d1, double d2, float f, float f1)
{
    MoCEntityShark entityshark = (MoCEntityShark) entityliving;
    super.doRenderLiving(entityshark, d, d1, d2, f, f1);
    boolean flag = MoCreatures.proxy.getDisplayPetName() && !(entityshark.getName()).isEmpty();
    boolean flag1 = MoCreatures.proxy.getDisplayPetHealth();
    boolean flag2 = MoCreatures.proxy.getDisplayPetIcons();
    if (entityshark.renderName())
    {
        float f2 = 1.6F;
        float f3 = 0.01666667F * f2;
        float f4 = entityshark.getDistanceToEntity(renderManager.livingPlayer);
        if (f4 < 16F)
        {
            String s = "";
            s = (new StringBuilder()).append(s).append(entityshark.getName()).toString();
            float f5 = 0.1F;
            FontRenderer fontrenderer = getFontRendererFromRenderManager();
            GL11.glPushMatrix();
            GL11.glTranslatef((float) d + 0.0F, (float) d1 + f5, (float) d2);
            GL11.glNormal3f(0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
            GL11.glScalef(-f3, -f3, f3);
            GL11.glDisable(2896 /* GL_LIGHTING */);
            Tessellator tessellator = Tessellator.instance;
            byte byte0 = -50;
            if (flag1)
            {
                GL11.glDisable(3553 /* GL_TEXTURE_2D */);
                if (!flag)
                {
                    byte0 += 8;
                }
                tessellator.startDrawingQuads();
                // might break SSP
                float f6 = entityshark.getHealth();
                float f7 = entityshark.getMaxHealth();
                float f8 = f6 / f7;
                float f9 = 40F * f8;
                tessellator.setColorRGBA_F(0.7F, 0.0F, 0.0F, 1.0F);
                tessellator.addVertex(-20F + f9, -10 + byte0, 0.0D);
                tessellator.addVertex(-20F + f9, -6 + byte0, 0.0D);
                tessellator.addVertex(20D, -6 + byte0, 0.0D);
                tessellator.addVertex(20D, -10 + byte0, 0.0D);
                tessellator.setColorRGBA_F(0.0F, 0.7F, 0.0F, 1.0F);
                tessellator.addVertex(-20D, -10 + byte0, 0.0D);
                tessellator.addVertex(-20D, -6 + byte0, 0.0D);
                tessellator.addVertex(f9 - 20F, -6 + byte0, 0.0D);
                tessellator.addVertex(f9 - 20F, -10 + byte0, 0.0D);
                tessellator.draw();
                GL11.glEnable(3553 /* GL_TEXTURE_2D */);
            }
            if (flag)
            {
                GL11.glDepthMask(false);
                GL11.glDisable(2929 /* GL_DEPTH_TEST */);
                GL11.glEnable(3042 /* GL_BLEND */);
                GL11.glBlendFunc(770, 771);
                GL11.glDisable(3553 /* GL_TEXTURE_2D */);
                tessellator.startDrawingQuads();
                int i = fontrenderer.getStringWidth(s) / 2;
                tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
                tessellator.addVertex(-i - 1, -1 + byte0, 0.0D);
                tessellator.addVertex(-i - 1, 8 + byte0, 0.0D);
                tessellator.addVertex(i + 1, 8 + byte0, 0.0D);
                tessellator.addVertex(i + 1, -1 + byte0, 0.0D);
                tessellator.draw();
                GL11.glEnable(3553 /* GL_TEXTURE_2D */);
                fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, 0x20ffffff);
                GL11.glEnable(2929 /* GL_DEPTH_TEST */);
                GL11.glDepthMask(true);
                fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, -1);
                GL11.glDisable(3042 /* GL_BLEND */);
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            }
            GL11.glEnable(2896 /* GL_LIGHTING */);
            GL11.glPopMatrix();
        }
    }
}
 
Example 12
Source File: MoCRenderDolphin.java    From mocreaturesdev with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void doRenderLiving(EntityLiving entityliving, double d, double d1, double d2, float f, float f1)
{
    MoCEntityDolphin entitydolphin = (MoCEntityDolphin) entityliving;
    super.doRenderLiving(entitydolphin, d, d1, d2, f, f1);
    boolean flag = MoCreatures.proxy.getDisplayPetName() && !(entitydolphin.getName()).isEmpty();
    boolean flag1 = MoCreatures.proxy.getDisplayPetHealth();
    //boolean flag2 = MoCreatures.proxy.getdisplayPetIcons();
    if (entitydolphin.renderName())
    {
        float f2 = 1.6F;
        float f3 = 0.01666667F * f2;
        float f4 = entitydolphin.getDistanceToEntity(renderManager.livingPlayer);
        if (f4 < 16F)
        {
            String s = "";
            s = (new StringBuilder()).append(s).append(entitydolphin.getName()).toString();
            float f5 = 0.1F;
            FontRenderer fontrenderer = getFontRendererFromRenderManager();
            GL11.glPushMatrix();
            GL11.glTranslatef((float) d + 0.0F, (float) d1 + f5, (float) d2);
            GL11.glNormal3f(0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
            GL11.glScalef(-f3, -f3, f3);
            GL11.glDisable(2896 /* GL_LIGHTING */);
            Tessellator tessellator = Tessellator.instance;
            byte byte0 = -50;
            if (flag1)
            {
                GL11.glDisable(3553 /* GL_TEXTURE_2D */);
                if (!flag)
                {
                    byte0 += 8;
                }
                tessellator.startDrawingQuads();
                // might break SSP
                float f6 = entitydolphin.getHealth();
                // maxhealth is always 30 for dolphins so we do not need to use a datawatcher
                float f7 = entitydolphin.getMaxHealth();
                float f8 = f6 / f7;
                float f9 = 40F * f8;
                tessellator.setColorRGBA_F(0.7F, 0.0F, 0.0F, 1.0F);
                tessellator.addVertex(-20F + f9, -10 + byte0, 0.0D);
                tessellator.addVertex(-20F + f9, -6 + byte0, 0.0D);
                tessellator.addVertex(20D, -6 + byte0, 0.0D);
                tessellator.addVertex(20D, -10 + byte0, 0.0D);
                tessellator.setColorRGBA_F(0.0F, 0.7F, 0.0F, 1.0F);
                tessellator.addVertex(-20D, -10 + byte0, 0.0D);
                tessellator.addVertex(-20D, -6 + byte0, 0.0D);
                tessellator.addVertex(f9 - 20F, -6 + byte0, 0.0D);
                tessellator.addVertex(f9 - 20F, -10 + byte0, 0.0D);
                tessellator.draw();
                GL11.glEnable(3553 /* GL_TEXTURE_2D */);
            }
            if (flag)
            {
                GL11.glDepthMask(false);
                GL11.glDisable(2929 /* GL_DEPTH_TEST */);
                GL11.glEnable(3042 /* GL_BLEND */);
                GL11.glBlendFunc(770, 771);
                GL11.glDisable(3553 /* GL_TEXTURE_2D */);
                tessellator.startDrawingQuads();
                int i = fontrenderer.getStringWidth(s) / 2;
                tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
                tessellator.addVertex(-i - 1, -1 + byte0, 0.0D);
                tessellator.addVertex(-i - 1, 8 + byte0, 0.0D);
                tessellator.addVertex(i + 1, 8 + byte0, 0.0D);
                tessellator.addVertex(i + 1, -1 + byte0, 0.0D);
                tessellator.draw();
                GL11.glEnable(3553 /* GL_TEXTURE_2D */);
                fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, 0x20ffffff);
                GL11.glEnable(2929 /* GL_DEPTH_TEST */);
                GL11.glDepthMask(true);
                fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, -1);
                GL11.glDisable(3042 /* GL_BLEND */);
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            }
            GL11.glEnable(2896 /* GL_LIGHTING */);
            GL11.glPopMatrix();
        }
    }
}
 
Example 13
Source File: SmallFireRenderer.java    From GardenCollection with MIT License 4 votes vote down vote up
private boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, BlockSmallFire block, int modelId, RenderBlocks renderer) {
    Tessellator tessellator = Tessellator.instance;
    IIcon icon0 = block.getFireIcon(0);
    IIcon icon1 = block.getFireIcon(1);
    IIcon icon2 = icon0;

    if (renderer.hasOverrideBlockTexture())
        icon2 = renderer.overrideBlockTexture;

    tessellator.setColorOpaque_F(1, 1, 1);
    tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));

    double uMin = icon2.getMinU();
    double vMin = icon2.getMinV();
    double uMax = icon2.getMaxU();
    double vMax = icon2.getMaxV();

    double y0 = y - .0625;
    double y1 = y + 1;

    double x0 = x + .5 + .2;
    double x1 = x + .5 - .2;
    double x2 = x + .5 - .3;
    double x3 = x + .5 + .3;
    double z0 = z + .5 + .2;
    double z1 = z + .5 - .2;
    double z2 = z + .5 - .3;
    double z3 = z + .5 + .3;

    tessellator.addVertexWithUV(x2, y1, z + 1 - .0625f, uMax, vMin);
    tessellator.addVertexWithUV(x0, y0, z + 1 - .0625f, uMax, vMax);
    tessellator.addVertexWithUV(x0, y0, z + 0 + .0625f, uMin, vMax);
    tessellator.addVertexWithUV(x2, y1, z + 0 + .0625f, uMin, vMin);

    tessellator.addVertexWithUV(x3, y1, z + 0 + .0625f, uMax, vMin);
    tessellator.addVertexWithUV(x1, y0, z + 0 + .0625f, uMax, vMax);
    tessellator.addVertexWithUV(x1, y0, z + 1 - .0625f, uMin, vMax);
    tessellator.addVertexWithUV(x3, y1, z + 1 - .0625f, uMin, vMin);

    uMin = icon1.getMinU();
    vMin = icon1.getMinV();
    uMax = icon1.getMaxU();
    vMax = icon1.getMaxV();

    tessellator.addVertexWithUV(x + 1 - .0625f, y1, z3, uMax, vMin);
    tessellator.addVertexWithUV(x + 1 - .0625f, y0, z1, uMax, vMax);
    tessellator.addVertexWithUV(x + 0 + .0625f, y0, z1, uMin, vMax);
    tessellator.addVertexWithUV(x + 0 + .0625f, y1, z3, uMin, vMin);

    tessellator.addVertexWithUV(x + 0 + .0625f, y1, z2, uMax, vMin);
    tessellator.addVertexWithUV(x + 0 + .0625f, y0, z0, uMax, vMax);
    tessellator.addVertexWithUV(x + 1 - .0625f, y0, z0, uMin, vMax);
    tessellator.addVertexWithUV(x + 1 - .0625f, y1, z2, uMin, vMin);

    x0 = x + .5 - .5 + .125f;
    x1 = x + .5 + .5 - .125f;
    x2 = x + .5 - .4 + .125f;
    x3 = x + .5 + .4 - .125f;
    z0 = z + .5 - .5 + .125f;
    z1 = z + .5 + .5 - .125f;
    z2 = z + .5 - .4 + .125f;
    z3 = z + .5 + .4 - .125f;

    tessellator.addVertexWithUV(x2, y1, z + 0, uMax, vMin);
    tessellator.addVertexWithUV(x0, y0, z + 0, uMax, vMax);
    tessellator.addVertexWithUV(x0, y0, z + 1, uMin, vMax);
    tessellator.addVertexWithUV(x2, y1, z + 1, uMin, vMin);

    tessellator.addVertexWithUV(x3, y1, z + 1, uMax, vMin);
    tessellator.addVertexWithUV(x1, y0, z + 1, uMax, vMax);
    tessellator.addVertexWithUV(x1, y0, z + 0, uMin, vMax);
    tessellator.addVertexWithUV(x3, y1, z + 0, uMin, vMin);

    uMin = icon0.getMinU();
    vMin = icon0.getMinV();
    uMax = icon0.getMaxU();
    vMax = icon0.getMaxV();

    tessellator.addVertexWithUV(x + 0, y1, z3, uMax, vMin);
    tessellator.addVertexWithUV(x + 0, y0, z1, uMax, vMax);
    tessellator.addVertexWithUV(x + 1, y0, z1, uMin, vMax);
    tessellator.addVertexWithUV(x + 1, y1, z3, uMin, vMin);

    tessellator.addVertexWithUV(x + 1, y1, z2, uMax, vMin);
    tessellator.addVertexWithUV(x + 1, y0, z0, uMax, vMax);
    tessellator.addVertexWithUV(x + 0, y0, z0, uMin, vMax);
    tessellator.addVertexWithUV(x + 0, y1, z2, uMin, vMin);

    return true;
}
 
Example 14
Source File: RenderOutFrustrumTriangle.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public static void renderTriangle(Entity entity){
    double playerYaw = -RenderManager.instance.playerViewY;
    while(playerYaw >= 360D) {
        playerYaw -= 360;
    }
    while(playerYaw < 0) {
        playerYaw += 360;
    }
    double angle = playerYaw * Math.sin(Math.toRadians(RenderManager.instance.viewerPosX));
    //  double angle = playerYaw;
    // System.out.println("viewY: " + RenderManager.instance.playerViewY);

    ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
    int middleX = sr.getScaledWidth() / 2;
    int middleY = sr.getScaledHeight() / 2;
    int triangleX;
    int triangleY;
    double switchAngle = Math.toDegrees(Math.atan((double)middleX / middleY));
    // System.out.println("angle: " + angle + ", switch angle: " + switchAngle);
    float triangleAngle = 0;
    int distanceFromEdge = 1;
    if(angle < switchAngle) {
        triangleY = distanceFromEdge;
        triangleX = middleX + (int)(Math.tan(Math.toRadians(angle)) * middleY);
    } else if(angle > 360 - switchAngle) {
        triangleY = distanceFromEdge;
        triangleX = middleX - (int)(Math.tan(Math.toRadians(360 - angle)) * middleY);
    } else if(angle < 180 - switchAngle) {
        triangleAngle = 90;
        triangleX = sr.getScaledWidth() - distanceFromEdge;
        triangleY = middleY - (int)(Math.tan(Math.toRadians(90 - angle)) * middleX);
    } else if(angle < 180 + switchAngle) {
        triangleAngle = 180;
        triangleY = sr.getScaledHeight() - distanceFromEdge;
        triangleX = middleX + (int)(Math.tan(Math.toRadians(180 - angle)) * middleY);
    } else {
        triangleAngle = 270;
        triangleX = distanceFromEdge;
        triangleY = middleY + (int)(Math.tan(Math.toRadians(270 - angle)) * middleX);
    }

    Tessellator tessellator = Tessellator.instance;
    GL11.glPushMatrix();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    // GL11.glEnable(GL11.GL_BLEND);
    // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glLineWidth(2.0F);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);

    GL11.glTranslated(triangleX, triangleY, 0);
    GL11.glRotatef(triangleAngle, 0, 0, 1);
    tessellator.startDrawing(GL11.GL_LINE_LOOP);
    tessellator.addVertex(5, 5, -90F);
    tessellator.addVertex(15, 5, -90F);
    tessellator.addVertex(10, 0, -90F);
    tessellator.draw();

    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}
 
Example 15
Source File: RenderLaser.java    From Electro-Magic-Tools with GNU General Public License v3.0 4 votes vote down vote up
public void renderArrow(EntityLaser entityLaser, double par2, double par4, double par6, float par8, float par9) {

        this.bindEntityTexture(entityLaser);
        GL11.glPushMatrix();
        GL11.glTranslatef((float) par2, (float) par4, (float) par6);
        GL11.glRotatef(entityLaser.prevRotationYaw + (entityLaser.rotationYaw - entityLaser.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(entityLaser.prevRotationPitch + (entityLaser.rotationPitch - entityLaser.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
        Tessellator tessellator = Tessellator.instance;
        byte b0 = 0;
        float f2 = 0.4F;
        float f3 = 0.7F;
        float f4 = (float) (0 + b0 * 10) / 32.0F;
        float f5 = (float) (5 + b0 * 10) / 32.0F;
        float f6 = 0.0F;
        float f7 = 0.15625F;
        float f8 = (float) (5 + b0 * 10) / 32.0F;
        float f9 = (float) (10 + b0 * 10) / 32.0F;
        float f10 = 0.05625F;
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);

        GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
        GL11.glScalef(f10, f10, f10);
        GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
        GL11.glNormal3f(f10, 0.0F, 0.0F);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f8);
        tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f8);
        tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f9);
        tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f9);
        tessellator.draw();
        GL11.glNormal3f(-f10, 0.0F, 0.0F);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f8);
        tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f8);
        tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f9);
        tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f9);
        tessellator.draw();

        for (int i = 0; i < 4; ++i) {
            GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
            GL11.glNormal3f(0.0F, 0.0F, f10);
            tessellator.startDrawingQuads();
            tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) f2, (double) f4);
            tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) f3, (double) f4);
            tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) f3, (double) f5);
            tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double) f2, (double) f5);
            tessellator.draw();
        }

        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
 
Example 16
Source File: TileTranslocatorRenderer.java    From Translocators with MIT License 4 votes vote down vote up
private void drawLiquidSpiral(int src, int dst, FluidStack stack, double start, double end, double time, double theta0, double x, double y, double z)
{
    IIcon tex = RenderUtils.prepareFluidRender(stack, 255);
    
    CCRenderState.startDrawing(7);
    Tessellator t = Tessellator.instance;
    t.setTranslation(x, y, z);
    
    Vector3[] last = new Vector3[]{new Vector3(), new Vector3(), new Vector3(), new Vector3()};
    Vector3[] next = new Vector3[]{new Vector3(), new Vector3(), new Vector3(), new Vector3()};
    double tess = 0.05;

    Vector3 a = getPerp(src, dst);
    boolean rev = sum(a.copy().crossProduct(getPathNormal(src, dst, 0))) != sum(sideVec[src]);
    
    for(double di = end; di <= start; di+=tess)
    {
        Vector3 b = getPathNormal(src, dst, di);
        Vector3 c = getPath(src, dst, di);
        
        if(rev)
            b.negate();
        
        double r = (2*di-time/10+theta0+dst/6)*2*Math.PI;
        double sz = 0.1;
        Vector3 p = c.add(a.copy().multiply(MathHelper.sin(r)*sz)).add(b.copy().multiply(MathHelper.cos(r)*sz));

        double s1 = 0.02;
        double s2 =-0.02;
        next[0].set(p).add(a.x*s1+b.x*s1, a.y*s1+b.y*s1, a.z*s1+b.z*s1);
        next[1].set(p).add(a.x*s2+b.x*s1, a.y*s2+b.y*s1, a.z*s2+b.z*s1);
        next[2].set(p).add(a.x*s2+b.x*s2, a.y*s2+b.y*s2, a.z*s2+b.z*s2);
        next[3].set(p).add(a.x*s1+b.x*s2, a.y*s1+b.y*s2, a.z*s1+b.z*s2);
        
        if(di > end)
        {
            double u1 = tex.getInterpolatedU(Math.abs(di)*16);
            double u2 = tex.getInterpolatedU(Math.abs(di-tess)*16);
            for(int i = 0; i < 4; i++)
            {
                int j = (i+1)%4;
                Vector3 axis = next[j].copy().subtract(next[i]);
                double v1 = tex.getInterpolatedV(Math.abs(next[i].scalarProject(axis))*16);
                double v2 = tex.getInterpolatedV(Math.abs(next[j].scalarProject(axis))*16);
                t.addVertexWithUV(next[i].x, next[i].y, next[i].z, u1, v1);
                t.addVertexWithUV(next[j].x, next[j].y, next[j].z, u1, v2);
                t.addVertexWithUV(last[j].x, last[j].y, last[j].z, u2, v2);
                t.addVertexWithUV(last[i].x, last[i].y, last[i].z, u2, v1);
            }
        }
        
        Vector3[] tmp = last;
        last = next;
        next = tmp;
    }
    
    CCRenderState.draw();
    t.setTranslation(0, 0, 0);
    
    RenderUtils.postFluidRender();
}
 
Example 17
Source File: RendererRoadLine.java    From Chisel-2 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b, int modelId, RenderBlocks renderer) {
	int meta = world.getBlockMetadata(x, y, z);
	BlockRoadLine block = (BlockRoadLine) b;
	Tessellator tessellator = Tessellator.instance;

	tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));

	float f = 1.0F;
	int i1 = block.colorMultiplier(world, x, y, z);
	float f1 = (i1 >> 16 & 255) / 255.0F;
	float f2 = (i1 >> 8 & 255) / 255.0F;
	float f3 = (i1 & 255) / 255.0F;

	if (EntityRenderer.anaglyphEnable) {
		float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
		float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
		float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
		f1 = f4;
		f2 = f5;
		f3 = f6;
	}
	tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);

	boolean N = world.getBlock(x, y, z - 1).equals(block) && world.getBlockMetadata(x, y, z - 1) == meta;
	boolean S = world.getBlock(x, y, z + 1).equals(block) && world.getBlockMetadata(x, y, z + 1) == meta;
	boolean W = world.getBlock(x - 1, y, z).equals(block) && world.getBlockMetadata(x - 1, y, z) == meta;
	boolean E = world.getBlock(x + 1, y, z).equals(block) && world.getBlockMetadata(x + 1, y, z) == meta;

	if (!N && !S && !W && !E) {
		renderer.renderStandardBlock(block, x, y, z);
		return true;
	}

	if (N && S) {
		renderer.uvRotateTop = 0;
		renderer.overrideBlockTexture = block.fullLineIcon[meta];
		renderer.renderStandardBlock(block, x, y, z);

	} else {
		if (N) {
			renderer.uvRotateTop = 0;
			renderer.overrideBlockTexture = block.halfLineIcon[meta];
			renderer.renderStandardBlock(block, x, y, z);
		}
		if (S) {
			renderer.uvRotateTop = 3;
			renderer.overrideBlockTexture = block.halfLineIcon[meta];
			renderer.renderStandardBlock(block, x, y, z);
		}

	}

	if (E && W) {
		renderer.uvRotateTop = 1;
		renderer.overrideBlockTexture = block.fullLineIcon[meta];
		renderer.renderStandardBlock(block, x, y, z);
	} else {
		if (E) {
			renderer.uvRotateTop = 1;
			renderer.overrideBlockTexture = block.halfLineIcon[meta];
			renderer.renderStandardBlock(block, x, y, z);
		}
		if (W) {
			renderer.uvRotateTop = 2;
			renderer.overrideBlockTexture = block.halfLineIcon[meta];
			renderer.renderStandardBlock(block, x, y, z);
		}
	}

	renderer.uvRotateTop = 0;
	renderer.overrideBlockTexture = null;
	return true;
}
 
Example 18
Source File: RenderEntityVortex.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
private void renderGust(){
    byte b0 = 0;
    //float f2 = 0.0F;
    //float f3 = 0.5F;
    //float f4 = (0 + b0 * 10) / 16.0F;
    // float f5 = (5 + b0 * 10) / 16.0F;
    float f6 = 0.0F;
    float f7 = 0.15625F;
    float f8 = (5 + b0 * 10) / 16.0F;
    float f9 = (10 + b0 * 10) / 16.0F;
    float f10 = 0.05625F;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(f10, f10, f10);
    GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
    GL11.glNormal3f(f10, 0.0F, 0.0F);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();

    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f9);
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f9);

    double start = 0d;
    double end = 1 / 16d;
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, start, start);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, start, end);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, end, end);
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, end, start);
    tessellator.draw();
    GL11.glNormal3f(-f10, 0.0F, 0.0F);

    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f9);
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f9);
    tessellator.draw();

}
 
Example 19
Source File: BlockOverlay.java    From ehacks-pro with GNU General Public License v3.0 4 votes vote down vote up
private static void drawBoundingBox(AxisAlignedBB axisalignedbb) {
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ);
    tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
    tessellator.draw();
}
 
Example 20
Source File: TileEntityEndRodRenderer.java    From Et-Futurum with The Unlicense 4 votes vote down vote up
public static void renderRod(RenderBlocks renderer, Block block, int meta) {
	Tessellator tessellator = Tessellator.instance;

	double x = 7 / 16.0;
	double y = 0;
	double z = 7 / 16.0;
	renderer.setRenderBounds(0, 1 / 16F, 0, 2 / 16F, 1, 2 / 16F);
	tessellator.startDrawingQuads();
	tessellator.setNormal(0.0F, -1.0F, 0.0F);
	renderer.renderFaceYNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 0, meta));
	tessellator.setNormal(0.0F, 1.0F, 0.0F);
	renderer.renderFaceYPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 1, meta));
	tessellator.setNormal(0.0F, 0.0F, -1.0F);
	renderer.renderFaceZNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 2, meta));
	tessellator.setNormal(0.0F, 0.0F, 1.0F);
	renderer.renderFaceZPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 3, meta));
	tessellator.setNormal(-1.0F, 0.0F, 0.0F);
	renderer.renderFaceXNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 4, meta));
	tessellator.setNormal(1.0F, 0.0F, 0.0F);
	renderer.renderFaceXPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 5, meta));
	tessellator.draw();

	x = 4 / 16.0;
	y = 0;
	z = 4 / 16.0;
	renderer.setRenderBounds(2 / 16F, 0, 2 / 16F, 6 / 16F, 1 / 16F, 6 / 16F);
	tessellator.startDrawingQuads();
	tessellator.setNormal(0.0F, -1.0F, 0.0F);
	renderer.renderFaceYNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 0, meta));
	tessellator.setNormal(0.0F, 1.0F, 0.0F);
	renderer.renderFaceYPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 1, meta));
	y = -13 / 16.0;
	renderer.setRenderBounds(2 / 16F, 13 / 16F, 2 / 16F, 6 / 16F, 14 / 16F, 6 / 16F);
	tessellator.setNormal(0.0F, 0.0F, -1.0F);
	renderer.renderFaceZNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 2, meta));
	tessellator.setNormal(0.0F, 0.0F, 1.0F);
	renderer.renderFaceZPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 3, meta));
	tessellator.setNormal(-1.0F, 0.0F, 0.0F);
	renderer.renderFaceXNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 4, meta));
	tessellator.setNormal(1.0F, 0.0F, 0.0F);
	renderer.renderFaceXPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 5, meta));
	tessellator.draw();
}