@Override
protected void generateActualChunk(WorldGenerator generator, PlatMap platmap, ByteChunk chunk, BiomeGrid biomes, DataContext context, int platX, int platZ) {
// look around
SurroundingLots neighbors = new SurroundingLots(platmap, platX, platZ);
// starting with the bottom
int lowestY = getBottomY(generator);
int highestY = generator.streetLevel - groundDepth - 1;
// cistern?
if (generator.settings.includeCisterns) {
chunk.setLayer(lowestY, cisternMaterial);
// fill with water
lowestY++;
if (generator.settings.includeAbovegroundFluids)
chunk.setBlocks(0, chunk.width, lowestY, lowestY + waterDepth, 0, chunk.width, generator.oreProvider.fluidMaterial);
// clear out the rest
chunk.setBlocks(0, chunk.width, lowestY + waterDepth, highestY + 1, 0, chunk.width, getAirMaterial(generator, lowestY + waterDepth));
// outer columns and walls as needed
if (neighbors.toNorth()) {
chunk.setBlocks(3, 5, lowestY, highestY, 0, 1, cisternMaterial);
chunk.setBlocks(11, 13, lowestY, highestY, 0, 1, cisternMaterial);
} else
chunk.setBlocks(0, 16, lowestY, highestY + 1, 0, 1, cisternMaterial);
if (neighbors.toSouth()) {
chunk.setBlocks(3, 5, lowestY, highestY, 15, 16, cisternMaterial);
chunk.setBlocks(11, 13, lowestY, highestY, 15, 16, cisternMaterial);
} else
chunk.setBlocks(0, 16, lowestY, highestY + 1, 15, 16, cisternMaterial);
if (neighbors.toWest()) {
chunk.setBlocks(0, 1, lowestY, highestY, 3, 5, cisternMaterial);
chunk.setBlocks(0, 1, lowestY, highestY, 11, 13, cisternMaterial);
} else
chunk.setBlocks(0, 1, lowestY, highestY + 1, 0, 16, cisternMaterial);
if (neighbors.toEast()) {
chunk.setBlocks(15, 16, lowestY, highestY, 3, 5, cisternMaterial);
chunk.setBlocks(15, 16, lowestY, highestY, 11, 13, cisternMaterial);
} else
chunk.setBlocks(15, 16, lowestY, highestY + 1, 0, 16, cisternMaterial);
// center columns
chunk.setBlocks(7, 9, lowestY, highestY, 3, 5, cisternMaterial);
chunk.setBlocks(7, 9, lowestY, highestY, 11, 13, cisternMaterial);
chunk.setBlocks(3, 5, lowestY, highestY, 7, 9, cisternMaterial);
chunk.setBlocks(11, 13, lowestY, highestY, 7, 9, cisternMaterial);
// ceiling supports
chunk.setBlocks(3, 5, highestY, highestY + 1, 0, 16, cisternMaterial);
chunk.setBlocks(11, 13, highestY, highestY + 1, 0, 16, cisternMaterial);
chunk.setBlocks(0, 16, highestY, highestY + 1, 3, 5, cisternMaterial);
chunk.setBlocks(0, 16, highestY, highestY + 1, 11, 13, cisternMaterial);
// top it off
chunk.setLayer(highestY + 1, cisternMaterial);
} else {
// backfill with dirt
chunk.setLayer(lowestY, highestY + 2 - lowestY, generator.oreProvider.subsurfaceMaterial);
}
// top it off
chunk.setLayer(highestY + 2, generator.oreProvider.subsurfaceMaterial);
chunk.setLayer(highestY + 3, generator.oreProvider.surfaceMaterial);
// surface features
int surfaceY = generator.streetLevel + 1;
if (!neighbors.toNorth() && HeightInfo.isBuildableToNorth(generator, chunk)) {
chunk.setBlocks(0, 6, surfaceY, surfaceY + 1, 0, 1, columnMaterial);
chunk.setBlocks(0, 6, surfaceY + 1, surfaceY + 2, 0, 1, fenceMaterial);
chunk.setBlocks(10, 16, surfaceY, surfaceY + 1, 0, 1, columnMaterial);
chunk.setBlocks(10, 16, surfaceY + 1, surfaceY + 2, 0, 1, fenceMaterial);
chunk.setBlocks(6, surfaceY, surfaceY + 2, 0, columnMaterial);
chunk.setBlocks(7, 9, surfaceY, surfaceY + 1, 0, 1, stepMaterial);
chunk.setBlocks(9, surfaceY, surfaceY + 2, 0, columnMaterial);
chunk.setBlock(6, surfaceY, 1, columnMaterial);
chunk.setBlock(9, surfaceY, 1, columnMaterial);
}
if (!neighbors.toSouth() && HeightInfo.isBuildableToSouth(generator, chunk)) {
chunk.setBlocks(0, 6, surfaceY, surfaceY + 1, 15, 16, columnMaterial);
chunk.setBlocks(0, 6, surfaceY + 1, surfaceY + 2, 15, 16, fenceMaterial);
chunk.setBlocks(10, 16, surfaceY, surfaceY + 1, 15, 16, columnMaterial);
chunk.setBlocks(10, 16, surfaceY + 1, surfaceY + 2, 15, 16, fenceMaterial);
chunk.setBlocks(6, surfaceY, surfaceY + 2, 15, columnMaterial);
chunk.setBlocks(7, 9, surfaceY, surfaceY + 1, 15, 16, stepMaterial);
chunk.setBlocks(9, surfaceY, surfaceY + 2, 15, columnMaterial);
chunk.setBlock(6, surfaceY, 14, columnMaterial);
chunk.setBlock(9, surfaceY, 14, columnMaterial);
}
if (!neighbors.toWest() && HeightInfo.isBuildableToWest(generator, chunk)) {
chunk.setBlocks(0, 1, surfaceY, surfaceY + 1, 0, 6, columnMaterial);
chunk.setBlocks(0, 1, surfaceY + 1, surfaceY + 2, 0, 6, fenceMaterial);
chunk.setBlocks(0, 1, surfaceY, surfaceY + 1, 10, 16, columnMaterial);
chunk.setBlocks(0, 1, surfaceY + 1, surfaceY + 2, 10, 16, fenceMaterial);
chunk.setBlocks(0, surfaceY, surfaceY + 2, 6, columnMaterial);
chunk.setBlocks(0, 1, surfaceY, surfaceY + 1, 7, 9, stepMaterial);
chunk.setBlocks(0, surfaceY, surfaceY + 2, 9, columnMaterial);
chunk.setBlock(1, surfaceY, 6, columnMaterial);
chunk.setBlock(1, surfaceY, 9, columnMaterial);
}
if (!neighbors.toEast() && HeightInfo.isBuildableToEast(generator, chunk)) {
chunk.setBlocks(15, 16, surfaceY, surfaceY + 1, 0, 6, columnMaterial);
chunk.setBlocks(15, 16, surfaceY + 1, surfaceY + 2, 0, 6, fenceMaterial);
chunk.setBlocks(15, 16, surfaceY, surfaceY + 1, 10, 16, columnMaterial);
chunk.setBlocks(15, 16, surfaceY + 1, surfaceY + 2, 10, 16, fenceMaterial);
chunk.setBlocks(15, surfaceY, surfaceY + 2, 6, columnMaterial);