Files
schematic_builder
Code
13 95
schematic_builder/data/schematic/function/load_schem.mcfunction
# Store slot number
execute store result storage schematic:load slot int 1 run scoreboard players get @s schem_load
# Store player's feet position as load origin
execute store result storage schematic:load x int 1.0 run data get entity @s Pos[0] 1.0
execute store result storage schematic:load y int 1.0 run data get entity @s Pos[1] 1.0
execute store result storage schematic:load z int 1.0 run data get entity @s Pos[2] 1.0
# Get rotation value (defaults to 0=none)
execute store result storage schematic:load rot int 1 run data get storage schematic:rotation value
# Map rotation number to string for /structure load
data modify storage schematic:load rot_string set value "none"
execute if data storage schematic:load{rot:1} run data modify storage schematic:load rot_string set value "clockwise_90"
execute if data storage schematic:load{rot:2} run data modify storage schematic:load rot_string set value "180"
execute if data storage schematic:load{rot:3} run data modify storage schematic:load rot_string set value "counterclockwise_90"
# Validate slot has been saved before
execute if data storage schematic:load{slot:0} unless entity @e[type=minecraft:area_effect_cloud,tag=scheme_0] run tellraw @s ["",{"text":"⚠ Slot 0 is empty! Save something first.","color":"red"}]
# Load structure
function schematic:load_macro with storage schematic:load