templatetools_available_packs: debug: false type: procedure script: - determine ]> templatetools_pack_length: debug: false type: procedure definitions: player script: - if !<[player].has_flag[templatetools_pack]>: - determine 0 - determine ].size> templatetools_pack_increment: debug: false type: task definitions: player script: - define pack_length ]> - if <[pack_length]> == 0: - stop - define index <[player].flag[templatetools_pack_index].add[1]> - if <[index]> > <[pack_length]>: - define index 1 - flag <[player]> templatetools_pack_index:<[index]> templatetools_pack_decrement: debug: false type: task definitions: player script: - define pack_length ]> - if <[pack_length]> == 0: - stop - define index <[player].flag[templatetools_pack_index].sub[1]> - if <[index]> < 1: - define index <[pack_length]> - flag <[player]> templatetools_pack_index:<[index]> templatetools_available_schematics: debug: false type: procedure definitions: player script: - if !<[player].has_flag[templatetools_pack]>: - determine - determine ].parse_tag[<[parse_value].replace_text[regex:.schem$].with[]>].if_null[].alphanumeric> templatetools_schematic_set_index: debug: false type: task definitions: player script: - define schematics ]> - if ]>: - ~schematic unload name:<[player].flag[templatetools_schematic]> - schematic load name:templatetools_<[player].uuid> filename:<[player].flag[templatetools_pack]>/<[schematics].get[<[player].flag[templatetools_pack_index]>]> - actionbar "<&e>Schematic <[player].flag[templatetools_pack_index]>: <&f><[schematics].get[<[player].flag[templatetools_pack_index]>]>" targets:<[player]> templatetools_preview_queue: debug: false type: task definitions: player|schematic script: - if <[player].has_flag[templatetools_preview_queue]>: - stop - flag <[player]> templatetools_preview_queue:true expire:0.5s - wait 0.5s - if !]>: - stop - waituntil ].width.if_null[-1]> != -1 max:2s - flag <[player]> templatetools_preview_queue:! - run templatetools_preview def.player:<[player]> def.schematic:<[schematic]> templatetools_preview_show: debug: false type: task definitions: player|schematic script: - define cursor_on <[player].cursor_on.if_null[null]> - if <[cursor_on]> == null: - stop - if !]>: - stop - define cuboid ].cuboid[<[cursor_on]>]> - define middle <[cuboid].center> - define smallest_y <[cuboid].corners.get[first].y> - if <[cuboid].corners.get[last].y> < <[smallest_y]>: - define smallest_y <[cuboid].corners.get[last].y> - define difference_y <[cursor_on].y.sub[<[smallest_y]>]> - define cursor_on <[cursor_on].sub[0,<[difference_y].sub[1]>,0]> - define fakedlocations - if !<[player].item_in_hand.advanced_matches[spider_eye]>: - run templatetools_preview_clear def.player:<[player]> - stop - define halfwidth ].width.div[2]> - define halflength ].length.div[2]> - repeat ].width> from:0 as:x: - repeat ].height> from:0 as:y: - repeat ].length> from:0 as:z: - define location ,<[y]>,<[z]>,<[player].world.name>]> - define block ].block[<[location]>]> - if <[block].name> == air: - repeat next - define fakedlocation <[cursor_on].add[<[location]>].sub[<[halfwidth]>,0,<[halflength]>].add[1,0,1]> - showfake ].block[<[location]>]> <[fakedlocation]> players:<[player]> duration:1h - define fakedlocations <[fakedlocations].include[<[fakedlocation]>]> - flag <[player]> templatetools_preview_region:<[fakedlocations]> templatetools_preview_clear: debug: false type: task definitions: player script: - if !<[player].has_flag[templatetools_preview_region]>: - stop - showfake cancel <[player].flag[templatetools_preview_region]> - flag <[player]> templatetools_preview_region:! templatetools_preview: debug: false type: task definitions: player|schematic script: - ~run templatetools_preview_clear def.player:<[player]> - run templatetools_preview_show def.player:<[player]> def.schematic:<[schematic]> templatetools_preview_paste: debug: false type: task definitions: player|schematic script: - define cursor_on <[player].cursor_on.if_null[null]> - if <[cursor_on]> == null: - stop - define cuboid ].cuboid[<[cursor_on]>]> - define middle <[cuboid].center> - define smallest_y <[cuboid].corners.get[first].y> - if <[cuboid].corners.get[last].y> < <[smallest_y]>: - define smallest_y <[cuboid].corners.get[last].y> - define difference_y <[cursor_on].y.sub[<[smallest_y]>]> - define cursor_on <[cursor_on].sub[0,<[difference_y].sub[1]>,0]> - if !<[player].item_in_hand.advanced_matches[spider_eye]>: - run templatetools_preview_clear def.player:<[player]> - stop - define halfwidth ].width.div[2]> - define halflength ].length.div[2]> - define count 0 - define undodata - repeat ].width> from:0 as:x: - repeat ].height> from:0 as:y: - repeat ].length> from:0 as:z: - define location ,<[y]>,<[z]>,<[player].world.name>]> - define block ].block[<[location]>]> - if <[block].name> == air: - repeat next - define fakedlocation <[cursor_on].add[<[location]>].sub[<[halfwidth]>,0,<[halflength]>].add[1,0,1]> - define previousmaterial <[fakedlocation].material> - modifyblock ].block[<[location]>]> <[fakedlocation]> no_physics - define undodata <[undodata].with[<[fakedlocation]>].as[<[previousmaterial]>]> - define count <[count].add[1]> - run templatetools_push_undo def.player:<[player]> def.data:<[undodata]> - determine <[count]> templatetools_push_undo: debug: false type: task definitions: player|data script: - flag <[player]> templatetools_undo:<[player].flag[templatetools_undo].if_null[].include[<[data]>]> templatetools_pop_undo: debug: false type: task definitions: player script: - if <[player].flag[templatetools_undo].if_null[].is_empty>: - stop - foreach <[player].flag[templatetools_undo].last> key:location as:material: - modifyblock <[material]> <[location]> no_physics - flag <[player]> templatetools_undo:<[player].flag[templatetools_undo].remove[last]>