Paste #115655: Unnamed Denizen Script Paste

Date: 2023/09/26 14:50:06 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


builder_wand_test:
    type: world
    debug: true
    events:
        on player right clicks block with:job_hammer_test:
        - if <player.cursor_on.material.is_block>:
            #Mode selection part
            - if <player.is_sneaking>:
                - define mode <player.item_in_hand.flag[mode]>
                - define modes <list[ligne|colonne|mur|sol]>
                - define current <player.item_in_hand.flag[mode]>
                - define index <[modes].find[<[mode]>]>
                - define new_mode <[modes].get[<[index].add[1]>].if_null[<[modes].first>]>

                - playsound <player.location> sound:entity_experience_orb_pickup
                - inventory flag slot:HAND mode:<[new_mode]>
                - actionbar "Marteau mode: <[new_mode]>"
            - else:
                 - if !<player.cursor_on.material.advanced_matches[air|hopper|chest|piston|sticky_piston|observer|note_block]>:
                    - define block <player.cursor_on.material.name>
                #display shape part
                #Choose direction
                    - choose <player.location.yaw.simple>:
                        - case north:
                            - choose <player.item_in_hand.flag[mode]>:
                                #Choose mode
                                - case ligne:
                                    - define cuboid <player.cursor_on.to_cuboid[<player.cursor_on.add[0,0,-3]>]>
                                    - run build_hammer_reverse def.cuboid:<[cuboid]> def.block:<[block]>
                                - case sol:
                                    - define cuboid <player.cursor_on.to_cuboid[<player.cursor_on.add[2,0,-2]>]>
                                    - run build_hammer_reverse def.cuboid:<[cuboid]> def.block:<[block]>
                                - case colonne:
                                    - define cuboid <player.cursor_on.to_cuboid[<player.cursor_on.add[0,3,0]>]>
                                    - run build_hammer def.cuboid:<[cuboid]> def.block:<[block]>
                                - case mur:
                                    - define cuboid <player.cursor_on.above.to_cuboid[<player.cursor_on.add[2,3,0]>]>
                                    - run build_hammer def.cuboid:<[cuboid]> def.block:<[block]>


build_hammer:
    type: task
    definitions: cubo|block
    script:
    - inject builder_wand_test instantly
    - if !<player.cursor_on.has_flag[holobuild_o]>:
        - debugblock clear
        - flag <player.cursor_on> holobuild_o:<player.uuid> expire:2s
        - debugblock <[cuboid].blocks> color:lime players:<player> d:2s
                                    #Build shape part
    - else:
        - if <player.inventory.contains_item[<[block]>].quantity[9]>:
            - debugblock clear
            - foreach <[cuboid].blocks> as:shape:
                - foreach next if:!<player.flag[island_cubo].contains[<[shape]>]>
                - modifyblock <[shape]> <[block]> delayed
                - playeffect at:<[shape]> effect:white_ash quantity:10 offset:1 visibility:20
                - wait 10t

build_hammer_reverse:
    type: task
    definitions: cubo|block
    script:
    - inject builder_wand_test instantly
    - if !<player.cursor_on.has_flag[holobuild_o]>:
        - debugblock clear
        - flag <player.cursor_on> holobuild_o:<player.uuid> expire:2s
        - debugblock <[cuboid].blocks> color:lime players:<player> d:2s
                                    #Build shape part
    - else:
        - if <player.inventory.contains_item[<[block]>].quantity[9]>:
            - debugblock clear
            - foreach <[cuboid].blocks.reverse> as:shape:
                - foreach next if:!<player.flag[island_cubo].contains[<[shape]>]>
                - modifyblock <[shape]> <[block]> delayed
                - playeffect at:<[shape]> effect:white_ash quantity:10 offset:1 visibility:20
                - wait 10t