Date: 2017/09/22 08:23:17 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
gpa_advancedLights_main:
type: world
debug: false
events:
on server start:
- wait 5s
- foreach <server.list_flags[gpa.advancedLights.]> {
- define f '<def[value]>'
- foreach <server.flag[<def[f]>].as_list||li@> {
- light <def[value]> <def[f].after[gpa.advancedLights.]>
}
}
on player places skull:
- if <context.item_in_hand.material> != m@human_skull || <context.cancelled> {
- queue clear
}
- foreach <s@gpa_advancedLights_data.list_keys[items]> {
- if <player.item_in_hand.skin.full||null> != <s@gpa_advancedLights_data.yaml_key[items.<def[value]>.skull_skin]> {
- foreach next
}
- light <context.location> <s@gpa_advancedLights_data.yaml_key[items.<def[value]>.light]>
- flag server 'gpa.advancedLights.<s@gpa_advancedLights_data.yaml_key[items.<def[value]>.light]>:->:<context.location>'
- foreach stop
}
- define ar 'cu@<player.location.block.sub[16,16,16]>|<player.location.block.add[16,16,16]>'
- adjust <def[ar].list_partial_chunks> refresh_chunk_sections
on player breaks skull:
- if <context.location.skull_type||null> != 'PLAYER' || <context.cancelled> {
- queue clear
}
- foreach <server.list_flags[gpa.advancedLights.]> {
- if <server.flag[<def[value]>].as_list.contains[<context.location>]||false> {
- light <context.location> reset
- flag server '<def[value]>:<-:<context.location>'
}
}
- define ar 'cu@<player.location.block.sub[16,16,16]>|<player.location.block.add[16,16,16]>'
- adjust <def[ar].list_partial_chunks> refresh_chunk_sections
- if <li@1|3.contains[<player.gamemode.id>]> {
- queue clear
}
- foreach <s@gpa_advancedLights_data.list_keys[items]> {
- if <context.location.skull_skin.full||null> != <s@gpa_advancedLights_data.yaml_key[items.<def[value]>.skull_skin]> {
- foreach next
}
- define d_l '<s@gpa_advancedLights_data.yaml_key[items.<def[value]>.drops].as_list||li@>'
- if <def[d_l].contains[self]||false> {
- define self_skull 'i@human_skull[display_name=&ssf<def[value].replace[_].with[ ].to_titlecase>;skull_skin=<s@gpa_advancedLights_data.yaml_key[items.<def[value]>.skull_skin]>]'
- define d_l '<def[d_l].exclude[self].parse[as_item].include[<def[self_skull]>]>'
}
- determine passively '<def[d_l]>'
}
on player right clicks skull using hand:
- if <context.cancelled> {
- queue clear
}
- foreach <s@gpa_advancedLights_data.list_keys[items]> {
- if <context.location.skull_skin.full||null> != <s@gpa_advancedLights_data.yaml_key[items.<def[value]>.skull_skin]> {
- foreach next
}
- if !<s@gpa_advancedLights_data.yaml_key[items.<def[value]>.click]||false> {
- queue clear
}
- define li_lvl '<s@gpa_advancedLights_data.yaml_key[items.<def[value]>.light]>'
- define cl '<s@gpa_advancedLights_data.yaml_key[items.<def[value]>.click_action]||null>'
- if <def[cl]> == 'pickup' {
- define p_i '<s@gpa_advancedLights_data.yaml_key[items.<def[value]>.pickup_item].as_item||i@stone>'
- define p_s '<s@gpa_advancedLights_data.yaml_key[items.<def[value]>.pickup_sound].as_list||li@>'
- if <player.inventory.can_fit[<def[p_i]>]> {
- give <def[p_i]>
- modifyblock <context.location> m@air
- light <context.location> reset
- flag server 'gpa.advancedLights.<def[li_lvl]>:<-:<context.location>'
- if <def[p_s].is_empty> {
- if <proc[gpa_gpu_versionCheck]> > 0 {
- define p_s 'UI_BUTTON_CLICK|1'
}
else {
- define p_s 'CLICK|1'
}
}
- playsound <context.location> 'sound:<def[p_s].get[1]>' pitch:<def[p_s].get[2]>
}
}
else if <def[cl]> == 'toggle' {
- determine passively 'CANCELLED'
- define t_s '<s@gpa_advancedLights_data.yaml_key[items.<def[value]>.toggle_sound].as_list||li@>'
- if <def[p_s].is_empty> {
- if <proc[gpa_gpu_versionCheck]> > 0 {
- define p_s 'UI_BUTTON_CLICK|1|1'
}
else {
- define p_s 'CLICK|1|1'
}
}
- if <server.flag[gpa.advancedLights.<def[li_lvl]>].as_list.contains[<context.location>]||false> {
- light <context.location> reset
- flag server 'gpa.advancedLights.<def[li_lvl]>:<-:<context.location>'
- playsound <context.location.center> 'sound:<def[t_s].get[1]>' volume:1 pitch:<def[t_s].get[3]>
}
else {
- define t_li '<s@gpa_advancedLights_data.yaml_key[items.<def[value]>.toggle_items].as_list||li@>'
- define c_h '<def[t_li].exclude[none].parse[as_material.name].contains[<player.item_in_hand.material.name>]||false>'
- if <def[t_li].contains[none]> || <def[c_h]> {
- light <context.location> <def[li_lvl]>
- flag server 'gpa.advancedLights.<def[li_lvl]>:->:<context.location>'
- if <def[c_h]> && <player.item_in_hand.durability.add_int[1]||1> < <player.item_in_hand.max_durability||0> && <li@0|2.contains[<player.gamemode.id>]> {
- if <def[t_li].contains[none]||true> {
- take iteminhand
}
else {
- adjust <player.item_in_hand> 'durability:<player.item_in_hand.durability.add_int[1]>' save:tiu
- adjust <player> 'item_in_hand:<entry[tiu].result>'
}
- playsound <context.location.center> 'sound:<def[t_s].get[1]>' volume:1 pitch:<def[t_s].get[2]>
}
}
}
}
- define ar 'cu@<player.location.block.sub[16,16,16]>|<player.location.block.add[16,16,16]>'
- adjust <def[ar].list_partial_chunks> refresh_chunk_sections
- foreach stop
}