diff --git a/common/buildcraft/core/render/RenderingMarkers.java b/common/buildcraft/core/render/RenderingMarkers.java index 79757fcc..a1be4f77 100644 --- a/common/buildcraft/core/render/RenderingMarkers.java +++ b/common/buildcraft/core/render/RenderingMarkers.java @@ -120,102 +120,94 @@ public class RenderingMarkers implements ISimpleBlockRenderingHandler { Icon i = block.getBlockTexture(iblockaccess, xCoord, yCoord, zCoord, 1); int m = meta; - int j = i.getOriginX(); - int k = i.getOriginY(); - float f = j / 256F; - float f1 = (j + 15.99F) / 256F; - float f2 = k / 256F; - float f3 = (k + 15.99F) / 256F; - double d5 = f + 0.02734375D; - double d6 = f2 + 0.0234375D; - double d7 = f + 0.02734375D; - double d8 = f2 + 0.0234375D; x += 0.5D; z += 0.5D; + + double minU = (double)i.getInterpolatedU(7); + double minV = (double)i.getInterpolatedV(7); + double maxU = (double)i.getInterpolatedU(9); + double maxV = (double)i.getInterpolatedV(9); + tessellator.setBrightness(block.getMixedBrightnessForBlock(iblockaccess, xCoord, yCoord, zCoord)); - double s = 0.0625D; - + double s = 1F / 16F; + if (meta == 5) { - tessellator.addVertexWithUV(x - s, y + 0.5 + s, z - s, d5, d6); - tessellator.addVertexWithUV(x - s, y + 0.5 + s, z + s, d5, d8); - tessellator.addVertexWithUV(x + s, y + 0.5 + s, z + s, d7, d8); - tessellator.addVertexWithUV(x + s, y + 0.5 + s, z - s, d7, d6); + tessellator.addVertexWithUV(x - s, y + 0.5 + s, z - s, minU, minV); + tessellator.addVertexWithUV(x - s, y + 0.5 + s, z + s, minU, maxV); + tessellator.addVertexWithUV(x + s, y + 0.5 + s, z + s, maxU, maxV); + tessellator.addVertexWithUV(x + s, y + 0.5 + s, z - s, maxU, minV); } else if (meta == 0) { - tessellator.addVertexWithUV(x + s, y + 0.5 - s, z - s, d7, d6); - tessellator.addVertexWithUV(x + s, y + 0.5 - s, z + s, d7, d8); - tessellator.addVertexWithUV(x - s, y + 0.5 - s, z + s, d5, d8); - tessellator.addVertexWithUV(x - s, y + 0.5 - s, z - s, d5, d6); + tessellator.addVertexWithUV(x + s, y + 0.5 - s, z - s, maxU, minV); + tessellator.addVertexWithUV(x + s, y + 0.5 - s, z + s, maxU, maxV); + tessellator.addVertexWithUV(x - s, y + 0.5 - s, z + s, minU, maxV); + tessellator.addVertexWithUV(x - s, y + 0.5 - s, z - s, minU, minV); } else if (meta == 2) { - tessellator.addVertexWithUV(x - s, y + 0.5 - s, z - s, d5, d6); - tessellator.addVertexWithUV(x - s, y + 0.5 - s, z + s, d5, d8); - tessellator.addVertexWithUV(x - s, y + 0.5 + s, z + s, d7, d8); - tessellator.addVertexWithUV(x - s, y + 0.5 + s, z - s, d7, d6); + tessellator.addVertexWithUV(x - s, y + 0.5 - s, z - s, minU, minV); + tessellator.addVertexWithUV(x - s, y + 0.5 - s, z + s, minU, maxV); + tessellator.addVertexWithUV(x - s, y + 0.5 + s, z + s, maxU, maxV); + tessellator.addVertexWithUV(x - s, y + 0.5 + s, z - s, maxU, minV); } else if (meta == 1) { - tessellator.addVertexWithUV(x + s, y + 0.5 + s, z - s, d7, d6); - tessellator.addVertexWithUV(x + s, y + 0.5 + s, z + s, d7, d8); - tessellator.addVertexWithUV(x + s, y + 0.5 - s, z + s, d5, d8); - tessellator.addVertexWithUV(x + s, y + 0.5 - s, z - s, d5, d6); + tessellator.addVertexWithUV(x + s, y + 0.5 + s, z - s, maxU, minV); + tessellator.addVertexWithUV(x + s, y + 0.5 + s, z + s, maxU, maxV); + tessellator.addVertexWithUV(x + s, y + 0.5 - s, z + s, minU, maxV); + tessellator.addVertexWithUV(x + s, y + 0.5 - s, z - s, minU, minV); } else if (meta == 3) { - tessellator.addVertexWithUV(x - s, y + 0.5 - s, z + s, d5, d6); - tessellator.addVertexWithUV(x + s, y + 0.5 - s, z + s, d5, d8); - tessellator.addVertexWithUV(x + s, y + 0.5 + s, z + s, d7, d8); - tessellator.addVertexWithUV(x - s, y + 0.5 + s, z + s, d7, d6); + tessellator.addVertexWithUV(x - s, y + 0.5 - s, z + s, minU, minV); + tessellator.addVertexWithUV(x + s, y + 0.5 - s, z + s, minU, maxV); + tessellator.addVertexWithUV(x + s, y + 0.5 + s, z + s, maxU, maxV); + tessellator.addVertexWithUV(x - s, y + 0.5 + s, z + s, maxU, minV); } else if (meta == 4) { - tessellator.addVertexWithUV(x - s, y + 0.5 + s, z - s, d7, d6); - tessellator.addVertexWithUV(x + s, y + 0.5 + s, z - s, d7, d8); - tessellator.addVertexWithUV(x + s, y + 0.5 - s, z - s, d5, d8); - tessellator.addVertexWithUV(x - s, y + 0.5 - s, z - s, d5, d6); + tessellator.addVertexWithUV(x - s, y + 0.5 + s, z - s, maxU, minV); + tessellator.addVertexWithUV(x + s, y + 0.5 + s, z - s, maxU, maxV); + tessellator.addVertexWithUV(x + s, y + 0.5 - s, z - s, minU, maxV); + tessellator.addVertexWithUV(x - s, y + 0.5 - s, z - s, minU, minV); } - + i = block.getBlockTexture(iblockaccess, xCoord, yCoord, zCoord, 0); - j = i.getOriginX(); - k = i.getOriginY(); - f = j / 256F; - f1 = (j + 15.99F) / 256F; - f2 = k / 256F; - f3 = (k + 15.99F) / 256F; - d5 = f + 0.02734375D; - d6 = f2 + 0.0234375D; - d7 = f + 0.02734375D; - d8 = f2 + 0.0234375D; + + + minU = i.getMinU(); + maxU = i.getMaxU(); + minV = i.getMinV(); + maxV = i.getMaxV(); if (meta == 5 || meta == 4 || meta == 3 || meta == 0) { - tessellator.addVertexWithUV(x + frontX[m][0][0], y + frontX[m][1][0], z + frontX[m][2][0], f, f2); - tessellator.addVertexWithUV(x + frontX[m][0][1], y + frontX[m][1][1], z + frontX[m][2][1], f, f3); - tessellator.addVertexWithUV(x + frontX[m][0][2], y + frontX[m][1][2], z + frontX[m][2][2], f1, f3); - tessellator.addVertexWithUV(x + frontX[m][0][3], y + frontX[m][1][3], z + frontX[m][2][3], f1, f2); + tessellator.addVertexWithUV(x + frontX[m][0][0], y + frontX[m][1][0], z + frontX[m][2][0], minU, minV); + tessellator.addVertexWithUV(x + frontX[m][0][1], y + frontX[m][1][1], z + frontX[m][2][1], minU, maxV); + tessellator.addVertexWithUV(x + frontX[m][0][2], y + frontX[m][1][2], z + frontX[m][2][2], maxU, maxV); + tessellator.addVertexWithUV(x + frontX[m][0][3], y + frontX[m][1][3], z + frontX[m][2][3], maxU, minV); - tessellator.addVertexWithUV(x - frontX[m][0][3], y + frontX[m][1][3], z + frontX[m][2][3], f1, f2); - tessellator.addVertexWithUV(x - frontX[m][0][2], y + frontX[m][1][2], z + frontX[m][2][2], f1, f3); - tessellator.addVertexWithUV(x - frontX[m][0][1], y + frontX[m][1][1], z + frontX[m][2][1], f, f3); - tessellator.addVertexWithUV(x - frontX[m][0][0], y + frontX[m][1][0], z + frontX[m][2][0], f, f2); + tessellator.addVertexWithUV(x - frontX[m][0][3], y + frontX[m][1][3], z + frontX[m][2][3], maxU, minV); + tessellator.addVertexWithUV(x - frontX[m][0][2], y + frontX[m][1][2], z + frontX[m][2][2], maxU, maxV); + tessellator.addVertexWithUV(x - frontX[m][0][1], y + frontX[m][1][1], z + frontX[m][2][1], minU, maxV); + tessellator.addVertexWithUV(x - frontX[m][0][0], y + frontX[m][1][0], z + frontX[m][2][0], minU, minV); } if (meta == 5 || meta == 2 || meta == 1 || meta == 0) { - tessellator.addVertexWithUV(x + frontZ[m][0][0], y + frontZ[m][1][0], z + frontZ[m][2][0], f, f2); - tessellator.addVertexWithUV(x + frontZ[m][0][1], y + frontZ[m][1][1], z + frontZ[m][2][1], f, f3); - tessellator.addVertexWithUV(x + frontZ[m][0][2], y + frontZ[m][1][2], z + frontZ[m][2][2], f1, f3); - tessellator.addVertexWithUV(x + frontZ[m][0][3], y + frontZ[m][1][3], z + frontZ[m][2][3], f1, f2); + tessellator.addVertexWithUV(x + frontZ[m][0][0], y + frontZ[m][1][0], z + frontZ[m][2][0], minU, minV); + tessellator.addVertexWithUV(x + frontZ[m][0][1], y + frontZ[m][1][1], z + frontZ[m][2][1], minU, maxV); + tessellator.addVertexWithUV(x + frontZ[m][0][2], y + frontZ[m][1][2], z + frontZ[m][2][2], maxU, maxV); + tessellator.addVertexWithUV(x + frontZ[m][0][3], y + frontZ[m][1][3], z + frontZ[m][2][3], maxU, minV); - tessellator.addVertexWithUV(x + frontZ[m][0][3], y + frontZ[m][1][3], z - frontZ[m][2][3], f1, f2); - tessellator.addVertexWithUV(x + frontZ[m][0][2], y + frontZ[m][1][2], z - frontZ[m][2][2], f1, f3); - tessellator.addVertexWithUV(x + frontZ[m][0][1], y + frontZ[m][1][1], z - frontZ[m][2][1], f, f3); - tessellator.addVertexWithUV(x + frontZ[m][0][0], y + frontZ[m][1][0], z - frontZ[m][2][0], f, f2); + tessellator.addVertexWithUV(x + frontZ[m][0][3], y + frontZ[m][1][3], z - frontZ[m][2][3], maxU, minV); + tessellator.addVertexWithUV(x + frontZ[m][0][2], y + frontZ[m][1][2], z - frontZ[m][2][2], maxU, maxV); + tessellator.addVertexWithUV(x + frontZ[m][0][1], y + frontZ[m][1][1], z - frontZ[m][2][1], minU, maxV); + tessellator.addVertexWithUV(x + frontZ[m][0][0], y + frontZ[m][1][0], z - frontZ[m][2][0], minU, minV); } if (meta == 4 || meta == 3 || meta == 2 || meta == 1) { - tessellator.addVertexWithUV(x + frontY[m][0][0], y + 0.5 + frontY[m][1][0], z + frontY[m][2][0], f, f2); - tessellator.addVertexWithUV(x + frontY[m][0][1], y + 0.5 + frontY[m][1][1], z + frontY[m][2][1], f, f3); - tessellator.addVertexWithUV(x + frontY[m][0][2], y + 0.5 + frontY[m][1][2], z + frontY[m][2][2], f1, f3); - tessellator.addVertexWithUV(x + frontY[m][0][3], y + 0.5 + frontY[m][1][3], z + frontY[m][2][3], f1, f2); + tessellator.addVertexWithUV(x + frontY[m][0][0], y + 0.5 + frontY[m][1][0], z + frontY[m][2][0], minU, minV); + tessellator.addVertexWithUV(x + frontY[m][0][1], y + 0.5 + frontY[m][1][1], z + frontY[m][2][1], minU, maxV); + tessellator.addVertexWithUV(x + frontY[m][0][2], y + 0.5 + frontY[m][1][2], z + frontY[m][2][2], maxU, maxV); + tessellator.addVertexWithUV(x + frontY[m][0][3], y + 0.5 + frontY[m][1][3], z + frontY[m][2][3], maxU, minV); - tessellator.addVertexWithUV(x + frontY[m][0][3], y + 0.5 - frontY[m][1][3], z + frontY[m][2][3], f1, f2); - tessellator.addVertexWithUV(x + frontY[m][0][2], y + 0.5 - frontY[m][1][2], z + frontY[m][2][2], f1, f3); - tessellator.addVertexWithUV(x + frontY[m][0][1], y + 0.5 - frontY[m][1][1], z + frontY[m][2][1], f, f3); - tessellator.addVertexWithUV(x + frontY[m][0][0], y + 0.5 - frontY[m][1][0], z + frontY[m][2][0], f, f2); + tessellator.addVertexWithUV(x + frontY[m][0][3], y + 0.5 - frontY[m][1][3], z + frontY[m][2][3], maxU, minV); + tessellator.addVertexWithUV(x + frontY[m][0][2], y + 0.5 - frontY[m][1][2], z + frontY[m][2][2], maxU, maxV); + tessellator.addVertexWithUV(x + frontY[m][0][1], y + 0.5 - frontY[m][1][1], z + frontY[m][2][1], minU, maxV); + tessellator.addVertexWithUV(x + frontY[m][0][0], y + 0.5 - frontY[m][1][0], z + frontY[m][2][0], minU, minV); } }