boolean doSewer = generator.settings.includeSewers && cityRoad;
//chunk.setBlocks(6, 10, pavementLevel + 32, 6, 10, Material.GLOWSTONE);
// look around
SurroundingRoads roads = new SurroundingRoads(platmap, platX, platZ);
// what are we making?
if (HeightInfo.getHeightsFast(generator, originX, originZ).isSea()) {
doSewer = false;
// clear a little space
chunk.setLayer(sidewalkLevel, 4, getAirMaterial(generator, sidewalkLevel));
// bridge to the east/west
if (roads.toWest() && roads.toEast()) {
// more bridge beside this one?
boolean toWest = HeightInfo.getHeightsFast(generator, originX - chunk.width, originZ).isSea();
boolean toEast = HeightInfo.getHeightsFast(generator, originX + chunk.width, originZ).isSea();
if (toWest) {
// tall span
if (toEast) {
placeWBridgeColumns(chunk, sidewalkLevel + 4);
placeEWBridgePartA(chunk, 0, sidewalkLevel + 4);
placeEWBridgePartA(chunk, 2, sidewalkLevel + 4);
placeEWBridgePartA(chunk, 4, sidewalkLevel + 4);
placeEWBridgePartA(chunk, 6, sidewalkLevel + 4);
placeEWBridgePartA(chunk, 8, sidewalkLevel + 4);
placeEWBridgePartA(chunk, 10, sidewalkLevel + 4);
placeEWBridgePartA(chunk, 12, sidewalkLevel + 4);
placeEWBridgePartA(chunk, 14, sidewalkLevel + 4);
placeEBridgeColumns(chunk, sidewalkLevel + 4);
// ramp down
} else {
placeEWBridgeCap(chunk, 14, base1Y, sidewalkLevel);
placeEWBridgePartA(chunk, 14, sidewalkLevel);
placeEWBridgePartB(chunk, 12, sidewalkLevel);
placeEWBridgePartA(chunk, 10, sidewalkLevel + 1);
placeEWBridgePartB(chunk, 8, sidewalkLevel + 1);
placeEWBridgePartA(chunk, 6, sidewalkLevel + 2);
placeEWBridgePartB(chunk, 4, sidewalkLevel + 2);
placeEWBridgePartA(chunk, 2, sidewalkLevel + 3);
placeEWBridgePartB(chunk, 0, sidewalkLevel + 3);
placeWBridgeColumns(chunk, sidewalkLevel + 3);
}
} else {
// ramp up
if (toEast) {
placeEWBridgeCap(chunk, 0, base1Y, sidewalkLevel);
placeEWBridgePartA(chunk, 0, sidewalkLevel);
placeEWBridgePartB(chunk, 2, sidewalkLevel);
placeEWBridgePartA(chunk, 4, sidewalkLevel + 1);
placeEWBridgePartB(chunk, 6, sidewalkLevel + 1);
placeEWBridgePartA(chunk, 8, sidewalkLevel + 2);
placeEWBridgePartB(chunk, 10, sidewalkLevel + 2);
placeEWBridgePartA(chunk, 12, sidewalkLevel + 3);
placeEWBridgePartB(chunk, 14, sidewalkLevel + 3);
placeEBridgeColumns(chunk, sidewalkLevel + 3);
// short span
} else {
placeEWBridgeCap(chunk, 0, base1Y, sidewalkLevel);
placeEWBridgePartA(chunk, 0, sidewalkLevel);
placeEWBridgePartB(chunk, 2, sidewalkLevel);
placeEWBridgePartA(chunk, 4, sidewalkLevel + 1);
placeEWBridgePartA(chunk, 6, sidewalkLevel + 1);
placeEWBridgePartA(chunk, 8, sidewalkLevel + 1);
placeEWBridgePartA(chunk, 10, sidewalkLevel + 1);
placeEWBridgePartB(chunk, 12, sidewalkLevel);
placeEWBridgePartA(chunk, 14, sidewalkLevel);
placeEWBridgeCap(chunk, 14, base1Y, sidewalkLevel);
}
}
} else if (roads.toNorth() && roads.toSouth()) {
// more bridge beside this one?
boolean toNorth = HeightInfo.getHeightsFast(generator, originX, originZ - chunk.width).isSea();
boolean toSouth = HeightInfo.getHeightsFast(generator, originX, originZ + chunk.width).isSea();
if (toNorth) {
// tall span
if (toSouth) {
placeNBridgeColumns(chunk, sidewalkLevel + 4);
placeNSBridgePartA(chunk, 0, sidewalkLevel + 4);
placeNSBridgePartA(chunk, 2, sidewalkLevel + 4);
placeNSBridgePartA(chunk, 4, sidewalkLevel + 4);
placeNSBridgePartA(chunk, 6, sidewalkLevel + 4);
placeNSBridgePartA(chunk, 8, sidewalkLevel + 4);
placeNSBridgePartA(chunk, 10, sidewalkLevel + 4);
placeNSBridgePartA(chunk, 12, sidewalkLevel + 4);
placeNSBridgePartA(chunk, 14, sidewalkLevel + 4);
placeSBridgeColumns(chunk, sidewalkLevel + 4);
// ramp down
} else {
placeNSBridgeCap(chunk, 14, base1Y, sidewalkLevel);
placeNSBridgePartA(chunk, 14, sidewalkLevel);
placeNSBridgePartB(chunk, 12, sidewalkLevel);
placeNSBridgePartA(chunk, 10, sidewalkLevel + 1);
placeNSBridgePartB(chunk, 8, sidewalkLevel + 1);
placeNSBridgePartA(chunk, 6, sidewalkLevel + 2);
placeNSBridgePartB(chunk, 4, sidewalkLevel + 2);
placeNSBridgePartA(chunk, 2, sidewalkLevel + 3);
placeNSBridgePartB(chunk, 0, sidewalkLevel + 3);
placeNBridgeColumns(chunk, sidewalkLevel + 3);
}
} else {
// ramp up
if (toSouth) {
placeNSBridgeCap(chunk, 0, base1Y, sidewalkLevel);
placeNSBridgePartA(chunk, 0, sidewalkLevel);
placeNSBridgePartB(chunk, 2, sidewalkLevel);
placeNSBridgePartA(chunk, 4, sidewalkLevel + 1);
placeNSBridgePartB(chunk, 6, sidewalkLevel + 1);
placeNSBridgePartA(chunk, 8, sidewalkLevel + 2);
placeNSBridgePartB(chunk, 10, sidewalkLevel + 2);
placeNSBridgePartA(chunk, 12, sidewalkLevel + 3);
placeNSBridgePartB(chunk, 14, sidewalkLevel + 3);
placeSBridgeColumns(chunk, sidewalkLevel + 3);
// short span
} else {
placeNSBridgeCap(chunk, 0, base1Y, sidewalkLevel);
placeNSBridgePartA(chunk, 0, sidewalkLevel);
placeNSBridgePartB(chunk, 2, sidewalkLevel);
placeNSBridgePartA(chunk, 4, sidewalkLevel + 1);
placeNSBridgePartA(chunk, 6, sidewalkLevel + 1);
placeNSBridgePartA(chunk, 8, sidewalkLevel + 1);
placeNSBridgePartA(chunk, 10, sidewalkLevel + 1);
placeNSBridgePartB(chunk, 12, sidewalkLevel);
placeNSBridgePartA(chunk, 14, sidewalkLevel);
placeNSBridgeCap(chunk, 14, base1Y, sidewalkLevel);
}
}
}
// draw a bridge bits
// bridge to the east/west
if (cityRoad) {
if (roads.toWest() && roads.toEast()) {
if (HeightInfo.getHeightsFast(generator, originX - chunk.width, originZ).isSea() &&
HeightInfo.getHeightsFast(generator, originX + chunk.width, originZ).isSea()) {
// lights please
generateLightPost(generator, chunk, context, sidewalkLevel + 5, 7, 0);
generateLightPost(generator, chunk, context, sidewalkLevel + 5, 8, 15);
}
} else if (roads.toNorth() && roads.toSouth()) {
if (HeightInfo.getHeightsFast(generator, originX, originZ - chunk.width).isSea() &&
HeightInfo.getHeightsFast(generator, originX, originZ + chunk.width).isSea()) {
// lights please
generateLightPost(generator, chunk, context, sidewalkLevel + 5, 0, 7);
generateLightPost(generator, chunk, context, sidewalkLevel + 5, 15, 8);
}
}
}
// not a happy place?
if (generator.settings.includeDecayedRoads)
destroyLot(generator, sidewalkLevel + 5, sidewalkLevel + 6);
} else {
Material sidewalkMaterial = getSidewalkMaterial();
// draw pavement and clear out a bit
paveRoadLot(chunk, pavementLevel);
if (pavementLevel != sidewalkLevel)
chunk.setLayer(sidewalkLevel, getAirMaterial(generator, sidewalkLevel));
Material emptyMaterial = getAirMaterial(generator, sidewalkLevel + 1);
// sidewalk corners
chunk.setBlocks(0, sidewalkWidth, sidewalkLevel, sidewalkLevel + 1, 0, sidewalkWidth, sidewalkMaterial);
chunk.setBlocks(0, sidewalkWidth, sidewalkLevel, sidewalkLevel + 1, chunk.width - sidewalkWidth, chunk.width, sidewalkMaterial);
chunk.setBlocks(chunk.width - sidewalkWidth, chunk.width, sidewalkLevel, sidewalkLevel + 1, 0, sidewalkWidth, sidewalkMaterial);
chunk.setBlocks(chunk.width - sidewalkWidth, chunk.width, sidewalkLevel, sidewalkLevel + 1, chunk.width - sidewalkWidth, chunk.width, sidewalkMaterial);
// sidewalk edges
if (!roads.toWest())
chunk.setBlocks(0, sidewalkWidth, sidewalkLevel, sidewalkLevel + 1, sidewalkWidth, chunk.width - sidewalkWidth, sidewalkMaterial);
if (!roads.toEast())
chunk.setBlocks(chunk.width - sidewalkWidth, chunk.width, sidewalkLevel, sidewalkLevel + 1, sidewalkWidth, chunk.width - sidewalkWidth, sidewalkMaterial);
if (!roads.toNorth())
chunk.setBlocks(sidewalkWidth, chunk.width - sidewalkWidth, sidewalkLevel, sidewalkLevel + 1, 0, sidewalkWidth, sidewalkMaterial);
if (!roads.toSouth())
chunk.setBlocks(sidewalkWidth, chunk.width - sidewalkWidth, sidewalkLevel, sidewalkLevel + 1, chunk.width - sidewalkWidth, chunk.width, sidewalkMaterial);
// crosswalks?
if (cityRoad) {
calculateCrosswalks(roads);
// draw the crosswalk bits
generateNSCrosswalk(chunk, sidewalkWidth, chunk.width - sidewalkWidth, pavementLevel, 0, sidewalkWidth, crosswalkNorth);
generateNSCrosswalk(chunk, sidewalkWidth, chunk.width - sidewalkWidth, pavementLevel, chunk.width - sidewalkWidth, chunk.width, crosswalkSouth);
generateWECrosswalk(chunk, 0, sidewalkWidth, pavementLevel, sidewalkWidth, chunk.width - sidewalkWidth, crosswalkWest);
generateWECrosswalk(chunk, chunk.width - sidewalkWidth, chunk.width, pavementLevel, sidewalkWidth, chunk.width - sidewalkWidth, crosswalkEast);
}
// tunnel walls please
if (blockYs.maxHeight > sidewalkLevel + tunnelHeight) {
doSewer = false;
// // draw pavement
// chunk.setLayer(pavementLevel - 1, 2, pavementId);
// tunnel to the east/west
if (roads.toWest() && roads.toEast()) {
// carve out the tunnel
chunk.setBlocks(0, 16, sidewalkLevel + 1, sidewalkLevel + 6, 2, 14, emptyMaterial);
// place the arches
placeEWTunnelArch(generator, chunk, 0, sidewalkLevel, tunnelWallMaterial, tunnelWallMaterial, tunnelWallMaterial);
for (int x = 1; x < chunk.width - 1; x++) {
placeEWTunnelArch(generator, chunk, x, sidewalkLevel, tunnelWallMaterial, tunnelTileMaterial, tunnelCeilingMaterial);
}
placeEWTunnelArch(generator, chunk, 15, sidewalkLevel, tunnelWallMaterial, tunnelWallMaterial, tunnelWallMaterial);
} else if (roads.toNorth() && roads.toSouth()) {
// carve out the tunnel
chunk.setBlocks(2, 14, sidewalkLevel + 1, sidewalkLevel + 6, 0, 16, emptyMaterial);
// place the arches
placeNSTunnelArch(generator, chunk, 0, sidewalkLevel, tunnelWallMaterial, tunnelWallMaterial, tunnelWallMaterial);
for (int z = 1; z < chunk.width - 1; z++) {
placeNSTunnelArch(generator, chunk, z, sidewalkLevel, tunnelWallMaterial, tunnelTileMaterial, tunnelCeilingMaterial);
}
placeNSTunnelArch(generator, chunk, 15, sidewalkLevel, tunnelWallMaterial, tunnelWallMaterial, tunnelWallMaterial);
}
// retaining walls please
} else if (blockYs.maxHeight > sidewalkLevel) {
// wall to the east/west
if (roads.toWest() && roads.toEast()) {
// carve out the tunnel
chunk.setBlocks(0, 16, sidewalkLevel + 1, sidewalkLevel + tunnelHeight + 1, 0, 16, emptyMaterial);
// walls please, this will find the Y the hard way since we are looking at the next chunk over
for (int x = 0; x < chunk.width; x++) {
placeRetainingWall(chunk, x, 0, sidewalkLevel, generator.getFarBlockY(originX + x, originZ - 1));
placeRetainingWall(chunk, x, 15, sidewalkLevel, generator.getFarBlockY(originX + x, originZ + 16));
}
} else if (roads.toNorth() && roads.toSouth()) {
// carve out the tunnel
chunk.setBlocks(0, 16, sidewalkLevel + 1, sidewalkLevel + tunnelHeight + 1, 0, 16, emptyMaterial);
// walls please, this will find the Y the hard way since we are looking at the next chunk over
for (int z = 0; z < chunk.width; z++) {
placeRetainingWall(chunk, 0, z, sidewalkLevel, generator.getFarBlockY(originX - 1, originZ + z));
placeRetainingWall(chunk, 15, z, sidewalkLevel, generator.getFarBlockY(originX + 16, originZ + z));
}
}
// stuff that only can happen outside of tunnels and bridges
} else {
// round things out
if (!roads.toWest() && roads.toEast() && !roads.toNorth() && roads.toSouth())
generateRoundedOut(generator, context, chunk, sidewalkWidth, sidewalkWidth,
false, false);
if (!roads.toWest() && roads.toEast() && roads.toNorth() && !roads.toSouth())
generateRoundedOut(generator, context, chunk, sidewalkWidth, chunk.width - sidewalkWidth - 4,
false, true);
if (roads.toWest() && !roads.toEast() && !roads.toNorth() && roads.toSouth())
generateRoundedOut(generator, context, chunk, chunk.width - sidewalkWidth - 4, sidewalkWidth,
true, false);
if (roads.toWest() && !roads.toEast() && roads.toNorth() && !roads.toSouth())
generateRoundedOut(generator, context, chunk, chunk.width - sidewalkWidth - 4, chunk.width - sidewalkWidth - 4,
true, true);
}
// crosswalks?
calculateCrosswalks(roads);
// // center bit
// chunk.setClay(sidewalkWidth, chunk.width - sidewalkWidth, pavementLevel, sidewalkWidth, chunk.width - sidewalkWidth, pavementColor);
// draw the crosswalk bits
generateNSCrosswalk(chunk, sidewalkWidth, chunk.width - sidewalkWidth, pavementLevel, 0, sidewalkWidth, crosswalkNorth);
generateNSCrosswalk(chunk, sidewalkWidth, chunk.width - sidewalkWidth, pavementLevel, chunk.width - sidewalkWidth, chunk.width, crosswalkSouth);
generateWECrosswalk(chunk, 0, sidewalkWidth, pavementLevel, sidewalkWidth, chunk.width - sidewalkWidth, crosswalkWest);
generateWECrosswalk(chunk, chunk.width - sidewalkWidth, chunk.width, pavementLevel, sidewalkWidth, chunk.width - sidewalkWidth, crosswalkEast);
// decay please
if (generator.settings.includeDecayedRoads) {
// center bit
decayRoad(chunk, sidewalkWidth, chunk.width - sidewalkWidth, pavementLevel, sidewalkWidth, chunk.width - sidewalkWidth);
// road to the whatever
if (roads.toNorth())
decayRoad(chunk, sidewalkWidth, chunk.width - sidewalkWidth, pavementLevel, 0, sidewalkWidth);
if (roads.toSouth())
decayRoad(chunk, sidewalkWidth, chunk.width - sidewalkWidth, pavementLevel, chunk.width - sidewalkWidth, chunk.width);
if (roads.toWest())
decayRoad(chunk, 0, sidewalkWidth, pavementLevel, sidewalkWidth, chunk.width - sidewalkWidth);
if (roads.toEast())
decayRoad(chunk, chunk.width - sidewalkWidth, chunk.width, pavementLevel, sidewalkWidth, chunk.width - sidewalkWidth);
// sidewalk corners
decaySidewalk(generator, chunk, 0, sidewalkWidth, sidewalkLevel, 0, sidewalkWidth);
decaySidewalk(generator, chunk, 0, sidewalkWidth, sidewalkLevel, chunk.width - sidewalkWidth, chunk.width);
decaySidewalk(generator, chunk, chunk.width - sidewalkWidth, chunk.width, sidewalkLevel, 0, sidewalkWidth);
decaySidewalk(generator, chunk, chunk.width - sidewalkWidth, chunk.width, sidewalkLevel, chunk.width - sidewalkWidth, chunk.width);
// sidewalk edges
if (!roads.toWest())
decaySidewalk(generator, chunk, 0, sidewalkWidth, sidewalkLevel, sidewalkWidth, chunk.width - sidewalkWidth);
if (!roads.toEast())
decaySidewalk(generator, chunk, chunk.width - sidewalkWidth, chunk.width, sidewalkLevel, sidewalkWidth, chunk.width - sidewalkWidth);
if (!roads.toNorth())
decaySidewalk(generator, chunk, sidewalkWidth, chunk.width - sidewalkWidth, sidewalkLevel, 0, sidewalkWidth);
if (!roads.toSouth())
decaySidewalk(generator, chunk, sidewalkWidth, chunk.width - sidewalkWidth, sidewalkLevel, chunk.width - sidewalkWidth, chunk.width);
}
// tunnel please
if (blockYs.maxHeight > sidewalkLevel + tunnelHeight) {
doSewer = false;
// tunnel to the east/west
if (roads.toWest() && roads.toEast()) {
chunk.setBlock(3, sidewalkLevel + 7, 8, context.lightMat);
chunk.setBlock(12, sidewalkLevel + 7, 7, context.lightMat);
} else if (roads.toNorth() && roads.toSouth()) {
chunk.setBlock(8, sidewalkLevel + 7, 3, context.lightMat);
chunk.setBlock(7, sidewalkLevel + 7, 12, context.lightMat);
}
// add nature on top
generateSurface(generator, chunk, true);
//TODO decay tunnels please!
// stuff that only can happen outside of tunnels and bridges
} else {
// light posts
if (cityRoad) {
boolean lightPostNW = generateLightPost(generator, chunk, context, sidewalkLevel, sidewalkWidth - 1, sidewalkWidth - 1);
boolean lightPostSE = generateLightPost(generator, chunk, context, sidewalkLevel, chunk.width - sidewalkWidth, chunk.width - sidewalkWidth);
// put signs up?
if (generator.settings.includeNamedRoads) {
// if we haven't calculated crosswalks yet do so
calculateCrosswalks(roads);
// add the signs
if (lightPostNW && (crosswalkNorth || crosswalkWest))
generateStreetSign(generator, chunk, sidewalkLevel, sidewalkWidth - 1, sidewalkWidth - 1);
if (lightPostSE && (crosswalkSouth || crosswalkEast))
generateStreetSign(generator, chunk, sidewalkLevel, chunk.width - sidewalkWidth, chunk.width - sidewalkWidth);
}
}
}
}
// sewer?
if (doSewer) {
// defaults
boolean vaultNorthWest = false;
boolean vaultSouthWest = false;
boolean vaultNorthEast = false;
boolean vaultSouthEast = false;
boolean centerNorth = !roads.toNorth();
boolean centerSouth = !roads.toSouth();
boolean centerWest = !roads.toWest();
boolean centerEast = !roads.toEast();
// empty out the sewer
chunk.setLayer(base1Y, base2Y - base1Y, getAirMaterial(generator, base1Y));
Material emptyMaterial = getAirMaterial(generator, sewerY - 1);
// draw the floor of the sewer
chunk.setBlocks(0, 16, sewerY - 1, sewerY, 0, 16, sewerMaterial, chunkOdds, sewerFloorData, sewerCeilingData);
chunk.setBlocks(crossDitchEdge, chunk.width - crossDitchEdge,
sewerY - 1, sewerY,
crossDitchEdge, chunk.width - crossDitchEdge, emptyMaterial);
// corner bits
chunk.setBlocks(0, 6, sewerY, base2Y, 0, 1, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(0, 1, sewerY, base2Y, 1, 6, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(10, 16, sewerY, base2Y, 0, 1, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(15, 16, sewerY, base2Y, 1, 6, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(0, 6, sewerY, base2Y, 15, 16, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(0, 1, sewerY, base2Y, 10, 15, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(10, 16, sewerY, base2Y, 15, 16, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(15, 16, sewerY, base2Y, 10, 15, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
// cross beams
chunk.setBlocks(6, 10, base2Y - 1, base2Y, 0, 1, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
chunk.setBlocks(6, 10, base2Y - 1, base2Y, 15, 16, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
chunk.setBlocks(0, 1, base2Y - 1, base2Y, 6, 10, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
chunk.setBlocks(15, 16, base2Y - 1, base2Y, 6, 10, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
// cardinal directions known walls and ditches
if (!roads.toNorth()) {
chunk.setBlocks(5, 11, sewerY, base2Y, 0, 1, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(5, 11, base2Y - 1, base2Y, 1, 2, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
} else {
chunk.setBlocks(7, 9, sewerY - 1, sewerY, 0, 7, emptyMaterial);
}
if (!roads.toSouth()) {
chunk.setBlocks(5, 11, sewerY, base2Y, 15, 16, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(5, 11, base2Y - 1, base2Y, 14, 15, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
} else {
chunk.setBlocks(7, 9, sewerY - 1, sewerY, 9, 16, emptyMaterial);
}
if (!roads.toWest()) {
chunk.setBlocks(0, 1, sewerY, base2Y, 5, 11, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(1, 2, base2Y - 1, base2Y, 5, 11, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
} else {
chunk.setBlocks(0, 7, sewerY - 1, sewerY, 7, 9, emptyMaterial);
}
if (!roads.toEast()) {
chunk.setBlocks(15, 16, sewerY, base2Y, 5, 11, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(14, 15, base2Y - 1, base2Y, 5, 11, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
} else {
chunk.setBlocks(9, 16, sewerY - 1, sewerY, 7, 9, emptyMaterial);
}
// show our bias
if (roads.toNorth()) {
vaultNorthWest = sewerNorthWestBias;
vaultNorthEast = sewerNorthEastBias;
}
if (roads.toSouth()) {
vaultSouthWest = sewerSouthWestBias;
vaultSouthEast = sewerSouthEastBias;
}
if (roads.toWest()) {
vaultNorthWest = sewerNorthWestBias;
vaultSouthWest = sewerSouthWestBias;
}
if (roads.toEast()) {
vaultNorthEast = sewerNorthEastBias;
vaultSouthEast = sewerSouthEastBias;
}
// make sure there is a way down
if (roads.toNorth() && roads.toWest()) {
vaultNorthWest = true;
}
// figure out the center
if (!(vaultNorthWest && vaultNorthEast && vaultSouthWest && vaultSouthEast)) {
centerNorth = sewerCenterBit || (vaultNorthWest && vaultNorthEast);
centerSouth = sewerCenterBit || (vaultSouthWest && vaultSouthEast);
centerWest = sewerCenterBit || (vaultNorthWest && vaultSouthWest);
centerEast = sewerCenterBit || (vaultNorthEast && vaultSouthEast);
}
// show the vaults
if (vaultNorthWest) {
chunk.setBlocks(4, 5, sewerY, base2Y - 1, 1, 4, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(1, 4, sewerY, base2Y - 1, 4, 5, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(1, 6, base2Y - 1, base2Y, 1, 6, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
} else {
chunk.setBlocks(1, 6, base2Y - 1, base2Y, 1, 2, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
chunk.setBlocks(1, 2, base2Y - 1, base2Y, 2, 6, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
}
if (vaultSouthWest) {
chunk.setBlocks(4, 5, sewerY, base2Y - 1, 12, 15, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(1, 4, sewerY, base2Y - 1, 11, 12, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(1, 6, base2Y - 1, base2Y, 10, 15, sewerMaterial, sewerCeilingData);
} else {
chunk.setBlocks(1, 6, base2Y - 1, base2Y, 14, 15, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
chunk.setBlocks(1, 2, base2Y - 1, base2Y, 10, 14, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
}
if (vaultNorthEast) {
chunk.setBlocks(11, 12, sewerY, base2Y - 1, 1, 4, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(12, 15, sewerY, base2Y - 1, 4, 5, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(10, 15, base2Y - 1, base2Y, 1, 6, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
} else {
chunk.setBlocks(10, 15, base2Y - 1, base2Y, 1, 2, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
chunk.setBlocks(14, 15, base2Y - 1, base2Y, 2, 6, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
}
if (vaultSouthEast) {
chunk.setBlocks(11, 12, sewerY, base2Y - 1, 12, 15, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(12, 15, sewerY, base2Y - 1, 11, 12, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(10, 15, base2Y - 1, base2Y, 10, 15, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
} else {
chunk.setBlocks(10, 15, base2Y - 1, base2Y, 14, 15, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
chunk.setBlocks(14, 15, base2Y - 1, base2Y, 10, 14, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
}
// show the center center
if (centerNorth) {
chunk.setBlocks(4, 12, sewerY, base2Y - 1, 4, 5, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(3, 13, base2Y - 1, base2Y, 3, 6, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
}
if (centerSouth) {
chunk.setBlocks(4, 12, sewerY, base2Y - 1, 11, 12, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(3, 13, base2Y - 1, base2Y, 10, 13, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
}
if (centerWest) {
chunk.setBlocks(4, 5, sewerY, base2Y - 1, 4, 12, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(3, 6, base2Y - 1, base2Y, 3, 13, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
}
if (centerEast) {
chunk.setBlocks(11, 12, sewerY, base2Y - 1, 4, 12, sewerMaterial, chunkOdds, sewerWallData, sewerFloorData);
chunk.setBlocks(10, 13, base2Y - 1, base2Y, 3, 13, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
}
// ceiling please
chunk.setBlocks(0, 16, base2Y, base2Y + 1, 0, 16, sewerMaterial, chunkOdds, sewerCeilingData, sewerWallData);
// show our bias
if (roads.toNorth()) {
vaultNorthWest = sewerNorthWestBias;
vaultNorthEast = sewerNorthEastBias;
}
if (roads.toSouth()) {
vaultSouthWest = sewerSouthWestBias;
vaultSouthEast = sewerSouthEastBias;
}
if (roads.toWest()) {
vaultNorthWest = sewerNorthWestBias;
vaultSouthWest = sewerSouthWestBias;
}
if (roads.toEast()) {
vaultNorthEast = sewerNorthEastBias;
vaultSouthEast = sewerSouthEastBias;
}
// make sure there is a way down
if (roads.toNorth() && roads.toWest()) {
vaultNorthWest = true;
// place the manhole
chunk.setTrapDoor(3, sidewalkLevel, 2, Direction.TrapDoor.WEST);
// ladder
chunk.setLadder(3, sewerY, sidewalkLevel, 2, Direction.General.WEST);
}
// figure out the center
if (!(vaultNorthWest && vaultNorthEast && vaultSouthWest && vaultSouthEast)) {
centerNorth = sewerCenterBit || (vaultNorthWest && vaultNorthEast);
centerSouth = sewerCenterBit || (vaultSouthWest && vaultSouthEast);
centerWest = sewerCenterBit || (vaultNorthWest && vaultSouthWest);
centerEast = sewerCenterBit || (vaultNorthEast && vaultSouthEast);
}
Material fluidMaterial = generator.oreProvider.fluidFluidMaterial;
// cardinal directions known walls and ditches
if (roads.toNorth()) {
chunk.setBlock(8, sewerY - 1, 3, fluidMaterial);
generateEntryVines(chunk, base2Y - 1, Direction.Vine.NORTH, 6, 1, 7, 1, 8, 1, 9, 1);
}
if (roads.toSouth()) {
chunk.setBlock(7, sewerY - 1, 12, fluidMaterial);
generateEntryVines(chunk, base2Y - 1, Direction.Vine.SOUTH, 6, 14, 7, 14, 8, 14, 9, 14);
}
if (roads.toWest()) {
chunk.setBlock(3, sewerY - 1, 7, fluidMaterial);
generateEntryVines(chunk, base2Y - 1, Direction.Vine.WEST, 1, 6, 1, 7, 1, 8, 1, 9);
}
if (roads.toEast()) {
chunk.setBlock(12, sewerY - 1, 8, fluidMaterial);
generateEntryVines(chunk, base2Y - 1, Direction.Vine.EAST, 14, 6, 14, 7, 14, 8, 14, 9);
}
// add the various doors
if (vaultNorthWest) {
generateDoor(chunk, 4, sewerY, 1, Direction.Door.EASTBYNORTHEAST);
generateDoor(chunk, 1, sewerY, 4, Direction.Door.SOUTHBYSOUTHWEST);
}
if (vaultNorthEast) {
generateDoor(chunk, 11, sewerY, 1, Direction.Door.WESTBYNORTHWEST);
generateDoor(chunk, 14, sewerY, 4, Direction.Door.SOUTHBYSOUTHEAST);
}
if (vaultSouthWest) {
generateDoor(chunk, 1, sewerY, 11, Direction.Door.NORTHBYNORTHWEST);
generateDoor(chunk, 4, sewerY, 14, Direction.Door.EASTBYSOUTHEAST);
}
if (vaultSouthEast) {
generateDoor(chunk, 14, sewerY, 11, Direction.Door.NORTHBYNORTHEAST);
generateDoor(chunk, 11, sewerY, 14, Direction.Door.WESTBYSOUTHWEST);
}
// we might put down a plank... or maybe not...
boolean placedPlank = false;
// fancy up the center walls?
if (centerNorth) {
generateDoor(chunk, 10, sewerY, 4, Direction.Door.NORTHBYNORTHEAST);
chunk.setStoneSlab(7, sewerY, 4, Direction.StoneSlab.COBBLESTONEFLIP);
chunk.setStoneSlab(8, sewerY, 4, Direction.StoneSlab.COBBLESTONEFLIP);
} else if (!placedPlank && roads.toNorth() && chunkOdds.flipCoin()) {
placedPlank = true;
BlackMagic.setBlocks(chunk, 6, 10, sewerY, 5, 6, sewerPlankMaterial, sewerPlankData);
}
if (centerSouth) {
generateDoor(chunk, 5, sewerY, 11, Direction.Door.SOUTHBYSOUTHWEST);
chunk.setStoneSlab(7, sewerY, 11, Direction.StoneSlab.COBBLESTONEFLIP);
chunk.setStoneSlab(8, sewerY, 11, Direction.StoneSlab.COBBLESTONEFLIP);
} else if (!placedPlank && roads.toSouth() && chunkOdds.flipCoin()) {
placedPlank = true;
BlackMagic.setBlocks(chunk, 6, 10, sewerY, 10, 11, sewerPlankMaterial, sewerPlankData);
}
if (centerWest) {
generateDoor(chunk, 4, sewerY, 5, Direction.Door.WESTBYNORTHWEST);
chunk.setStoneSlab(4, sewerY, 7, Direction.StoneSlab.COBBLESTONEFLIP);
chunk.setStoneSlab(4, sewerY, 8, Direction.StoneSlab.COBBLESTONEFLIP);
} else if (!placedPlank && roads.toWest() && chunkOdds.flipCoin()) {
placedPlank = true;
BlackMagic.setBlocks(chunk, 5, 6, sewerY, 6, 10, sewerPlankMaterial, sewerPlankData);
}
if (centerEast) {
generateDoor(chunk, 11, sewerY, 10, Direction.Door.EASTBYSOUTHEAST);
chunk.setStoneSlab(11, sewerY, 7, Direction.StoneSlab.COBBLESTONEFLIP);
chunk.setStoneSlab(11, sewerY, 8, Direction.StoneSlab.COBBLESTONEFLIP);
} else if (!placedPlank && roads.toEast() && chunkOdds.flipCoin()) {
placedPlank = true;
BlackMagic.setBlocks(chunk, 10, 11, sewerY, 6, 10, sewerPlankMaterial, sewerPlankData);
}
// populate the vaults
if (vaultNorthWest) {
if (!(roads.toNorth() && roads.toWest())) // special case for manholes
generateTreat(generator, chunk, 2, sewerY, 2);
}
if (vaultNorthEast) {
generateTreat(generator, chunk, 13, sewerY, 2);
}