Posted April 9, 20169 yr How can I render blocks and items semi-transparent? I should look like this: (the right one) this.bindTexture(TextureMap.locationBlocksTexture); BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); World world = te.getWorld(); BlockPos blockpos = te.getPos(); IBlockState iblockstate = te.getCover().getStateFromMeta(te.getCoverMeta()); GlStateManager.pushMatrix(); RenderHelper.disableStandardItemLighting(); GlStateManager.translate((float) x, (float) y, (float) z); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); int i = blockpos.getX(); int j = blockpos.getY(); int k = blockpos.getZ(); worldrenderer.setTranslation(((-i)), (-j), ((-k))); worldrenderer.color(1F, 1F, 1F, 1F); IBakedModel ibakedmodel = blockrendererdispatcher.getModelFromBlockState(iblockstate, world, blockpos); blockrendererdispatcher.getBlockModelRenderer().renderModel(world, ibakedmodel, iblockstate, blockpos, worldrenderer, true); worldrenderer.setTranslation(0.0D, 0.0D, 0.0D); tessellator.draw(); RenderHelper.enableStandardItemLighting(); GlStateManager.popMatrix(); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); GlStateManager.disableDepth(); int j1 = 150; int k1 = 35; GlStateManager.colorMask(true, true, true, false); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.color(1f, 1f, 1f, 1f); ItemStack result = CraftingManager.getInstance().findMatchingRecipe(((ContainerCrafter) inventorySlots).crafter.getMatrix(), mc.theWorld); mc.getRenderItem().renderItemAndEffectIntoGUI(result, j1, k1); RenderHelper.disableStandardItemLighting(); GlStateManager.colorMask(true, true, true, true); GlStateManager.enableLighting(); GlStateManager.enableDepth(); GlStateManager.popMatrix();
April 9, 20169 yr First, your texture needs to have an alpha layer - you can add these via GIMP or PhotoShop pretty easily. Then, when rendering, you need to enable the alpha layer: // first push attributes, like pushing the matrix, so you don't mess up anything // that renders after your block GlStateManager.pushAttrib(); // enable alpha and blend so you can render your alpha layer GlStateManager.enableAlpha(); GlStateManager.enableBlend(); // render your stuff here // finally, pop to return the attributes back to their original state GlStateManager.popAttrib(); http://i.imgur.com/NdrFdld.png[/img]
April 9, 20169 yr Author It's not MY texture. As you can see in the code I want to render an itemstack in the GUI of an automatic crafter. the itemstack is the crafting result.
April 9, 20169 yr Ah, well if the texture doesn't already have an alpha layer, I'm not sure how to force it to render semi-transparently, sorry. Hopefully someone does, good luck! http://i.imgur.com/NdrFdld.png[/img]
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.