Paste #107292: Unnamed Denizen Script Paste

Date: 2023/03/12 11:50:23 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


wardinglantern:
  type: item
  debug: true
  material: PAPER
  display name: <&color[#FFDFD3]>Warding Beacon
  lore:
  - <&[lore]><&color[#CF9FFF]><strikethrough><element[ ].repeat[44]>
  - <&[lore]>
  - <&[lore]><&color[#6bb0e8]> Ward off unwanted guests
  - <&[lore]>
  - <&[lore]><&color[#c9f0f2]> Prevents hostile mobs spawning
  - <&[lore]><&color[#c9f0f2]> within 15 blocks in all directions
  - <&[lore]>
  - <&[lore]> ➡ Place to activate
  - <&[lore]>
  - <&[lore]><&color[#CF9FFF]><strikethrough><element[ ].repeat[14]><reset><&color[WHITE]><strikethrough><&color[#CF9FFF]><strikethrough><element[ ].repeat[15]>
  mechanisms:
    custom_model_data: 10677
    hides: ALL
  flags:
    lantern: true

wardinglanterndummy:
  type: item
  debug: true
  material: PAPER
  display name: <empty>
  mechanisms:
    custom_model_data: 10677
    hides: ALL

lantern_of_warding:
    type: world
    debug: true
    events:
        on player right clicks block with:item_flagged:lantern type:!air:
        - if <context.relative> == <context.location.add[0,1,0]> && !<context.location.add[0,1,0].has_flag[lantern_of_warding]>:
            - determine passively cancelled
            - spawn item_frame[rotation=up;framed=wardinglanterndummy;visible=false] <context.location.add[0,1,0]>
            - flag <context.location.add[0,1,0]> lantern_of_warding
            - actionbar "<&a>Warding Beacon Placed - Area Safe"
            - take item:wardinglantern
            - define loc <context.location.add[0,1,0]>
            - define cuboid <cuboid[<[loc].world.name>,<[loc].x.add[15]>,<[loc].y.add[15]>,<[loc].z.add[15]>,<[loc].x.add[-15]>,<[loc].y.add[-15]>,<[loc].z.add[-15]>]>
            - flag <context.location.add[0,1,0]> cuboid:<[cuboid]>
        - if !<cuboid[lantern_of_warding_<player.world.name>].exists>:
            - note <[cuboid]> as:lantern_of_warding_<player.world.name>
        - else:
            - note <cuboid[lantern_of_warding_<player.world.name>].add_member[<[cuboid]>]> as:lantern_of_warding_<player.world.name>
        on item_frame damaged by player:
        - if <context.entity.location.has_flag[lantern_of_warding].if_null[false]>:
            - actionbar "<&c>Warding Beacon Broken - Area unsafe"
            - spawn dropped_item[item=wardinglantern] <context.entity.location>
            - flag <context.entity.location> lantern_of_warding:!
            - if <cuboid[lantern_of_warding_<player.world.name>].members_size> == 1:
                - note remove as:lantern_of_warding_<player.world.name>
            - else:
                - foreach <cuboid[lantern_of_warding_<player.world.name>].list_members> as:entry:
                    - if <[entry]> == <context.entity.location.flag[cuboid]>:
                        - adjust <cuboid[lantern_of_warding_<context.entity.location.world.name>]> remove_member:<[loop_index]>
                        - foreach stop
            - remove <context.entity>
            - determine cancelled

        on hanging breaks:
        - if <context.hanging.location.has_flag[lantern_of_warding]>:
            - determine cancelled

        on entity spawns in:lantern_of_warding_*:
        - if !<context.entity.is_monster>:
            - stop
        - playeffect effect:END_ROD at:<context.location> quantity:5 data:0.1
        - determine cancelled