@@ -705,15 +705,19 @@ dir <%export_namespace%> {
705
705
function *global/errors/function_not_executed_as_root_entity \
706
706
{'export_namespace': '<%export_namespace%>', 'function_path': '<%arguments[1].functions.at(-1)%>'}
707
707
}
708
- $data modify storage aj:temp args.command set value '$(command)'
708
+ data remove storage aj:temp args
709
+ $data modify storage aj:temp args merge value {name:'$(name)', command:'$(command)'}
709
710
$execute \
710
711
on passengers \
711
712
if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] \
712
713
run block zzz/as_locator/as_data { {name: $(name)}
713
714
$data modify storage aj:temp args.uuid set from entity @s data.uuids.locator_$(name)
715
+ scoreboard players set #aj.check <%OBJECTIVES.I()%> 0
714
716
block execute_as_uuid { with storage aj:temp args
715
- $execute as $(uuid) run $(command)
717
+ $execute as $(uuid) at @s run $(command)
718
+ scoreboard players set #aj.check <%OBJECTIVES.I()%> 1
716
719
}
720
+ execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.LOCATOR_NOT_FOUND_ENTITY()%>
717
721
}
718
722
}
719
723
@@ -731,7 +735,57 @@ dir <%export_namespace%> {
731
735
REPEAT (Object.values(rig.nodes).filter(v => v.type === 'locator' && v.config?.use_entity)) as locator {
732
736
data modify storage aj:temp args.uuid set from entity @s data.uuids.<%locator.type + '_' + locator.name%>
733
737
block execute_as_uuid { with storage aj:temp args
734
- $execute as $(uuid) run $(command)
738
+ $execute as $(uuid) at @s run $(command)
739
+ }
740
+ }
741
+ }
742
+ }
743
+ }
744
+
745
+ IF (has_locators) {
746
+ function at_locator {
747
+ #ARGS: {name: string, command: string}
748
+ IF (show_function_errors) {
749
+ # Assert that the function is being run as the root entity.
750
+ execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
751
+ function *global/errors/function_not_executed_as_root_entity \
752
+ {'export_namespace': '<%export_namespace%>', 'function_path': '<%arguments[1].functions.at(-1)%>'}
753
+ }
754
+ data remove storage aj:temp args
755
+ $data modify storage aj:temp args merge value {name:'$(name)', command:'$(command)'}
756
+ $execute \
757
+ on passengers \
758
+ if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] \
759
+ run block zzz/at_locator/as_data { {name: $(name)}
760
+ $execute unless data entity @s {data:{locators:{$(name):{}}}} run return run tellraw @a <%TELLRAW.LOCATOR_NOT_FOUND()%>
761
+ $data modify storage aj:temp args merge from entity @s data.locators.$(name)
762
+ block execute_at_transform { with storage aj:temp args
763
+ $execute \
764
+ positioned ^$(posx) ^$(posy) ^$(posz) \
765
+ rotated ~$(roty) ~$(rotx) \
766
+ run $(command)
767
+ }
768
+ }
769
+ }
770
+
771
+ function at_all_locators {
772
+ #ARGS: {command: string}
773
+ IF (show_function_errors) {
774
+ # Assert that the function is being run as the root entity.
775
+ execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
776
+ function *global/errors/function_not_executed_as_root_entity \
777
+ {'export_namespace': '<%export_namespace%>', 'function_path': '<%arguments[1].functions.at(-1)%>'}
778
+ }
779
+ data remove storage aj:temp args
780
+ $data modify storage aj:temp args.command set value '$(command)'
781
+ execute on passengers if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] run block zzz/at_all_locators/as_data {
782
+ REPEAT (Object.values(rig.nodes).filter(v => v.type === 'locator' && v.config?.use_entity)) as locator {
783
+ data modify storage aj:temp args merge from entity @s data.locators.<%locator.name%>
784
+ block execute_at_transform { with storage aj:temp args
785
+ $execute \
786
+ positioned ^$(posx) ^$(posy) ^$(posz) \
787
+ rotated ~$(roty) ~$(rotx) \
788
+ run $(command)
735
789
}
736
790
}
737
791
}
0 commit comments