double j1 = j0 + 1.0;
double k0 = k;
double kM = k0 + 0.5;
double k1 = k0 + 1.0;
Tessellator tessellator = CTMUtils.newTessellator;
active = true;
boolean connectAny = connectWest || connectEast || connectNorth || connectSouth;
if ((connectEast && connectWest) || !connectAny) {
// full west-east pane
setupTileCoords(TileOverride.SOUTH_FACE);
tessellator.addVertexWithUV(i0, j1, kM, u0, v0);
tessellator.addVertexWithUV(i0, j0, kM, u0, v1);
tessellator.addVertexWithUV(i1, j0, kM, u1, v1);
tessellator.addVertexWithUV(i1, j1, kM, u1, v0);
setupTileCoords(TileOverride.NORTH_FACE);
tessellator.addVertexWithUV(i1, j1, kM, u0, v0);
tessellator.addVertexWithUV(i1, j0, kM, u0, v1);
tessellator.addVertexWithUV(i0, j0, kM, u1, v1);
tessellator.addVertexWithUV(i0, j1, kM, u1, v0);
} else if (connectWest && !connectEast) {
// west half-pane
setupTileCoords(TileOverride.SOUTH_FACE);
tessellator.addVertexWithUV(i0, j1, kM, u0, v0);
tessellator.addVertexWithUV(i0, j0, kM, u0, v1);
tessellator.addVertexWithUV(iM, j0, kM, uM, v1);
tessellator.addVertexWithUV(iM, j1, kM, uM, v0);
setupTileCoords(TileOverride.NORTH_FACE);
tessellator.addVertexWithUV(iM, j1, kM, uM, v0);
tessellator.addVertexWithUV(iM, j0, kM, uM, v1);
tessellator.addVertexWithUV(i0, j0, kM, u1, v1);
tessellator.addVertexWithUV(i0, j1, kM, u1, v0);
} else if (!connectWest && connectEast) {
// east half-pane
setupTileCoords(TileOverride.SOUTH_FACE);
tessellator.addVertexWithUV(iM, j1, kM, uM, v0);
tessellator.addVertexWithUV(iM, j0, kM, uM, v1);
tessellator.addVertexWithUV(i1, j0, kM, u1, v1);
tessellator.addVertexWithUV(i1, j1, kM, u1, v0);
setupTileCoords(TileOverride.NORTH_FACE);
tessellator.addVertexWithUV(i1, j1, kM, u0, v0);
tessellator.addVertexWithUV(i1, j0, kM, u0, v1);
tessellator.addVertexWithUV(iM, j0, kM, uM, v1);
tessellator.addVertexWithUV(iM, j1, kM, uM, v0);
}
if ((connectNorth && connectSouth) || !connectAny) {
// full north-south pane
setupTileCoords(TileOverride.WEST_FACE);
tessellator.addVertexWithUV(iM, j1, k0, u0, v0);
tessellator.addVertexWithUV(iM, j0, k0, u0, v1);
tessellator.addVertexWithUV(iM, j0, k1, u1, v1);
tessellator.addVertexWithUV(iM, j1, k1, u1, v0);
setupTileCoords(TileOverride.EAST_FACE);
tessellator.addVertexWithUV(iM, j1, k1, u0, v0);
tessellator.addVertexWithUV(iM, j0, k1, u0, v1);
tessellator.addVertexWithUV(iM, j0, k0, u1, v1);
tessellator.addVertexWithUV(iM, j1, k0, u1, v0);
} else if (connectNorth && !connectSouth) {
// north half-pane
setupTileCoords(TileOverride.WEST_FACE);
tessellator.addVertexWithUV(iM, j1, k0, u0, v0);
tessellator.addVertexWithUV(iM, j0, k0, u0, v1);
tessellator.addVertexWithUV(iM, j0, kM, uM, v1);
tessellator.addVertexWithUV(iM, j1, kM, uM, v0);
setupTileCoords(TileOverride.EAST_FACE);
tessellator.addVertexWithUV(iM, j1, kM, uM, v0);
tessellator.addVertexWithUV(iM, j0, kM, uM, v1);
tessellator.addVertexWithUV(iM, j0, k0, u1, v1);
tessellator.addVertexWithUV(iM, j1, k0, u1, v0);
} else if (!connectNorth && connectSouth) {
// south half-pane
setupTileCoords(TileOverride.WEST_FACE);
tessellator.addVertexWithUV(iM, j1, kM, uM, v0);
tessellator.addVertexWithUV(iM, j0, kM, uM, v1);
tessellator.addVertexWithUV(iM, j0, k1, u1, v1);
tessellator.addVertexWithUV(iM, j1, k1, u1, v0);
setupTileCoords(TileOverride.EAST_FACE);
tessellator.addVertexWithUV(iM, j1, k1, uM, v0);
tessellator.addVertexWithUV(iM, j0, k1, uM, v1);
tessellator.addVertexWithUV(iM, j0, kM, u1, v1);
tessellator.addVertexWithUV(iM, j1, kM, u1, v0);
}
}