Paste #62356: Backpacks!

Date: 2019/11/26 11:40:43 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


simple_backpack:
  type: item
  debug: false
  material: chest
  display name: <&7>Simple Backpack
  lore:
  - "<&a>9 Slot Backpack"
  - "<&e>A simple backpack for extra storage"
  - "<&e>Right click while holding to open it."
  backpack_size: 9

medium_backpack:
  type: item
  debug: false
  material: chest
  display name: <&a>Medium Backpack
  lore:
  - "<&a>18 Slot Backpack"
  - "<&e>A medium backpack for extra storage"
  - "<&e>Right click while holding to open it."
  backpack_size: 18

large_backpack:
  type: item
  debug: false
  material: chest
  display name: <&a>Large Backpack
  lore:
  - "<&a>27 Slot Backpack"
  - "<&e>A large backpack for extra storage"
  - "<&e>Right click while holding to open it."
  backpack_size: 27

giant_backpack:
  type: item
  debug: false
  material: chest
  display name: <&a>Giant Backpack
  lore:
  - "<&a>36 Slot Backpack"
  - "<&e>A giant backpack for extra storage"
  - "<&e>Right click while holding to open it."
  backpack_size: 36

enourmous_backpack:
  type: item
  debug: false
  material: chest
  display name: <&a>Enourmous Backpack
  lore:
  - "<&a>45 Slot Backpack"
  - "<&e>A enourmous backpack for extra storage"
  - "<&e>Right click while holding to open it."
  backpack_size: 45

blackhole_backpack:
  type: item
  debug: false
  material: black_concrete
  display name: <&6>Portable Black Hole
  lore:
  - "<&a>54 Slot Backpack"
  - "<&e>A portal black hole for extra storage"
  - "<&e>Because why not?"
  - "<&e>Right click while holding to open it."
  backpack_size: 54

backpack_inventory:
  type: inventory
  debug: false
  title: <&7>Bork
  size: 9

backpack_task_open:
  type: task
  debug: false
  script:
    - note <inventory[backpack_inventory]> as:<player.uuid>.opened_backpack
    - adjust <inventory[<player.uuid>.opened_backpack]> size:<context.item.script.yaml_key[backpack_size]>
    - adjust <inventory[<player.uuid>.opened_backpack]> title:<context.item.display||<context.material>>
    - inventory add d:<inventory[<player.uuid>.opened_backpack]> o:<context.item.nbt[backpack.contents].unescaped||<list[]>>
    - inventory open d:<inventory[<player.uuid>.opened_backpack]>

backpack_events:
  type: world
  debug: false
  events:
    on player right clicks with simple_backpack:
      - determine passively cancelled
      - inject backpack_task_open

    on player right clicks with medium_backpack:
      - determine passively cancelled
      - inject backpack_task_open

    on player right clicks with large_backpack:
      - determine passively cancelled
      - inject backpack_task_open

    on player right clicks with giant_backpack:
      - determine passively cancelled
      - inject backpack_task_open

    on player right clicks with enourmous_backpack:
      - determine passively cancelled
      - inject backpack_task_open

    on player right clicks with blackhole_backpack:
      - determine passively cancelled
      - inject backpack_task_open

    on player clicks item in backpack_inventory:
      - if <context.item.script.yaml_key[backpack_size]||null> != null:
        - determine cancelled

    on player closes backpack_inventory:
      - inventory adjust <player.held_item_slot> nbt:backpack.contents/<context.inventory.list_contents.escaped>
      - note remove as:<context.inventory.notable_name>