p1rx

Untitled

Nov 24th, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.24 KB | None | 0 0
  1.     @Override
  2.     public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
  3.         Tessellator tessellator = Tessellator.instance;
  4.         IIcon icon = block.getIcon(0, 0);
  5.         tessellator.addTranslation(x + 0.5F, y + 0.5F, z + 0.5F);
  6.  
  7.         for (GroupObject groupObject : model.groupObjects) {
  8.             for (Face face : groupObject.faces) {
  9.                 int brightness = block.getMixedBrightnessForBlock(world, x + (int)face.faceNormal.x, y + (int)face.faceNormal.y, z + (int)face.faceNormal.z);
  10.                 tessellator.setBrightness(brightness);
  11.                 tessellator.setColorOpaque_F(1F, 1F, 1F);
  12.                 if (face.faceNormal.y < -0.5) tessellator.setColorOpaque_F(0.5F, 0.5F, 0.5F);
  13.                 if (Math.abs(face.faceNormal.z) > 0.5) tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
  14.                 if (Math.abs(face.faceNormal.x) > 0.5) tessellator.setColorOpaque_F(0.6F, 0.6F, 0.6F);
  15.                 for (int i = 0; i < face.vertices.length; ++i) {
  16.                     tessellator.addVertexWithUV(face.vertices[i].x, face.vertices[i].y, face.vertices[i].z,
  17.                             icon.getInterpolatedU(face.textureCoordinates[i].u * 16),
  18.                             icon.getInterpolatedV(face.textureCoordinates[i].v * 16));
  19.                 }
  20.             }
  21.         }
  22.         tessellator.addTranslation(-x - 0.5F, -y - 0.5F, -z - 0.5F);
  23.         return true;
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment