Skip to content

Function: clear area

theblackswitch edited this page May 15, 2026 · 2 revisions

#mtb-generated:<namespace>/<multiblock_id>/clear_area

Clear all blocks from the multiblock.

Context:

This function needs to run as the root of the multiblock instance you want to build.

Note

You can use the selector @e[type=minecraft:block_display,tag=<namespace>-<multiblock_id>,tag=mtb.root] to find the root

Example:

# Undo creative placement if the player made a mistake and clicks in their schematic menu

# The implementing datapack uses a player ID system to link the multiblocks with the player
scoreboard players operation #search tbs.ID = @s tbs.ID

execute if score @s[gamemode=creative] schematic.menu matches 0 if score @s schematic.click matches 1.. as @e[type=minecraft:block_display,tag=tech_datapack-industrial_furnace,tag=mtb.root,tag=td.currently_placing,predicate=tech_datapack:match_player_id] run function #mtb-generated:tech_datapack/industrial_furnace/clear_area

Clone this wiki locally