Date: 2023/03/12 11:48:13 UTC-07:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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