Skip to content

Commit b166f91

Browse files
committed
🛠️ Fix overlays breaking custom function tags
1 parent 9328366 commit b166f91

File tree

13 files changed

+278
-1000
lines changed

13 files changed

+278
-1000
lines changed

src/systems/datapackCompiler/1.20.4/animation.mcb

Lines changed: 4 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,3 @@
1-
dir global {
2-
3-
function on_load minecraft:load {
4-
# Initialize Scoreboards
5-
scoreboard objectives add <%OBJECTIVES.I()%> dummy
6-
scoreboard objectives add <%OBJECTIVES.ID()%> dummy
7-
scoreboard objectives add <%OBJECTIVES.IS_RIG_LOADED()%> dummy
8-
scoreboard objectives add <%OBJECTIVES.TWEEN_DURATION()%> dummy
9-
10-
scoreboard players add aj.last_id <%OBJECTIVES.ID()%> 0
11-
12-
# Initialize Storage
13-
data modify storage aj:temp args set value {}
14-
IF (show_outdated_warning) {
15-
# Initialize Rigs
16-
scoreboard players reset * <%OBJECTIVES.IS_RIG_LOADED()%>
17-
}
18-
function #*global/on_load
19-
}
20-
21-
function on_tick minecraft:tick {
22-
execute as @e[type=item_display,tag=<%TAGS.GLOBAL_ROOT()%>] at @s run function #*global/root/on_tick
23-
}
24-
25-
tag functions on_load {
26-
*<%export_namespace%>/on_load
27-
}
28-
29-
dir root {
30-
# TODO Maybe instead of merging tags, I should just generate it from the .ajmeta data every time a rig is exported?
31-
# That way I can also check if the rig's files still exist, and remove tag entries if they don't.
32-
# An entry will be added for each exported rig.
33-
tag functions on_tick {
34-
*<%export_namespace%>/root/on_tick
35-
}
36-
# An entry will be added for each exported rig.
37-
IF (show_outdated_warning) {
38-
tag functions on_load {
39-
*<%export_namespace%>/root/on_load
40-
}
41-
}
42-
}
43-
44-
IF (show_function_errors) {
45-
dir errors {
46-
function function_not_executed_as_root_entity {
47-
#ARGS: {export_namespace: string, function_path: string}
48-
$tellraw @a <%TELLRAW.FUNCTION_NOT_EXECUTED_AS_ROOT_ERROR('$(function_path)')%>
49-
}
50-
}
51-
}
52-
53-
dir remove {
54-
# Removes all instances of all rigs from the world.
55-
function everything {
56-
kill @e[tag=<%TAGS.GLOBAL_RIG()%>]
57-
}
58-
}
59-
60-
dir internal {
61-
# Thanks Gibbsly for this code! https://github.com/gibbsly/gu
62-
dir gu {
63-
function load minecraft:load {
64-
scoreboard players set 256 <%OBJECTIVES.I()%> 256
65-
data modify storage aj:uuid main.hex_chars set value \
66-
<%JSON.stringify([...Array(0x100).keys()].map(v => {const x = v.toString(16); return x.length > 1 ? x : '0' + x}))%>
67-
}
68-
69-
function convert_uuid_array_to_string {
70-
#ARGS: {UUID: [int, int, int, int]}
71-
72-
data modify storage aj:uuid temp set value {0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,a:0,b:0,c:0,d:0,e:0,f:0}
73-
$data modify storage aj:uuid main.in set value $(UUID)
74-
75-
execute store result score 0= <%OBJECTIVES.I()%> store result score 1= <%OBJECTIVES.I()%> run data get storage aj:uuid main.in[0]
76-
execute store result storage aj:uuid temp.0 int 1 run scoreboard players operation 0= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
77-
execute store result score 2= <%OBJECTIVES.I()%> run scoreboard players operation 1= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
78-
execute store result storage aj:uuid temp.1 int 1 run scoreboard players operation 1= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
79-
execute store result score 3= <%OBJECTIVES.I()%> run scoreboard players operation 2= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
80-
execute store result storage aj:uuid temp.2 int 1 run scoreboard players operation 2= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
81-
execute store result storage aj:uuid temp.3 int 1 run scoreboard players operation 3= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
82-
83-
execute store result score 0= <%OBJECTIVES.I()%> store result score 1= <%OBJECTIVES.I()%> run data get storage aj:uuid main.in[1]
84-
execute store result storage aj:uuid temp.4 int 1 run scoreboard players operation 0= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
85-
execute store result score 2= <%OBJECTIVES.I()%> run scoreboard players operation 1= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
86-
execute store result storage aj:uuid temp.5 int 1 run scoreboard players operation 1= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
87-
execute store result score 3= <%OBJECTIVES.I()%> run scoreboard players operation 2= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
88-
execute store result storage aj:uuid temp.6 int 1 run scoreboard players operation 2= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
89-
execute store result storage aj:uuid temp.7 int 1 run scoreboard players operation 3= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
90-
91-
execute store result score 0= <%OBJECTIVES.I()%> store result score 1= <%OBJECTIVES.I()%> run data get storage aj:uuid main.in[2]
92-
execute store result storage aj:uuid temp.8 int 1 run scoreboard players operation 0= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
93-
execute store result score 2= <%OBJECTIVES.I()%> run scoreboard players operation 1= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
94-
execute store result storage aj:uuid temp.9 int 1 run scoreboard players operation 1= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
95-
execute store result score 3= <%OBJECTIVES.I()%> run scoreboard players operation 2= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
96-
execute store result storage aj:uuid temp.a int 1 run scoreboard players operation 2= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
97-
execute store result storage aj:uuid temp.b int 1 run scoreboard players operation 3= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
98-
99-
execute store result score 0= <%OBJECTIVES.I()%> store result score 1= <%OBJECTIVES.I()%> run data get storage aj:uuid main.in[3]
100-
execute store result storage aj:uuid temp.c int 1 run scoreboard players operation 0= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
101-
execute store result score 2= <%OBJECTIVES.I()%> run scoreboard players operation 1= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
102-
execute store result storage aj:uuid temp.d int 1 run scoreboard players operation 1= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
103-
execute store result score 3= <%OBJECTIVES.I()%> run scoreboard players operation 2= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
104-
execute store result storage aj:uuid temp.e int 1 run scoreboard players operation 2= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
105-
execute store result storage aj:uuid temp.f int 1 run scoreboard players operation 3= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
106-
107-
block { with storage aj:uuid temp
108-
REPEAT (0, 15) as i {
109-
$data modify storage aj:uuid temp.<%i.toString(16)%> set from storage aj:uuid main.hex_chars[$(<%i.toString(16)%>)]
110-
}
111-
}
112-
113-
block { with storage aj:uuid temp
114-
$data modify storage aj:uuid main.out set value "$(3)$(2)$(1)$(0)-$(7)$(6)-$(5)$(4)-$(b)$(a)-$(9)$(8)$(f)$(e)$(d)$(c)"
115-
}
116-
}
117-
}
118-
}
119-
}
1201

1212
dir <%export_namespace%> {
1223
function on_load {
@@ -133,6 +14,10 @@ dir <%export_namespace%> {
13314
%%>
13415
}
13516

17+
function invalid_version_warning {
18+
# This function will contain a tellraw if the datapack is loaded in the wrong version.
19+
}
20+
13621
dir root {
13722
IF (show_outdated_warning) {
13823
function on_load {
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
dir global {
2+
3+
function on_load minecraft:load {
4+
# Initialize Scoreboards
5+
scoreboard objectives add <%OBJECTIVES.I()%> dummy
6+
scoreboard objectives add <%OBJECTIVES.ID()%> dummy
7+
scoreboard objectives add <%OBJECTIVES.IS_RIG_LOADED()%> dummy
8+
scoreboard objectives add <%OBJECTIVES.TWEEN_DURATION()%> dummy
9+
10+
scoreboard players add aj.last_id <%OBJECTIVES.ID()%> 0
11+
12+
# Initialize Storage
13+
data modify storage aj:temp args set value {}
14+
IF (show_outdated_warning) {
15+
# Initialize Rigs
16+
scoreboard players reset * <%OBJECTIVES.IS_RIG_LOADED()%>
17+
}
18+
function #*global/on_load
19+
}
20+
21+
IF (!is_static || show_outdated_warning) {
22+
function on_tick minecraft:tick {
23+
execute as @e[type=item_display,tag=<%TAGS.GLOBAL_ROOT()%>] at @s run function #*global/root/on_tick
24+
}
25+
}
26+
27+
tag functions on_load {
28+
*<%export_namespace%>/on_load
29+
}
30+
31+
dir root {
32+
# TODO Maybe instead of merging tags, I should just generate it from the .ajmeta data every time a rig is exported?
33+
# That way I can also check if the rig's files still exist, and remove tag entries if they don't.
34+
# An entry will be added for each exported rig.
35+
IF (!is_static) {
36+
tag functions on_tick {
37+
*<%export_namespace%>/root/on_tick
38+
}
39+
}
40+
# An entry will be added for each exported rig.
41+
IF (show_outdated_warning) {
42+
tag functions on_load {
43+
*<%export_namespace%>/root/on_load
44+
}
45+
}
46+
}
47+
48+
IF (show_function_errors) {
49+
dir errors {
50+
function function_not_executed_as_root_entity {
51+
#ARGS: {export_namespace: string, function_path: string}
52+
$tellraw @a <%TELLRAW.FUNCTION_NOT_EXECUTED_AS_ROOT_ERROR('$(function_path)')%>
53+
}
54+
}
55+
}
56+
57+
dir remove {
58+
# Removes all instances of all rigs from the world.
59+
function everything {
60+
kill @e[tag=<%TAGS.GLOBAL_RIG()%>]
61+
}
62+
}
63+
64+
dir internal {
65+
# Thanks Gibbsly for this code! https://github.com/gibbsly/gu
66+
dir gu {
67+
function load minecraft:load {
68+
scoreboard players set 256 <%OBJECTIVES.I()%> 256
69+
data modify storage aj:uuid main.hex_chars set value \
70+
<%JSON.stringify([...Array(0x100).keys()].map(v => {const x = v.toString(16); return x.length > 1 ? x : '0' + x}))%>
71+
}
72+
73+
function convert_uuid_array_to_string {
74+
#ARGS: {UUID: [int, int, int, int]}
75+
76+
data modify storage aj:uuid temp set value {0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,a:0,b:0,c:0,d:0,e:0,f:0}
77+
$data modify storage aj:uuid main.in set value $(UUID)
78+
79+
execute store result score 0= <%OBJECTIVES.I()%> store result score 1= <%OBJECTIVES.I()%> run data get storage aj:uuid main.in[0]
80+
execute store result storage aj:uuid temp.0 int 1 run scoreboard players operation 0= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
81+
execute store result score 2= <%OBJECTIVES.I()%> run scoreboard players operation 1= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
82+
execute store result storage aj:uuid temp.1 int 1 run scoreboard players operation 1= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
83+
execute store result score 3= <%OBJECTIVES.I()%> run scoreboard players operation 2= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
84+
execute store result storage aj:uuid temp.2 int 1 run scoreboard players operation 2= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
85+
execute store result storage aj:uuid temp.3 int 1 run scoreboard players operation 3= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
86+
87+
execute store result score 0= <%OBJECTIVES.I()%> store result score 1= <%OBJECTIVES.I()%> run data get storage aj:uuid main.in[1]
88+
execute store result storage aj:uuid temp.4 int 1 run scoreboard players operation 0= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
89+
execute store result score 2= <%OBJECTIVES.I()%> run scoreboard players operation 1= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
90+
execute store result storage aj:uuid temp.5 int 1 run scoreboard players operation 1= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
91+
execute store result score 3= <%OBJECTIVES.I()%> run scoreboard players operation 2= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
92+
execute store result storage aj:uuid temp.6 int 1 run scoreboard players operation 2= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
93+
execute store result storage aj:uuid temp.7 int 1 run scoreboard players operation 3= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
94+
95+
execute store result score 0= <%OBJECTIVES.I()%> store result score 1= <%OBJECTIVES.I()%> run data get storage aj:uuid main.in[2]
96+
execute store result storage aj:uuid temp.8 int 1 run scoreboard players operation 0= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
97+
execute store result score 2= <%OBJECTIVES.I()%> run scoreboard players operation 1= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
98+
execute store result storage aj:uuid temp.9 int 1 run scoreboard players operation 1= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
99+
execute store result score 3= <%OBJECTIVES.I()%> run scoreboard players operation 2= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
100+
execute store result storage aj:uuid temp.a int 1 run scoreboard players operation 2= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
101+
execute store result storage aj:uuid temp.b int 1 run scoreboard players operation 3= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
102+
103+
execute store result score 0= <%OBJECTIVES.I()%> store result score 1= <%OBJECTIVES.I()%> run data get storage aj:uuid main.in[3]
104+
execute store result storage aj:uuid temp.c int 1 run scoreboard players operation 0= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
105+
execute store result score 2= <%OBJECTIVES.I()%> run scoreboard players operation 1= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
106+
execute store result storage aj:uuid temp.d int 1 run scoreboard players operation 1= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
107+
execute store result score 3= <%OBJECTIVES.I()%> run scoreboard players operation 2= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
108+
execute store result storage aj:uuid temp.e int 1 run scoreboard players operation 2= <%OBJECTIVES.I()%> %= 256 <%OBJECTIVES.I()%>
109+
execute store result storage aj:uuid temp.f int 1 run scoreboard players operation 3= <%OBJECTIVES.I()%> /= 256 <%OBJECTIVES.I()%>
110+
111+
block { with storage aj:uuid temp
112+
REPEAT (0, 15) as i {
113+
$data modify storage aj:uuid temp.<%i.toString(16)%> set from storage aj:uuid main.hex_chars[$(<%i.toString(16)%>)]
114+
}
115+
}
116+
117+
block { with storage aj:uuid temp
118+
$data modify storage aj:uuid main.out set value "$(3)$(2)$(1)$(0)-$(7)$(6)-$(5)$(4)-$(b)$(a)-$(9)$(8)$(f)$(e)$(d)$(c)"
119+
}
120+
}
121+
}
122+
}
123+
}
124+
125+
dir <%export_namespace%> {
126+
function on_load {
127+
function *<%export_namespace%>/invalid_version_warning
128+
}
129+
130+
function invalid_version_warning {
131+
tellraw @a <%TELLRAW.INVALID_VERSION()%>
132+
}
133+
}

0 commit comments

Comments
 (0)