Skip to content

fix: function as_camera does not work & enhance error handling for it #428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: version/1.7.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "Animated Java",
"icon": "icon.svg",
"description": "A Blockbench plugin that makes complex animation a breeze in Minecraft: Java Edition.",
"version": "1.7.2",
"version": "1.7.3",
"min_blockbench_version": "4.12.0",
"variant": "desktop",
"tags": [
Expand Down
14 changes: 14 additions & 0 deletions src/pluginPackage/changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,5 +191,19 @@
]
}
]
},
"1.7.3": {
"title": "v1.7.3",
"author": "Titus Evans (SnaveSutit)",
"date": "2025-05-08",
"categories": [
{
"title": "Fixes",
"list": [
"Fixed adding cameras to a rig causing the data entity to dismount root.",
"Make variant keyframes reset to default if their variant doesn't exist anymore"
]
}
]
}
}
17 changes: 12 additions & 5 deletions src/systems/datapackCompiler/1.20.4/animation.mcb
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ dir <%export_namespace%> {
type=<%locator.config.entity_type%>, \
tag=<%TAGS.NEW()%>, \
tag=<%TAGS.PROJECT_LOCATOR_NAMED(export_namespace, locator.storage_name)%>, \
distance=..<%locator.max_distance + 1%> \
distance=..<%Math.ceil(locator.max_distance)%> \
] \
run block as_locator/<%locator.path_name%> {
# run block ../as_locator/<%locator.path_name%> {
Expand Down Expand Up @@ -582,9 +582,10 @@ dir <%export_namespace%> {
type=minecraft:item_display, \
tag=<%TAGS.NEW()%>, \
tag=<%TAGS.PROJECT_CAMERA_NAMED(export_namespace, camera.storage_name)%>, \
distance=..<%camera.max_distance + 1%> \
distance=..<%Math.ceil(camera.max_distance)%> \
] \
run block ../as_camera/<%camera.path_name%> {
run block as_camera/<%camera.path_name%> {
# run block ../as_camera/<%camera.path_name%> {
tag @s remove <%TAGS.NEW()%>
function *global/internal/gu/convert_uuid_array_to_string
tp @s \
Expand Down Expand Up @@ -807,13 +808,19 @@ dir <%export_namespace%> {
on passengers \
if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] \
run block zzz/as_camera/as_data { {name: $(name)}
data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name)
$data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name).uuid
scoreboard players set #aj.check <%OBJECTIVES.I()%> 0
block execute_as_uuid { with storage aj:temp args
$execute as $(uuid) at @s run $(command)
scoreboard players set #aj.check <%OBJECTIVES.I()%> 1
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run block if_failed {
block check_existence { with storage aj:temp args
$execute at $(uuid) run scoreboard players set #aj.check <%OBJECTIVES.I()%> 2
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 2 run tellraw @a <%TELLRAW.COMMAND_RUN_FAILED()%>
}
}
}
}
Expand Down
10 changes: 8 additions & 2 deletions src/systems/datapackCompiler/1.20.4/static.mcb
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,19 @@ dir <%export_namespace%> {
on passengers \
if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] \
run block zzz/as_camera/as_data { {name: $(name)}
data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name)
$data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name).uuid
scoreboard players set #aj.check <%OBJECTIVES.I()%> 0
block execute_as_uuid { with storage aj:temp args
$execute as $(uuid) at @s run $(command)
scoreboard players set #aj.check <%OBJECTIVES.I()%> 1
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run block if_failed {
block check_existence { with storage aj:temp args
$execute at $(uuid) run scoreboard players set #aj.check <%OBJECTIVES.I()%> 2
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 2 run tellraw @a <%TELLRAW.COMMAND_RUN_FAILED()%>
}
}
}
}
Expand Down
17 changes: 12 additions & 5 deletions src/systems/datapackCompiler/1.20.5/animation.mcb
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ dir <%export_namespace%> {
type=<%locator.config.entity_type%>, \
tag=<%TAGS.NEW()%>, \
tag=<%TAGS.PROJECT_LOCATOR_NAMED(export_namespace, locator.storage_name)%>, \
distance=..<%locator.max_distance + 1%> \
distance=..<%Math.ceil(locator.max_distance)%> \
] \
run block as_locator/<%locator.path_name%> {
# run block ../as_locator/<%locator.path_name%> {
Expand Down Expand Up @@ -582,9 +582,10 @@ dir <%export_namespace%> {
type=minecraft:item_display, \
tag=<%TAGS.NEW()%>, \
tag=<%TAGS.PROJECT_CAMERA_NAMED(export_namespace, camera.storage_name)%>, \
distance=..<%camera.max_distance + 1%> \
distance=..<%Math.ceil(camera.max_distance)%> \
] \
run block ../as_camera/<%camera.path_name%> {
run block as_camera/<%camera.path_name%> {
# run block ../as_camera/<%camera.path_name%> {
tag @s remove <%TAGS.NEW()%>
function *global/internal/gu/convert_uuid_array_to_string
tp @s \
Expand Down Expand Up @@ -807,13 +808,19 @@ dir <%export_namespace%> {
on passengers \
if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] \
run block zzz/as_camera/as_data { {name: $(name)}
data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name)
$data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name).uuid
scoreboard players set #aj.check <%OBJECTIVES.I()%> 0
block execute_as_uuid { with storage aj:temp args
$execute as $(uuid) at @s run $(command)
scoreboard players set #aj.check <%OBJECTIVES.I()%> 1
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run block if_failed {
block check_existence { with storage aj:temp args
$execute at $(uuid) run scoreboard players set #aj.check <%OBJECTIVES.I()%> 2
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 2 run tellraw @a <%TELLRAW.COMMAND_RUN_FAILED()%>
}
}
}
}
Expand Down
10 changes: 8 additions & 2 deletions src/systems/datapackCompiler/1.20.5/static.mcb
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,19 @@ dir <%export_namespace%> {
on passengers \
if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] \
run block zzz/as_camera/as_data { {name: $(name)}
data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name)
$data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name).uuid
scoreboard players set #aj.check <%OBJECTIVES.I()%> 0
block execute_as_uuid { with storage aj:temp args
$execute as $(uuid) at @s run $(command)
scoreboard players set #aj.check <%OBJECTIVES.I()%> 1
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run block if_failed {
block check_existence { with storage aj:temp args
$execute at $(uuid) run scoreboard players set #aj.check <%OBJECTIVES.I()%> 2
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 2 run tellraw @a <%TELLRAW.COMMAND_RUN_FAILED()%>
}
}
}
}
Expand Down
17 changes: 12 additions & 5 deletions src/systems/datapackCompiler/1.21.2/animation.mcb
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ dir <%export_namespace%> {
type=<%locator.config.entity_type%>, \
tag=<%TAGS.NEW()%>, \
tag=<%TAGS.PROJECT_LOCATOR_NAMED(export_namespace, locator.storage_name)%>, \
distance=..<%locator.max_distance + 1%> \
distance=..<%Math.ceil(locator.max_distance)%> \
] \
run block as_locator/<%locator.path_name%> {
# run block ../as_locator/<%locator.path_name%> {
Expand Down Expand Up @@ -582,9 +582,10 @@ dir <%export_namespace%> {
type=minecraft:item_display, \
tag=<%TAGS.NEW()%>, \
tag=<%TAGS.PROJECT_CAMERA_NAMED(export_namespace, camera.storage_name)%>, \
distance=..<%camera.max_distance + 1%> \
distance=..<%Math.ceil(camera.max_distance)%> \
] \
run block ../as_camera/<%camera.path_name%> {
run block as_camera/<%camera.path_name%> {
# run block ../as_camera/<%camera.path_name%> {
tag @s remove <%TAGS.NEW()%>
function *global/internal/gu/convert_uuid_array_to_string
tp @s \
Expand Down Expand Up @@ -807,13 +808,19 @@ dir <%export_namespace%> {
on passengers \
if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] \
run block zzz/as_camera/as_data { {name: $(name)}
data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name)
$data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name).uuid
scoreboard players set #aj.check <%OBJECTIVES.I()%> 0
block execute_as_uuid { with storage aj:temp args
$execute as $(uuid) at @s run $(command)
scoreboard players set #aj.check <%OBJECTIVES.I()%> 1
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run block if_failed {
block check_existence { with storage aj:temp args
$execute at $(uuid) run scoreboard players set #aj.check <%OBJECTIVES.I()%> 2
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 2 run tellraw @a <%TELLRAW.COMMAND_RUN_FAILED()%>
}
}
}
}
Expand Down
10 changes: 8 additions & 2 deletions src/systems/datapackCompiler/1.21.2/static.mcb
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,19 @@ dir <%export_namespace%> {
on passengers \
if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] \
run block zzz/as_camera/as_data { {name: $(name)}
data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name)
$data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name).uuid
scoreboard players set #aj.check <%OBJECTIVES.I()%> 0
block execute_as_uuid { with storage aj:temp args
$execute as $(uuid) at @s run $(command)
scoreboard players set #aj.check <%OBJECTIVES.I()%> 1
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run block if_failed {
block check_existence { with storage aj:temp args
$execute at $(uuid) run scoreboard players set #aj.check <%OBJECTIVES.I()%> 2
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 2 run tellraw @a <%TELLRAW.COMMAND_RUN_FAILED()%>
}
}
}
}
Expand Down
17 changes: 12 additions & 5 deletions src/systems/datapackCompiler/1.21.4/animation.mcb
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ dir <%export_namespace%> {
type=<%locator.config.entity_type%>, \
tag=<%TAGS.NEW()%>, \
tag=<%TAGS.PROJECT_LOCATOR_NAMED(export_namespace, locator.storage_name)%>, \
distance=..<%locator.max_distance + 1%> \
distance=..<%Math.ceil(locator.max_distance)%> \
] \
run block as_locator/<%locator.path_name%> {
# run block ../as_locator/<%locator.path_name%> {
Expand Down Expand Up @@ -582,9 +582,10 @@ dir <%export_namespace%> {
type=minecraft:item_display, \
tag=<%TAGS.NEW()%>, \
tag=<%TAGS.PROJECT_CAMERA_NAMED(export_namespace, camera.storage_name)%>, \
distance=..<%camera.max_distance + 1%> \
distance=..<%Math.ceil(camera.max_distance)%> \
] \
run block ../as_camera/<%camera.path_name%> {
run block as_camera/<%camera.path_name%> {
# run block ../as_camera/<%camera.path_name%> {
tag @s remove <%TAGS.NEW()%>
function *global/internal/gu/convert_uuid_array_to_string
tp @s \
Expand Down Expand Up @@ -807,13 +808,19 @@ dir <%export_namespace%> {
on passengers \
if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] \
run block zzz/as_camera/as_data { {name: $(name)}
data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name)
$data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name).uuid
scoreboard players set #aj.check <%OBJECTIVES.I()%> 0
block execute_as_uuid { with storage aj:temp args
$execute as $(uuid) at @s run $(command)
scoreboard players set #aj.check <%OBJECTIVES.I()%> 1
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run block if_failed {
block check_existence { with storage aj:temp args
$execute at $(uuid) run scoreboard players set #aj.check <%OBJECTIVES.I()%> 2
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 2 run tellraw @a <%TELLRAW.COMMAND_RUN_FAILED()%>
}
}
}
}
Expand Down
10 changes: 8 additions & 2 deletions src/systems/datapackCompiler/1.21.4/static.mcb
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,19 @@ dir <%export_namespace%> {
on passengers \
if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] \
run block zzz/as_camera/as_data { {name: $(name)}
data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name)
$data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name).uuid
scoreboard players set #aj.check <%OBJECTIVES.I()%> 0
block execute_as_uuid { with storage aj:temp args
$execute as $(uuid) at @s run $(command)
scoreboard players set #aj.check <%OBJECTIVES.I()%> 1
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run block if_failed {
block check_existence { with storage aj:temp args
$execute at $(uuid) run scoreboard players set #aj.check <%OBJECTIVES.I()%> 2
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 2 run tellraw @a <%TELLRAW.COMMAND_RUN_FAILED()%>
}
}
}
}
Expand Down
10 changes: 8 additions & 2 deletions src/systems/datapackCompiler/1.21.5/animation.mcb
Original file line number Diff line number Diff line change
Expand Up @@ -808,13 +808,19 @@ dir <%export_namespace%> {
on passengers \
if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] \
run block zzz/as_camera/as_data { {name: $(name)}
data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name)
$data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name).uuid
scoreboard players set #aj.check <%OBJECTIVES.I()%> 0
block execute_as_uuid { with storage aj:temp args
$execute as $(uuid) at @s run $(command)
scoreboard players set #aj.check <%OBJECTIVES.I()%> 1
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run block if_failed {
block check_existence { with storage aj:temp args
$execute at $(uuid) run scoreboard players set #aj.check <%OBJECTIVES.I()%> 2
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 2 run tellraw @a <%TELLRAW.COMMAND_RUN_FAILED()%>
}
}
}
}
Expand Down
10 changes: 8 additions & 2 deletions src/systems/datapackCompiler/1.21.5/static.mcb
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,19 @@ dir <%export_namespace%> {
on passengers \
if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] \
run block zzz/as_camera/as_data { {name: $(name)}
data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name)
$data modify storage aj:temp args.uuid set from entity @s data.cameras.$(name).uuid
scoreboard players set #aj.check <%OBJECTIVES.I()%> 0
block execute_as_uuid { with storage aj:temp args
$execute as $(uuid) at @s run $(command)
scoreboard players set #aj.check <%OBJECTIVES.I()%> 1
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run block if_failed {
block check_existence { with storage aj:temp args
$execute at $(uuid) run scoreboard players set #aj.check <%OBJECTIVES.I()%> 2
}
execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.CAMERA_NOT_FOUND_ENTITY()%>
execute if score #aj.check <%OBJECTIVES.I()%> matches 2 run tellraw @a <%TELLRAW.COMMAND_RUN_FAILED()%>
}
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/systems/datapackCompiler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,14 @@ namespace TELLRAW {
},
TELLRAW_SUFFIX(),
])
export const COMMAND_RUN_FAILED = () =>
new JsonText([
TELLRAW_PREFIX(),
{ text: 'Command ', color: 'red' },
{ nbt: 'args.command', storage: 'aj:temp', color: 'aqua' },
{ text: ' run failed!', color: 'red' },
TELLRAW_SUFFIX(),
])
}

async function generateRootEntityPassengers(
Expand Down
Loading