SetBlocksCommand: type: command debug: false name: /set description: Sets each block in the selected region. usage: //set [<<>material<>>] script: - define material - define 1 l@CurrentSelectedRegion1 - define 2 l@CurrentSelectedRegion2 - if %material% == null || %material% !matches material narrate "Must specify a valid material." else if == null narrate "Must select corner 1 with left-click." else if == null narrate "Must select corner 2 with right-click." else { - define blocks - - define list "" + - define undoMaterials - - foreach %blocks% { - - define mat - - if == null define %mat% - - define %mat% | - } - modifyblock %blocks% - - foreach { + - flag global "UndoableActions:->:set_blocks;;%list%" - - define list %list%%value%/; - } - - flag global "UndoableActions:->:set_blocks;%list%" } UndoCommand: type: command debug: false name: /undo description: Undo the last action. usage: //undo script: - define last_action - if %last_action% == null narrate "Nothing to undo." else { - ^inject locally "path:" - ^flag global "UndoableActions:<-:%last_action%" } set_blocks: - - define split_info - - foreach %split_info% { - - define s - - modifyblock + - define cuboid + - define materials + - foreach %cuboid% { + - define material + - if foreach next + - modifyblock %value% %material% } - ^narrate "Successfully undid all modified blocks."