public void doRenderBlock(EntityBlock entity, double i, double j, double k) { if (entity.isDead) return; shadowSize = entity.shadowSize; World world = entity.worldObj; BlockInterface util = new BlockInterface(); util.texture = entity.texture; for (int iBase = 0; iBase < entity.iSize; ++iBase) { for (int jBase = 0; jBase < entity.jSize; ++jBase) { for (int kBase = 0; kBase < entity.kSize; ++kBase) { util.minX = 0; util.minY = 0; util.minZ = 0; double remainX = entity.iSize - iBase; double remainY = entity.jSize - jBase; double remainZ = entity.kSize - kBase; util.maxX = (remainX > 1.0 ? 1.0 : remainX); util.maxY = (remainY > 1.0 ? 1.0 : remainY); util.maxZ = (remainZ > 1.0 ? 1.0 : remainZ); GL11.glPushMatrix(); GL11.glTranslatef((float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F); GL11.glRotatef(entity.rotationX, 1, 0, 0); GL11.glRotatef(entity.rotationY, 0, 1, 0); GL11.glRotatef(entity.rotationZ, 0, 0, 1); GL11.glTranslatef(iBase, jBase, kBase); ForgeHooksClient.bindTexture(DefaultProps.TEXTURE_BLOCKS, 0); int lightX, lightY, lightZ; lightX = (int) (Math.floor(entity.posX) + iBase); lightY = (int) (Math.floor(entity.posY) + jBase); lightZ = (int) (Math.floor(entity.posZ) + kBase); GL11.glDisable(2896 /* GL_LIGHTING */); renderBlock(util, world, lightX, lightY, lightZ, false, true); GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); } } } }
public static void renderBlock( BlockInterface block, IBlockAccess blockAccess, int i, int j, int k, boolean doLight, boolean doTessellating) { float f = 0.5F; float f1 = 1.0F; float f2 = 0.8F; float f3 = 0.6F; Tessellator tessellator = Tessellator.instance; if (doTessellating) { tessellator.startDrawingQuads(); } float f4 = 0, f5 = 0; if (doLight) { f4 = block.getBlockBrightness(blockAccess, i, j, k); f5 = block.getBlockBrightness(blockAccess, i, j, k); if (f5 < f4) { f5 = f4; } tessellator.setColorOpaque_F(f * f5, f * f5, f * f5); } renderBottomFace(block, -0.5D, -0.5D, -0.5D, block.getBlockTextureFromSide(0)); if (doLight) { f5 = block.getBlockBrightness(blockAccess, i, j, k); if (f5 < f4) { f5 = f4; } tessellator.setColorOpaque_F(f1 * f5, f1 * f5, f1 * f5); } renderTopFace(block, -0.5D, -0.5D, -0.5D, block.getBlockTextureFromSide(1)); if (doLight) { f5 = block.getBlockBrightness(blockAccess, i, j, k); if (f5 < f4) { f5 = f4; } tessellator.setColorOpaque_F(f2 * f5, f2 * f5, f2 * f5); } renderEastFace(block, -0.5D, -0.5D, -0.5D, block.getBlockTextureFromSide(2)); if (doLight) { f5 = block.getBlockBrightness(blockAccess, i, j, k); if (f5 < f4) { f5 = f4; } tessellator.setColorOpaque_F(f2 * f5, f2 * f5, f2 * f5); } renderWestFace(block, -0.5D, -0.5D, -0.5D, block.getBlockTextureFromSide(3)); if (doLight) { f5 = block.getBlockBrightness(blockAccess, i, j, k); if (f5 < f4) { f5 = f4; } tessellator.setColorOpaque_F(f3 * f5, f3 * f5, f3 * f5); } renderNorthFace(block, -0.5D, -0.5D, -0.5D, block.getBlockTextureFromSide(4)); if (doLight) { f5 = block.getBlockBrightness(blockAccess, i, j, k); if (f5 < f4) { f5 = f4; } tessellator.setColorOpaque_F(f3 * f5, f3 * f5, f3 * f5); } renderSouthFace(block, -0.5D, -0.5D, -0.5D, block.getBlockTextureFromSide(5)); if (doTessellating) { tessellator.draw(); } }