Paste #123008: Unnamed Denizen Script Paste

Date: 2024/05/24 07:24:10 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


switch_inventory_script:
    type: task
    script:
        - if !<player.has_flag[force_inv_open]>:
            - narrate "currently swapping from playerinv to forceinv"
            - note <player.inventory> as:player_inventory<player.uuid>
            - inventory swap origin:<player.inventory> destination:forcepowers_inv<player.uuid>
            # - inventory set origin:<inventory[player_inventory<player.uuid>].slot[inventory[player_inventory<player.uuid>].find_item[force_powers]]> slot:1  dont look at me for now
            - flag <player> force_inv_open
        - else:
            - narrate "currently swapping from forceinv to playerinv"
            - note <player.inventory> as:forcepowers_inv<player.uuid>
            - inventory swap origin:<player.inventory> destination:player_inventory<player.uuid>
            # - inventory set origin:<inventory[forcepowers_inv<player.uuid>].slot[1]> slot:1     also dont look at me
            - flag <player> force_inv_open:!

forcepower_input_script:
    type: world
    events:
        on player right clicks block with:*_spawn_egg flagged:force_inv_open:
            - determine cancelled

        on player right clicks block with:force_powers:
            - ratelimit <player> 1t
            - if <context.location> == null:
                - stop
            - if <context.location.block.material.is_interactable> && <context.location.block.material> matches pumpkin|*_fence|tnt|flower_pot|composter|beehive|bee_nest|*cauldron|:
                - stop
            - run switch_inventory_script
        on player right clicks player with:force_powers:
            - ratelimit <player> 1t
            - run switch_inventory_script