## Called from start/cajas

# GreenGlass
execute if score @s cage_type matches 2 run fill ~1 ~-1 ~1 ~-1 ~2 ~-1 minecraft:lime_stained_glass replace glass
# Barrier
execute if score @s cage_type matches 3 run fill ~1 ~-1 ~1 ~-1 ~2 ~-1 minecraft:barrier replace glass
# Jail
execute if score @s cage_type matches 4 run fill ~1 ~2 ~1 ~-1 ~2 ~-1 minecraft:stone_bricks
execute if score @s cage_type matches 4 run fill ~1 ~-1 ~1 ~-1 ~-1 ~-1 minecraft:stone_bricks
execute if score @s cage_type matches 4 run fill ~1 ~ ~1 ~-1 ~1 ~-1 minecraft:iron_bars replace glass
execute if score @s cage_type matches 4 run setblock ~-1 ~-1 ~-1 minecraft:stone_brick_slab[type=top]
execute if score @s cage_type matches 4 run setblock ~1 ~-1 ~1 minecraft:stone_brick_slab[type=top]
execute if score @s cage_type matches 4 run setblock ~1 ~-1 ~-1 minecraft:stone_brick_slab[type=top]
execute if score @s cage_type matches 4 run setblock ~-1 ~-1 ~1 minecraft:stone_brick_slab[type=top]
execute if score @s cage_type matches 4 run setblock ~-1 ~2 ~-1 minecraft:stone_brick_slab[type=bottom]
execute if score @s cage_type matches 4 run setblock ~1 ~2 ~1 minecraft:stone_brick_slab[type=bottom]
execute if score @s cage_type matches 4 run setblock ~1 ~2 ~-1 minecraft:stone_brick_slab[type=bottom]
execute if score @s cage_type matches 4 run setblock ~-1 ~2 ~1 minecraft:stone_brick_slab[type=bottom]
# Piston
execute if score @s cage_type matches 5 run fill ~1 ~-1 ~1 ~-1 ~2 ~-1 minecraft:air replace glass
execute if score @s cage_type matches 5 run fill ~ ~-1 ~1 ~ ~-1 ~-1 minecraft:piston[facing=up]
execute if score @s cage_type matches 5 run fill ~1 ~-1 ~ ~-1 ~-1 ~ minecraft:piston[facing=up]
execute if score @s cage_type matches 5 run fill ~ ~2 ~1 ~ ~2 ~-1 minecraft:piston[facing=down]
execute if score @s cage_type matches 5 run fill ~1 ~2 ~ ~-1 ~2 ~ minecraft:piston[facing=down]
execute if score @s cage_type matches 5 run setblock ~-1 ~-1 ~-1 minecraft:redstone_block
execute if score @s cage_type matches 5 run setblock ~1 ~-1 ~1 minecraft:redstone_block
execute if score @s cage_type matches 5 run setblock ~1 ~-1 ~-1 minecraft:redstone_block
execute if score @s cage_type matches 5 run setblock ~-1 ~-1 ~1 minecraft:redstone_block
execute if score @s cage_type matches 5 run setblock ~-1 ~2 ~-1 minecraft:redstone_block
execute if score @s cage_type matches 5 run setblock ~1 ~2 ~1 minecraft:redstone_block
execute if score @s cage_type matches 5 run setblock ~1 ~2 ~-1 minecraft:redstone_block
execute if score @s cage_type matches 5 run setblock ~-1 ~2 ~1 minecraft:redstone_block
execute if score @s cage_type matches 5 run setblock ~1 ~ ~1 minecraft:piston[facing=up]
execute if score @s cage_type matches 5 run setblock ~-1 ~ ~1 minecraft:piston[facing=up]
execute if score @s cage_type matches 5 run setblock ~1 ~ ~-1 minecraft:piston[facing=up]
execute if score @s cage_type matches 5 run setblock ~-1 ~ ~-1 minecraft:piston[facing=up]
execute if score @s cage_type matches 5 run setblock ~ ~-1 ~ gray_stained_glass
# Doors
execute if score @s cage_type matches 6 run clone -46 99 -47 -48 102 -45 ~-1 ~-1 ~-1
# Seta
execute if score @s cage_type matches 7 run clone -61 100 -43 -56 106 -37 ~-3 ~-1 ~-1
# Shulker
execute if score @s cage_type matches 8 run clone -37 102 -41 -35 106 -39 ~-1 ~-1 ~-1

scoreboard players operation @n[type=marker,tag=cage] cage_type = @s cage_type