Skip to content

Commit f8badb6

Browse files
committed
🛠️ Fix #208
1 parent 829714a commit f8badb6

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

src/systems/datapackCompiler/animation.mcb

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ dir global {
4040

4141
dir errors {
4242
function function_not_executed_as_root_entity {
43-
$tellraw @a <%TELLRAW.FUNCTION_NOT_EXECUTED_AS_ROOT_ERROR('$(function_path)', TAGS.PROJECT_ROOT(export_namespace))%>
43+
#ARGS: {export_namespace: string, function_path: string}
44+
$tellraw @a <%TELLRAW.FUNCTION_NOT_EXECUTED_AS_ROOT_ERROR('$(function_path)', TAGS.PROJECT_ROOT('$(export_namespace)'))%>
4445
}
4546
}
4647

@@ -217,35 +218,35 @@ dir <%export_namespace%> {
217218
function play {
218219
execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
219220
function *global/errors/function_not_executed_as_root_entity \
220-
{'function_path': 'animated_java:<%export_namespace%>/animations/<%animation.name%>/play'}
221+
{'export_namespace': '<%export_namespace%>', 'function_path': 'animated_java:<%export_namespace%>/animations/<%animation.name%>/play'}
221222
tag @s add <%TAGS.ANIMATION_PLAYING(export_namespace, animation.name)%>
222223
scoreboard players set @s <%OBJECTIVES.FRAME()%> 0
223224
execute at @s run function ./zzz/set_frame {frame: 0}
224225
}
225226
function stop {
226227
execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
227228
function *global/errors/function_not_executed_as_root_entity \
228-
{'function_path': 'animated_java:<%export_namespace%>/animations/<%animation.name%>/stop'}
229+
{'export_namespace': '<%export_namespace%>', 'function_path': 'animated_java:<%export_namespace%>/animations/<%animation.name%>/stop'}
229230
tag @s remove <%TAGS.ANIMATION_PLAYING(export_namespace, animation.name)%>
230231
scoreboard players set @s <%OBJECTIVES.FRAME()%> 0
231232
execute at @s run function ./zzz/set_frame {frame: 0}
232233
}
233234
function pause {
234235
execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
235236
function *global/errors/function_not_executed_as_root_entity \
236-
{'function_path': 'animated_java:<%export_namespace%>/animations/<%animation.name%>/pause'}
237+
{'export_namespace': '<%export_namespace%>', 'function_path': 'animated_java:<%export_namespace%>/animations/<%animation.name%>/pause'}
237238
tag @s remove <%TAGS.ANIMATION_PLAYING(export_namespace, animation.name)%>
238239
}
239240
function resume {
240241
execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
241242
function *global/errors/function_not_executed_as_root_entity \
242-
{'function_path': 'animated_java:<%export_namespace%>/animations/<%animation.name%>/resume'}
243+
{'export_namespace': '<%export_namespace%>', 'function_path': 'animated_java:<%export_namespace%>/animations/<%animation.name%>/resume'}
243244
tag @s add <%TAGS.ANIMATION_PLAYING(export_namespace, animation.name)%>
244245
}
245246
function next_frame {
246247
execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
247248
function *global/errors/function_not_executed_as_root_entity \
248-
{'function_path': 'animated_java:<%export_namespace%>/animations/<%animation.name%>/next_frame'}
249+
{'export_namespace': '<%export_namespace%>', 'function_path': 'animated_java:<%export_namespace%>/animations/<%animation.name%>/next_frame'}
249250
execute if score @s <%OBJECTIVES.FRAME()%> matches <%animation.duration%>.. run scoreboard players set @s <%OBJECTIVES.FRAME()%> 1
250251
execute store result storage aj:temp frame int 1 run scoreboard players get @s <%OBJECTIVES.FRAME()%>
251252
execute at @s run function ./zzz/apply_frame with storage aj:temp
@@ -256,15 +257,15 @@ dir <%export_namespace%> {
256257
#ARGS: {frame: int}
257258
execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
258259
function *global/errors/function_not_executed_as_root_entity \
259-
{'function_path': 'animated_java:<%export_namespace%>/animations/<%animation.name%>/set_frame'}
260+
{'export_namespace': '<%export_namespace%>', 'function_path': 'animated_java:<%export_namespace%>/animations/<%animation.name%>/set_frame'}
260261
$execute store result storage aj:temp frame int 1 run scoreboard players set @s <%OBJECTIVES.FRAME()%> $(frame)
261262
execute at @s run function ./zzz/set_frame with storage aj:temp
262263
}
263264
function apply_frame {
264265
# ARGS: {frame: int}
265266
execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
266267
function *global/errors/function_not_executed_as_root_entity \
267-
{'function_path': 'animated_java:<%export_namespace%>/animations/<%animation.name%>/apply_frame'}
268+
{'export_namespace': '<%export_namespace%>', 'function_path': 'animated_java:<%export_namespace%>/animations/<%animation.name%>/apply_frame'}
268269
$execute store result storage aj:temp frame int 1 run scoreboard players set @s <%OBJECTIVES.FRAME()%> $(frame)
269270
execute at @s run function ./zzz/apply_frame with storage aj:temp
270271
}
@@ -273,7 +274,7 @@ dir <%export_namespace%> {
273274
#ARGS: {duration: int, to_frame: int}
274275
execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
275276
function *global/errors/function_not_executed_as_root_entity \
276-
{'function_path': 'animated_java:<%export_namespace%>/animations/<%animation.name%>/tween_play'}
277+
{'export_namespace': '<%export_namespace%>', 'function_path': 'animated_java:<%export_namespace%>/animations/<%animation.name%>/tween_play'}
277278
function *<%export_namespace%>/animations/pause_all
278279

279280
tag @s add <%TAGS.ANIMATION_PLAYING(export_namespace, animation.name)%>
@@ -446,7 +447,7 @@ dir <%export_namespace%> {
446447
# Pauses all animations
447448
execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
448449
function *global/errors/function_not_executed_as_root_entity \
449-
{'function_path': 'animated_java:<%export_namespace%>/animations/pause_all'}
450+
{'export_namespace': '<%export_namespace%>', 'function_path': 'animated_java:<%export_namespace%>/animations/pause_all'}
450451
REPEAT (animations) as animation {
451452
tag @s remove <%TAGS.ANIMATION_PLAYING(export_namespace, animation.name)%>
452453
}
@@ -584,7 +585,7 @@ dir <%export_namespace%> {
584585
#ARGS: {command: string}
585586
execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
586587
function *global/errors/function_not_executed_as_root_entity \
587-
{'function_path': 'animated_java:<%export_namespace%>/as_all_locators'}
588+
{'export_namespace': '<%export_namespace%>', 'function_path': 'animated_java:<%export_namespace%>/as_all_locators'}
588589
$data modify storage aj:temp command set value '$(command)'
589590
execute on passengers if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] run {
590591
REPEAT (Object.values(rig.nodeMap).filter(v => v.type === 'locator')) as locator {
@@ -605,7 +606,7 @@ dir <%export_namespace%> {
605606
function this {
606607
execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
607608
function *global/errors/function_not_executed_as_root_entity \
608-
{'function_path': 'animated_java:<%export_namespace%>/remove/this'}
609+
{'export_namespace': '<%export_namespace%>', 'function_path': 'animated_java:<%export_namespace%>/remove/this'}
609610

610611
# On Remove Event
611612
function #*<%export_namespace%>/as_root/on_remove
@@ -632,7 +633,7 @@ dir <%export_namespace%> {
632633
function apply {
633634
execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
634635
function *global/errors/function_not_executed_as_root_entity \
635-
{'function_path': 'animated_java:<%export_namespace%>/variants/<%defaultVariant.name%>/apply'}
636+
{'export_namespace': '<%export_namespace%>', 'function_path': 'animated_java:<%export_namespace%>/variants/<%defaultVariant.name%>/apply'}
636637
REPEAT (Object.values(rig.nodeMap)) as node {
637638
IF (node.type === 'bone') {
638639
execute on passengers if entity @s[tag=aj.<%export_namespace%>.bone.<%node.name%>] run {
@@ -654,7 +655,7 @@ dir <%export_namespace%> {
654655
function apply {
655656
execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
656657
function *global/errors/function_not_executed_as_root_entity \
657-
{'function_path': 'animated_java:<%export_namespace%>/variants/<%variant.name%>/apply'}
658+
{'export_namespace': '<%export_namespace%>', 'function_path': 'animated_java:<%export_namespace%>/variants/<%variant.name%>/apply'}
658659
REPEAT (Object.values(rig.nodeMap)) as node {
659660
IF (node.type === 'bone' && !Object.values(variant.excludedNodes).find(v => v.value === node.node.uuid) && (rig.variantModels[variant.uuid][node.node.uuid] !== undefined || node.configs.variants[variant.uuid])) {
660661
execute on passengers if entity @s[tag=aj.<%export_namespace%>.bone.<%node.name%>] run {
@@ -682,7 +683,7 @@ dir <%export_namespace%> {
682683
# Changes the pose of the rig to the the default pose with interpolation
683684
execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
684685
function *global/errors/function_not_executed_as_root_entity \
685-
{'function_path': 'animated_java:<%export_namespace%>/apply_default_pose'}
686+
{'export_namespace': '<%export_namespace%>', 'function_path': 'animated_java:<%export_namespace%>/apply_default_pose'}
686687
REPEAT (rig.defaultTransforms) as node {
687688
IF (['bone', 'text_display', 'item_display', 'block_display'].includes(node.type)) {
688689
execute on passengers if entity @s[tag=aj.<%export_namespace%>.bone.<%node.name%>] run \
@@ -694,7 +695,7 @@ dir <%export_namespace%> {
694695
# Changes the pose of the rig to the the default pose without interpolation
695696
execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
696697
function *global/errors/function_not_executed_as_root_entity \
697-
{'function_path': 'animated_java:<%export_namespace%>/set_default_pose'}
698+
{'export_namespace': '<%export_namespace%>', 'function_path': 'animated_java:<%export_namespace%>/set_default_pose'}
698699
REPEAT (rig.defaultTransforms) as node {
699700
IF (['bone', 'text_display', 'item_display', 'block_display'].includes(node.type)) {
700701
execute on passengers if entity @s[tag=aj.<%export_namespace%>.bone.<%node.name%>] run \

0 commit comments

Comments
 (0)