Paste #125885: Dynamic Mask

Date: 2024/08/23 16:12:03 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


schemtest:
    debug: false
    type: task
    script:
    - define schem Cherry_Tree01
    - if <[schem]> not in <schematic.list>:
        - ~schematic load name:Cherry_Tree01

    # Defining Location, Outline of the Schematic and what Blocks are there.
    - define SchemLoc:<player.location>
    - define cuboid_area:<schematic[<[schem]>].cuboid[<[SchemLoc]>]>
    - define block_list <[cuboid_area].blocks.parse[material]>

    # Define Initial List of Overwrite Blocks
    - define mask li@m@air|m@oak_leaves|m@cherry_leaves

    # Loop through all Blocks, and add any considered NonSolid to the Mask.
    - foreach <[block_list]> as:block:
      - if not <[block].is_solid>:
        - if <[block]> not in <[mask]>:
          - define mask <list.include[<[mask]>|<[block]>]>

    # Paste the Schematic
    - ~schematic paste name:<[schem]> mask:<[mask]> noair <[SchemLoc]>