private void renderItem(ItemStack itemStack) { parent.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); final RenderItem itemRenderer = parent.getItemRenderer(); final ItemModelMesher itemModelMesher = itemRenderer.getItemModelMesher(); final IBakedModel model = itemModelMesher.getItemModel(stack); GlStateManager.disableLighting(); GlStateManager.enableRescaleNormal(); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); GlStateManager.pushMatrix(); itemRenderer.renderItem(stack, model); GlStateManager.cullFace(CullFace.BACK); GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); GlStateManager.disableBlend(); GlStateManager.enableLighting(); }
public void render() { RenderUtil.bindBlockTexture(); RenderHelper.disableStandardItemLighting(); VertexBuffer tes = Tessellator.getInstance().getBuffer(); for (int i = 0; i <= 1; i++) { if (i == 0) { GlStateManager.cullFace(CullFace.FRONT); } else { GlStateManager.cullFace(CullFace.BACK); } tes.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL); render(tes); Tessellator.getInstance().draw(); } RenderHelper.enableStandardItemLighting(); }
private void renderTankFluid(SmartTank tank, Set<EnumFacing> mergers, World world, BlockPos pos) { final FluidStack fluid = tank.getFluid(); if (fluid != null) { TextureAtlasSprite icon = RenderUtil.getStillTexture(fluid); int color = fluid.getFluid().getColor(fluid); float fullness = tank.getFilledRatio(); boolean[][][] merge = getMergers9(world, pos); VertexBuffer tes = Tessellator.getInstance().getBuffer(); float minU = icon.getMinU(), maxU = icon.getMaxU(), minV = icon.getMinV(), maxV = icon.getMaxV(); for (int i = 0; i <= 1; i++) { if (i == 0) { GlStateManager.cullFace(CullFace.FRONT); } else { GlStateManager.cullFace(CullFace.BACK); } for (NNIterator<EnumFacing> facings = NNList.FACING.fastIterator(); facings.hasNext();) { EnumFacing dir = facings.next(); float fullness2 = 0; if (mergers.contains(dir)) { BlockPos pos2 = pos.offset(dir); TileEntity tileEntity = world.getTileEntity(pos2); if (tileEntity instanceof TileReservoir) { TileReservoir res2 = (TileReservoir) tileEntity; fullness2 = res2.tank.getFilledRatio(); } } BoundingBox bb = mkFace(merge, dir, fullness, fullness2); if (bb != null) { float minVx = minV, maxVx = maxV; if (dir.getAxis() != EnumFacing.Axis.Y) { minVx = icon.getInterpolatedV((1 - fullness) * 16); maxVx = icon.getInterpolatedV((1 - fullness2) * 16); } renderFace(tes, bb, dir, minU, maxU, minVx, maxVx, color); } } } } }