public static void addBlockMesh(Tessellator tessellator, Vector4f color, Vector2f[] texOffsets, Vector2f[] texSizes,
float size, float light1, float light2, float posX, float posY, float posZ) {
final float sizeHalf = size / 2;
tessellator.resetParams();
tessellator.setColor(new Vector4f(light1 * color.x, light1 * color.y, light1 * color.z, color.w));
tessellator.setNormal(new Vector3f(0, 1, 0));
tessellator.addPoly(
new Vector3f[]{
new Vector3f(-sizeHalf + posX, sizeHalf + posY, sizeHalf + posZ),
new Vector3f(sizeHalf + posX, sizeHalf + posY, sizeHalf + posZ),
new Vector3f(sizeHalf + posX, sizeHalf + posY, -sizeHalf + posZ),
new Vector3f(-sizeHalf + posX, sizeHalf + posY, -sizeHalf + posZ)
},
new Vector2f[]{
new Vector2f(texOffsets[0].x, texOffsets[0].y),
new Vector2f(texOffsets[0].x + texSizes[0].x, texOffsets[0].y),
new Vector2f(texOffsets[0].x + texSizes[0].x, texOffsets[0].y + texSizes[0].y),
new Vector2f(texOffsets[0].x, texOffsets[0].y + texSizes[0].y)
});
tessellator.setNormal(new Vector3f(-1, 0, 0));
tessellator.addPoly(
new Vector3f[]{
new Vector3f(-sizeHalf + posX, -sizeHalf + posY, -sizeHalf + posZ),
new Vector3f(-sizeHalf + posX, -sizeHalf + posY, sizeHalf + posZ),
new Vector3f(-sizeHalf + posX, sizeHalf + posY, sizeHalf + posZ),
new Vector3f(-sizeHalf + posX, sizeHalf + posY, -sizeHalf + posZ)
},
new Vector2f[]{
new Vector2f(texOffsets[1].x, texOffsets[1].y + texSizes[1].y),
new Vector2f(texOffsets[1].x + texSizes[1].x, texOffsets[1].y + texSizes[1].y),
new Vector2f(texOffsets[1].x + texSizes[1].x, texOffsets[1].y),
new Vector2f(texOffsets[1].x, texOffsets[1].y)
});
tessellator.setNormal(new Vector3f(1, 0, 0));
tessellator.addPoly(
new Vector3f[]{
new Vector3f(sizeHalf + posX, sizeHalf + posY, -sizeHalf + posZ),
new Vector3f(sizeHalf + posX, sizeHalf + posY, sizeHalf + posZ),
new Vector3f(sizeHalf + posX, -sizeHalf + posY, sizeHalf + posZ),
new Vector3f(sizeHalf + posX, -sizeHalf + posY, -sizeHalf + posZ)
},
new Vector2f[]{
new Vector2f(texOffsets[2].x, texOffsets[2].y),
new Vector2f(texOffsets[2].x + texSizes[2].x, texOffsets[2].y),
new Vector2f(texOffsets[2].x + texSizes[2].x, texOffsets[2].y + texSizes[2].y),
new Vector2f(texOffsets[2].x, texOffsets[2].y + texSizes[2].y)
});
tessellator.setColor(new Vector4f(light2 * color.x, light2 * color.y, light2 * color.z, color.w));
tessellator.setNormal(new Vector3f(0, 0, -1));
tessellator.addPoly(
new Vector3f[]{
new Vector3f(-sizeHalf + posX, sizeHalf + posY, -sizeHalf + posZ),