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 1 commit 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
10 changes: 8 additions & 2 deletions src/systems/datapackCompiler/1.20.4/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.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
10 changes: 8 additions & 2 deletions src/systems/datapackCompiler/1.20.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.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
10 changes: 8 additions & 2 deletions src/systems/datapackCompiler/1.21.2/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.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
10 changes: 8 additions & 2 deletions src/systems/datapackCompiler/1.21.4/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.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