@@ -17,24 +17,25 @@ dir <%export_namespace%> {
1717 unless data entity @s {data:{rigHash: '<%rigHash%>'}} \
1818 on vehicle \
1919 run block zzz/check_rig_hash {
20- execute store result storage aj:temp x int 1 store result score #this.x aj.i run data get entity @s Pos[0] 1
21- execute store result storage aj:temp y int 1 store result score #this.y aj.i run data get entity @s Pos[1] 1
22- execute store result storage aj:temp z int 1 store result score #this.z aj.i run data get entity @s Pos[2] 1
23- block show_outdated_warning { with storage aj:temp
20+ data remove storage aj:temp args
21+ execute store result storage aj:temp args.x int 1 store result score #this.x aj.i run data get entity @s Pos[0] 1
22+ execute store result storage aj:temp args.y int 1 store result score #this.y aj.i run data get entity @s Pos[1] 1
23+ execute store result storage aj:temp args.z int 1 store result score #this.z aj.i run data get entity @s Pos[2] 1
24+ block show_outdated_warning { with storage aj:temp args
2425 $tellraw @a <%TELLRAW.RIG_OUTDATED()%>
2526 }
2627 data modify entity @s data.rigHash set value '<%rigHash%>'
2728 execute on passengers run data merge entity @s {Glowing: 1b, glow_color_override: <%0xff0000%>}
2829 summon minecraft:text_display ~ ~ ~ { \
29- Tags:['<%TAGS.GLOBAL_ENTITY()%>', '<%TAGS.OUTDATED_RIG_TEXT_DISPLAY()%>', '<%TAGS.NEW()%>'], \
30- text:<%TELLRAW.RIG_OUTDATED_TEXT_DISPLAY()%>, \
31- alignment: 'center', \
32- billboard: 'vertical', \
33- transformation:{ \
34- translation:[0f,<%boundingBox[1]/16%>f,0f], \
35- left_rotation:[0f,0f,0f,1f], \
36- right_rotation:[0f,0f,0f,1f], \
37- scale:[1f,1f,1f] \
30+ Tags:['<%TAGS.GLOBAL_ENTITY()%>', '<%TAGS.OUTDATED_RIG_TEXT_DISPLAY()%>', '<%TAGS.NEW()%>'], \
31+ text:' <%TELLRAW.RIG_OUTDATED_TEXT_DISPLAY()%>' , \
32+ alignment: 'center', \
33+ billboard: 'vertical', \
34+ transformation:{ \
35+ translation:[0f,<%boundingBox[1]/16%>f,0f], \
36+ left_rotation:[0f,0f,0f,1f], \
37+ right_rotation:[0f,0f,0f,1f], \
38+ scale:[1f,1f,1f] \
3839 } \
3940 }
4041 ride @e[type=minecraft:text_display,tag=<%TAGS.NEW()%>,limit=1,distance=..0.01] mount @s
@@ -126,7 +127,7 @@ dir <%export_namespace%> {
126127 interpolation_duration: <%interpolation_duration%>, \
127128 Passengers:<%root_entity_passengers%>, \
128129 }
129- execute as @e[type=item_display,tag=<%TAGS.NEW()%>,limit=1,distance=..0.01] run block zzz/summon/as_root_entity {
130+ execute as @e[type=minecraft: item_display,tag=<%TAGS.NEW()%>,limit=1,distance=..0.01] run block zzz/summon/as_root_entity {
130131 execute store result score @s <%OBJECTIVES.ID()%> run scoreboard players add aj.last_id <%OBJECTIVES.ID()%> 1
131132
132133 execute on passengers if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] run block as_data_entity {
@@ -168,14 +169,14 @@ dir <%export_namespace%> {
168169 }
169170
170171 REPEAT (Object.values(rig.nodes).filter(v => v.type === 'camera')) as camera {
171- summon item_display \
172+ summon minecraft: item_display \
172173 ^<%roundTo(camera.default_transform.pos[0], 10)%> \
173174 ^<%roundTo(camera.default_transform.pos[1], 10)%> \
174175 ^<%roundTo(camera.default_transform.pos[2], 10)%> \
175176 {Tags:<%getNodeTags(camera, rig)%>, teleport_duration: 2}
176177 execute \
177178 as @n[ \
178- type=item_display, \
179+ type=minecraft: item_display, \
179180 tag=<%TAGS.NEW()%>, \
180181 tag=<%TAGS.PROJECT_CAMERA_NAMED(export_namespace, camera.storage_name)%>, \
181182 distance=..<%camera.max_distance + 1%> \
@@ -254,27 +255,31 @@ dir <%export_namespace%> {
254255 #ARGS: {name: string, command: string}
255256 IF (show_function_errors) {
256257 # Assert that the function is being run as the root entity.
257- execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
258+ execute unless entity @s[type=minecraft: item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
258259 function *global/errors/function_not_executed_as_root_entity \
259260 {'export_namespace': '<%export_namespace%>', 'function_path': '<%arguments[1].functions.at(-1)%>'}
260261 }
261- $data modify storage aj:temp args.command set value '$(command)'
262+ data remove storage aj:temp args
263+ $data modify storage aj:temp args merge value {name:'$(name)', command:'$(command)'}
262264 $execute \
263265 on passengers \
264266 if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] \
265267 run block zzz/as_locator/as_data { {name: $(name)}
266268 $data modify storage aj:temp args.uuid set from entity @s data.uuids.locator_$(name)
269+ scoreboard players set #aj.check <%OBJECTIVES.I()%> 0
267270 block execute_as_uuid { with storage aj:temp args
268- $execute as $(uuid) run $(command)
271+ $execute as $(uuid) at @s run $(command)
272+ scoreboard players set #aj.check <%OBJECTIVES.I()%> 1
269273 }
274+ execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.LOCATOR_NOT_FOUND_ENTITY()%>
270275 }
271276 }
272277
273278 function as_all_locators {
274279 #ARGS: {command: string}
275280 IF (show_function_errors) {
276281 # Assert that the function is being run as the root entity.
277- execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
282+ execute unless entity @s[type=minecraft: item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
278283 function *global/errors/function_not_executed_as_root_entity \
279284 {'export_namespace': '<%export_namespace%>', 'function_path': '<%arguments[1].functions.at(-1)%>'}
280285 }
@@ -284,17 +289,93 @@ dir <%export_namespace%> {
284289 REPEAT (Object.values(rig.nodes).filter(v => v.type === 'locator' && v.config?.use_entity)) as locator {
285290 data modify storage aj:temp args.uuid set from entity @s data.uuids.<%locator.type + '_' + locator.name%>
286291 block execute_as_uuid { with storage aj:temp args
287- $execute as $(uuid) run $(command)
292+ $execute as $(uuid) at @s run $(command)
288293 }
289294 }
290295 }
291296 }
292297 }
293298
299+ IF (has_locators) {
300+ function at_locator {
301+ #ARGS: {name: string, command: string}
302+ IF (show_function_errors) {
303+ # Assert that the function is being run as the root entity.
304+ execute unless entity @s[type=minecraft:item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
305+ function *global/errors/function_not_executed_as_root_entity \
306+ {'export_namespace': '<%export_namespace%>', 'function_path': '<%arguments[1].functions.at(-1)%>'}
307+ }
308+ data remove storage aj:temp args
309+ $data modify storage aj:temp args merge value {name:'$(name)', command:'$(command)'}
310+ $execute \
311+ on passengers \
312+ if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] \
313+ run block zzz/at_locator/as_data { {name: $(name)}
314+ $execute unless data entity @s {data:{locators:{$(name):{}}}} run return run tellraw @a <%TELLRAW.LOCATOR_NOT_FOUND()%>
315+ $data modify storage aj:temp args merge from entity @s data.locators.$(name)
316+ block execute_at_transform { with storage aj:temp args
317+ $execute \
318+ positioned ^$(posx) ^$(posy) ^$(posz) \
319+ rotated ~$(roty) ~$(rotx) \
320+ run $(command)
321+ }
322+ }
323+ }
324+
325+ function at_all_locators {
326+ #ARGS: {command: string}
327+ IF (show_function_errors) {
328+ # Assert that the function is being run as the root entity.
329+ execute unless entity @s[type=minecraft:item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
330+ function *global/errors/function_not_executed_as_root_entity \
331+ {'export_namespace': '<%export_namespace%>', 'function_path': '<%arguments[1].functions.at(-1)%>'}
332+ }
333+ data remove storage aj:temp args
334+ $data modify storage aj:temp args.command set value '$(command)'
335+ execute on passengers if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] run block zzz/at_all_locators/as_data {
336+ REPEAT (Object.values(rig.nodes).filter(v => v.type === 'locator' && v.config?.use_entity)) as locator {
337+ data modify storage aj:temp args merge from entity @s data.locators.<%locator.name%>
338+ block execute_at_transform { with storage aj:temp args
339+ $execute \
340+ positioned ^$(posx) ^$(posy) ^$(posz) \
341+ rotated ~$(roty) ~$(rotx) \
342+ run $(command)
343+ }
344+ }
345+ }
346+ }
347+ }
348+
349+ IF (has_cameras) {
350+ function as_camera {
351+ #ARGS: {name: string, command: string}
352+ IF (show_function_errors) {
353+ # Assert that the function is being run as the root entity.
354+ execute unless entity @s[type=minecraft:item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
355+ function *global/errors/function_not_executed_as_root_entity \
356+ {'export_namespace': '<%export_namespace%>', 'function_path': '<%arguments[1].functions.at(-1)%>'}
357+ }
358+ data remove storage aj:temp args
359+ $data modify storage aj:temp args merge value {name:'$(name)', command:'$(command)'}
360+ $execute \
361+ on passengers \
362+ if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] \
363+ run block zzz/as_camera/as_data { {name: $(name)}
364+ data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name)
365+ scoreboard players set #aj.check <%OBJECTIVES.I()%> 0
366+ block execute_as_uuid { with storage aj:temp args
367+ $execute as $(uuid) at @s run $(command)
368+ scoreboard players set #aj.check <%OBJECTIVES.I()%> 1
369+ }
370+ execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
371+ }
372+ }
373+ }
374+
294375 dir remove {
295376 function all {
296377 # Removes all instances of this rig from the world.
297- execute as @e[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run function *<%export_namespace%>/remove/this
378+ execute as @e[type=minecraft: item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run function *<%export_namespace%>/remove/this
298379 }
299380
300381 function entities {
@@ -306,7 +387,7 @@ dir <%export_namespace%> {
306387 # Removes the rig this function is executed as.
307388 IF (show_function_errors) {
308389 # Assert that the function is being executed as the root entity.
309- execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
390+ execute unless entity @s[type=minecraft: item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
310391 function *global/errors/function_not_executed_as_root_entity \
311392 {'export_namespace': '<%export_namespace%>', 'function_path': '<%arguments[1].functions.at(-1)%>'}
312393 }
@@ -356,7 +437,7 @@ dir <%export_namespace%> {
356437 function apply {
357438 IF (show_function_errors) {
358439 # Assert that the function is being executed as the root entity.
359- execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
440+ execute unless entity @s[type=minecraft: item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
360441 function *global/errors/function_not_executed_as_root_entity \
361442 {'export_namespace': '<%export_namespace%>', 'function_path': '<%arguments[1].functions.at(-1)%>'}
362443 }
@@ -393,7 +474,7 @@ dir <%export_namespace%> {
393474 # Changes the pose of the rig to the the default pose without interpolation
394475 IF (show_function_errors) {
395476 # Assert that the function is being run as the root entity.
396- execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
477+ execute unless entity @s[type=minecraft: item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
397478 function *global/errors/function_not_executed_as_root_entity \
398479 {'export_namespace': '<%export_namespace%>', 'function_path': '<%arguments[1].functions.at(-1)%>'}
399480 }
0 commit comments