execute as @s run function next_level:structures/find_grass

execute at @s run function next_level:structures/rng

execute at @s[scores={nl.Rng=0..10}] if block ~ ~-1 ~ minecraft:grass_block run setblock ~ ~ ~ minecraft:structure_block[mode=load]{metadata:"",mirror:"NONE",ignoreEntities:0b,powered:0b,seed:0L,author:"?",rotation:"NONE",posX:-8,mode:"LOAD",posY:-8,sizeX:16,posZ:-8,integrity:1.0f,showair:0b,name:"next_level:overworld/barracks",sizeY:16,sizeZ:16,showboundingbox:0b}

execute at @s[scores={nl.Rng=11..20}] if block ~ ~-1 ~ minecraft:grass_block run setblock ~ ~ ~ minecraft:structure_block[mode=load]{metadata:"",mirror:"NONE",ignoreEntities:0b,powered:0b,seed:0L,author:"?",rotation:"NONE",posX:-8,mode:"LOAD",posY:-8,sizeX:16,posZ:-8,integrity:1.0f,showair:0b,name:"next_level:overworld/bills_house",sizeY:16,sizeZ:16,showboundingbox:0b}

execute at @s[scores={nl.Rng=21..30}] if block ~ ~-1 ~ minecraft:grass_block run setblock ~ ~ ~ minecraft:structure_block[mode=load]{metadata:"",mirror:"NONE",ignoreEntities:0b,powered:0b,seed:0L,author:"?",rotation:"NONE",posX:-8,mode:"LOAD",posY:-8,sizeX:16,posZ:-8,integrity:1.0f,showair:0b,name:"next_level:overworld/campsite",sizeY:16,sizeZ:16,showboundingbox:0b}

execute at @s[scores={nl.Rng=31..40}] if block ~ ~-1 ~ minecraft:grass_block run setblock ~ ~ ~ minecraft:structure_block[mode=load]{metadata:"",mirror:"NONE",ignoreEntities:0b,powered:0b,seed:0L,author:"?",rotation:"NONE",posX:-8,mode:"LOAD",posY:-7,sizeX:16,posZ:-8,integrity:1.0f,showair:0b,name:"next_level:overworld/cemetery",sizeY:16,sizeZ:16,showboundingbox:0b}

execute at @s[scores={nl.Rng=41..50}] if block ~ ~-1 ~ minecraft:grass_block run setblock ~ ~ ~ minecraft:structure_block[mode=load]{metadata:"",mirror:"NONE",ignoreEntities:0b,powered:0b,seed:0L,author:"?",rotation:"NONE",posX:-8,mode:"LOAD",posY:-8,sizeX:16,posZ:-8,integrity:1.0f,showair:0b,name:"next_level:overworld/health_pool",sizeY:16,sizeZ:16,showboundingbox:0b}

execute at @s[scores={nl.Rng=51..60}] if block ~ ~-1 ~ minecraft:grass_block run setblock ~ ~ ~ minecraft:structure_block[mode=load]{metadata:"",mirror:"NONE",ignoreEntities:0b,powered:0b,seed:0L,author:"?",rotation:"NONE",posX:-8,mode:"LOAD",posY:-8,sizeX:16,posZ:-8,integrity:1.0f,showair:0b,name:"next_level:overworld/maze",sizeY:16,sizeZ:16,showboundingbox:0b}

execute at @s[scores={nl.Rng=61..70}] if block ~ ~-1 ~ minecraft:grass_block run setblock ~ ~ ~ minecraft:structure_block[mode=load]{metadata:"",mirror:"NONE",ignoreEntities:0b,powered:0b,seed:0L,author:"?",rotation:"NONE",posX:-8,mode:"LOAD",posY:-8,sizeX:16,posZ:-8,integrity:1.0f,showair:0b,name:"next_level:overworld/ruined_tower",sizeY:16,sizeZ:16,showboundingbox:0b}

execute at @s[scores={nl.Rng=71..80}] if block ~ ~-1 ~ minecraft:grass_block run setblock ~ ~ ~ minecraft:structure_block[mode=load]{metadata:"",mirror:"NONE",ignoreEntities:0b,powered:0b,seed:0L,author:"?",rotation:"NONE",posX:-8,mode:"LOAD",posY:-8,sizeX:16,posZ:-8,integrity:1.0f,showair:0b,name:"next_level:overworld/tree_portal",sizeY:16,sizeZ:16,showboundingbox:0b}

execute at @s[scores={nl.Rng=81..90}] if block ~ ~-1 ~ minecraft:grass_block run setblock ~ ~ ~ minecraft:structure_block[mode=load]{metadata:"",mirror:"NONE",ignoreEntities:0b,powered:0b,seed:0L,author:"?",rotation:"NONE",posX:-8,mode:"LOAD",posY:-7,sizeX:16,posZ:-8,integrity:1.0f,showair:0b,name:"next_level:overworld/windmill",sizeY:16,sizeZ:16,showboundingbox:0b}

execute at @s[scores={nl.Rng=91..100}] if block ~ ~-1 ~ minecraft:grass_block run setblock ~ ~ ~ minecraft:structure_block[mode=load]{metadata:"",mirror:"NONE",ignoreEntities:0b,powered:0b,seed:0L,author:"?",rotation:"NONE",posX:-8,mode:"LOAD",posY:-3,sizeX:16,posZ:-8,integrity:1.0f,showair:0b,name:"next_level:overworld/wizard_tower",sizeY:16,sizeZ:16,showboundingbox:0b}

# Turn on
execute at @s if block ~ ~-1 ~ minecraft:grass_block run summon minecraft:falling_block ~ ~2 ~ {BlockState:{Name:"minecraft:redstone_block"},Time:1,DropItem:0b}

execute as @e[tag=nl_Generator] at @s if block ~ 0 ~ minecraft:obsidian run kill @s

kill @s