TileEntitySpecialRenderer only renders from certain angle

Posted by Hullu2000 on Game Development See other posts from Game Development or by Hullu2000
Published on 2014-08-14T15:34:32Z Indexed on 2014/08/20 16:37 UTC
Read the original article Hit count: 99

Filed under:
|
|

I'm developing a Minecraft mod with Forge. I've added a tileentity and a custom renderer for it. The problem is: The block is only visible from sertain angles. I've compaed my code to other peoples code and it looks pretty much like them.

The block is opaque and not to be rendered and the renderer is registered normally so the fault must be in the renderer.

Here's the renderer code:

public class TERender extends TileEntitySpecialRenderer
{
    public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float f)
    {
        GL11.glPushMatrix();
        GL11.glTranslatef((float)d, (float)d1, (float)d2);
        HeatConductTileEntity TE = (HeatConductTileEntity)tileEntity;
        renderBlock(TE, tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, mod.EMHeatConductor);
        GL11.glPopMatrix();
    }

    public void renderBlock(HeatConductTileEntity tl, World world, int i, int j, int k, Block block)
    {    
        Tessellator tessellator = Tessellator.instance;
        GL11.glColor3f(1, 1, 1);
        tessellator.startDrawingQuads();
        tessellator.addVertex(0, 0, 0);
        tessellator.addVertex(1, 0, 0);
        tessellator.addVertex(1, 1, 0);
        tessellator.addVertex(0, 1, 0);
        tessellator.draw();
    }
}

© Game Development or respective owner

Related posts about java

Related posts about rendering