public virtual void GenerateStructures(BlockPos chunkPos, TerrainGen terrainGen) { if (layerType != LayerType.Structure) { return; } if (customTerrainLayer) { customLayer.GenerateStructures(chunkPos, terrainGen); return; } int minX, maxX, minZ, maxZ; minX = chunkPos.x - structure.negX; maxX = chunkPos.x + Config.Env.ChunkSize + structure.posX; minZ = chunkPos.z - structure.negZ; maxZ = chunkPos.z + Config.Env.ChunkSize + structure.posZ; for (int x = minX; x < maxX; x++) { for (int z = minZ; z < maxZ; z++) { int percentChance = GetNoise(x, 0, z, 10, 100, 1); if (percentChance < chanceToSpawnBlock) { if (percentChance < GetNoise(x + 1, 0, z, 10, 100, 1) && percentChance < GetNoise(x - 1, 0, z, 10, 100, 1) && percentChance < GetNoise(x, 0, z + 1, 10, 100, 1) && percentChance < GetNoise(x, 0, z - 1, 10, 100, 1)) { int height = terrainGen.GenerateTerrainForBlockColumn(x, z, true); structure.Build(world, chunkPos, new BlockPos(x, height, z), this); } } } } }
public virtual void GenerateStructures(BlockPos chunkPos, TerrainGen terrainGen) { if (layerType != LayerType.Structure) return; if (customTerrainLayer) { customLayer.GenerateStructures(chunkPos, terrainGen); return; } int minX, maxX, minZ, maxZ; minX = chunkPos.x - structure.negX; maxX = chunkPos.x + Config.Env.ChunkSize + structure.posX; minZ = chunkPos.z - structure.negZ; maxZ = chunkPos.z + Config.Env.ChunkSize + structure.posZ; for (int x = minX; x < maxX; x++) { for (int z = minZ; z < maxZ; z++) { int percentChance = GetNoise(x, 0, z, 10, 100, 1); if (percentChance < chanceToSpawnBlock) { if (percentChance < GetNoise(x + 1, 0, z, 10, 100, 1) && percentChance < GetNoise(x - 1, 0, z, 10, 100, 1) && percentChance < GetNoise(x, 0, z + 1, 10, 100, 1) && percentChance < GetNoise(x, 0, z - 1, 10, 100, 1)) { int height = terrainGen.GenerateTerrainForBlockColumn(x, z, true); structure.Build(world, chunkPos, new BlockPos(x, height, z), this); } } } } }