Posted February 16, 201411 yr Hey Guys! I want to render a special Block which looks like a Block of Glowstone which is inside a Block of Glass. The problem is that only the Glass Block is rendered... This is my Code: @Override public void renderInventoryBlock(Block block, int meta, int modelId, RenderBlocks renderer) { IIcon c = block.getIcon(0, meta); IIcon c1 = block.getIcon(1, meta); Tessellator t = Tessellator.instance; GL11.glTranslatef(0.0F, -0.1F, 0.0F); t.startDrawingQuads(); t.setColorOpaque(255, 255, 255); render(t, c, c1); t.draw(); GL11.glTranslatef(0.0F, 0.1F, 0.0F); } @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { int meta = world.getBlockMetadata(x, y, z); IIcon c = block.getIcon(0, meta); IIcon c1 = block.getIcon(1, meta); Tessellator t = Tessellator.instance; t.addTranslation(x, y, z); t.setColorOpaque_F(1.0F, 1.0F, 1.0F); t.setBrightness(255); render(t, c, c1); t.addTranslation(-x, -y, -z); return true; } @Override public boolean shouldRender3DInInventory(int modelId) { return true; } protected static void renderCube(Tessellator t, float x, float y, float z, float X, float Y, float Z, IIcon icon) { float u = icon.getMinU(); float v = icon.getMinV(); float U = icon.getMaxU(); float V = icon.getMaxV(); t.setColorOpaque_F(1.0F, 1.0F, 1.0F); //Bottom t.addVertexWithUV(x, y, Z, u, v); t.addVertexWithUV(x, y, z, u, V); t.addVertexWithUV(X, y, z, U, V); t.addVertexWithUV(X, y, Z, U, v); //West t.addVertexWithUV(x, Y, z, u, v); t.addVertexWithUV(x, y, z, u, V); t.addVertexWithUV(x, y, Z, U, V); t.addVertexWithUV(x, Y, Z, U, v); //North t.addVertexWithUV(X, Y, z, u, v); t.addVertexWithUV(X, y, z, u, V); t.addVertexWithUV(x, y, z, U, V); t.addVertexWithUV(x, Y, z, U, v); //East t.addVertexWithUV(X, y, Z, u, V); t.addVertexWithUV(X, y, z, U, V); t.addVertexWithUV(X, Y, z, U, v); t.addVertexWithUV(X, Y, Z, u, v); //Top t.addVertexWithUV(X, Y, z, u, v); t.addVertexWithUV(x, Y, z, u, V); t.addVertexWithUV(x, Y, Z, U, V); t.addVertexWithUV(X, Y, Z, U, v); //South t.addVertexWithUV(x, Y, Z, u, v); t.addVertexWithUV(x, y, Z, u, V); t.addVertexWithUV(X, y, Z, U, V); t.addVertexWithUV(X, Y, Z, U, v); } EDIT: Sorry, just solved the Problem by swapping the two renderBlock methods. New Problem: In the Inventory the Block is rendered much darker than in the world. If you have an Item in your hand it's even darker. (->Picture) How can this Bug be fixed? I set brightness and opacity to default values so it must work, i thought. Picture: http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
February 16, 201411 yr Author You need to set normals. You can see how here: https://github.com/diesieben07/SevenCommons/blob/master/src/main/java/de/take_weiland/mods/commons/client/Rendering.java#L61 Thanks a lot, this works! http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.