@@ -17,24 +17,25 @@ dir <%export_namespace%> {
17
17
unless data entity @s {data:{rigHash: '<%rigHash%>'}} \
18
18
on vehicle \
19
19
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
24
25
$tellraw @a <%TELLRAW.RIG_OUTDATED()%>
25
26
}
26
27
data modify entity @s data.rigHash set value '<%rigHash%>'
27
28
execute on passengers run data merge entity @s {Glowing: 1b, glow_color_override: <%0xff0000%>}
28
29
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] \
38
39
} \
39
40
}
40
41
ride @e[type=minecraft:text_display,tag=<%TAGS.NEW()%>,limit=1,distance=..0.01] mount @s
@@ -126,7 +127,7 @@ dir <%export_namespace%> {
126
127
interpolation_duration: <%interpolation_duration%>, \
127
128
Passengers:<%root_entity_passengers%>, \
128
129
}
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 {
130
131
execute store result score @s <%OBJECTIVES.ID()%> run scoreboard players add aj.last_id <%OBJECTIVES.ID()%> 1
131
132
132
133
execute on passengers if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] run block as_data_entity {
@@ -168,14 +169,14 @@ dir <%export_namespace%> {
168
169
}
169
170
170
171
REPEAT (Object.values(rig.nodes).filter(v => v.type === 'camera')) as camera {
171
- summon item_display \
172
+ summon minecraft: item_display \
172
173
^<%roundTo(camera.default_transform.pos[0], 10)%> \
173
174
^<%roundTo(camera.default_transform.pos[1], 10)%> \
174
175
^<%roundTo(camera.default_transform.pos[2], 10)%> \
175
176
{Tags:<%getNodeTags(camera, rig)%>, teleport_duration: 2}
176
177
execute \
177
178
as @n[ \
178
- type=item_display, \
179
+ type=minecraft: item_display, \
179
180
tag=<%TAGS.NEW()%>, \
180
181
tag=<%TAGS.PROJECT_CAMERA_NAMED(export_namespace, camera.storage_name)%>, \
181
182
distance=..<%camera.max_distance + 1%> \
@@ -254,27 +255,31 @@ dir <%export_namespace%> {
254
255
#ARGS: {name: string, command: string}
255
256
IF (show_function_errors) {
256
257
# 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 \
258
259
function *global/errors/function_not_executed_as_root_entity \
259
260
{'export_namespace': '<%export_namespace%>', 'function_path': '<%arguments[1].functions.at(-1)%>'}
260
261
}
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)'}
262
264
$execute \
263
265
on passengers \
264
266
if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] \
265
267
run block zzz/as_locator/as_data { {name: $(name)}
266
268
$data modify storage aj:temp args.uuid set from entity @s data.uuids.locator_$(name)
269
+ scoreboard players set #aj.check <%OBJECTIVES.I()%> 0
267
270
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
269
273
}
274
+ execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.LOCATOR_NOT_FOUND_ENTITY()%>
270
275
}
271
276
}
272
277
273
278
function as_all_locators {
274
279
#ARGS: {command: string}
275
280
IF (show_function_errors) {
276
281
# 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 \
278
283
function *global/errors/function_not_executed_as_root_entity \
279
284
{'export_namespace': '<%export_namespace%>', 'function_path': '<%arguments[1].functions.at(-1)%>'}
280
285
}
@@ -284,17 +289,93 @@ dir <%export_namespace%> {
284
289
REPEAT (Object.values(rig.nodes).filter(v => v.type === 'locator' && v.config?.use_entity)) as locator {
285
290
data modify storage aj:temp args.uuid set from entity @s data.uuids.<%locator.type + '_' + locator.name%>
286
291
block execute_as_uuid { with storage aj:temp args
287
- $execute as $(uuid) run $(command)
292
+ $execute as $(uuid) at @s run $(command)
288
293
}
289
294
}
290
295
}
291
296
}
292
297
}
293
298
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
+
294
375
dir remove {
295
376
function all {
296
377
# 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
298
379
}
299
380
300
381
function entities {
@@ -306,7 +387,7 @@ dir <%export_namespace%> {
306
387
# Removes the rig this function is executed as.
307
388
IF (show_function_errors) {
308
389
# 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 \
310
391
function *global/errors/function_not_executed_as_root_entity \
311
392
{'export_namespace': '<%export_namespace%>', 'function_path': '<%arguments[1].functions.at(-1)%>'}
312
393
}
@@ -356,7 +437,7 @@ dir <%export_namespace%> {
356
437
function apply {
357
438
IF (show_function_errors) {
358
439
# 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 \
360
441
function *global/errors/function_not_executed_as_root_entity \
361
442
{'export_namespace': '<%export_namespace%>', 'function_path': '<%arguments[1].functions.at(-1)%>'}
362
443
}
@@ -393,7 +474,7 @@ dir <%export_namespace%> {
393
474
# Changes the pose of the rig to the the default pose without interpolation
394
475
IF (show_function_errors) {
395
476
# 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 \
397
478
function *global/errors/function_not_executed_as_root_entity \
398
479
{'export_namespace': '<%export_namespace%>', 'function_path': '<%arguments[1].functions.at(-1)%>'}
399
480
}
0 commit comments