You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Fixed locators and cameras not animating when using storage-based animation.
- Fixed animation storage data commands being too long.
- Added a progress bar for generating animation storage.
Copy file name to clipboardExpand all lines: src/systems/animated_java.mcb
+15-5Lines changed: 15 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -124,7 +124,9 @@ dir <%export_namespace%> {
124
124
125
125
function on_load {
126
126
IF (use_storage_for_animation) {
127
-
data modify storage aj.<%export_namespace%>:animations list set value {}
127
+
REPEAT (animations) as animation {
128
+
data remove storage aj.<%export_namespace%>:animations <%animation.storageSafeName%>
129
+
}
128
130
<%animationStorage.join('\n')%>
129
131
}
130
132
execute as @e[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] \
@@ -323,18 +325,26 @@ dir <%export_namespace%> {
323
325
IF (use_storage_for_animation) {
324
326
function set_frame {
325
327
#ARGS: {frame: int}
326
-
REPEAT (animation.includedNodes) as node {
328
+
REPEAT (animation.includedNodes.sort(nodeSorter)) as node {
327
329
IF (['bone', 'text_display', 'item_display', 'block_display'].includes(node.type)) {
328
-
$execute on passengers run data modify entity @s[tag=<%TAGS.LOCAL_BONE(export_namespace, node.name)%>] {} merge from storage aj.<%export_namespace%>:animations list.<%animation.storageSafeName%>.frames[$(frame)].<%node.name%>
330
+
$execute on passengers run data modify entity @s[tag=<%TAGS.LOCAL_BONE(export_namespace, node.name)%>] {} merge from \
execute on passengers run data modify entity @s[type=!marker] start_interpolation set value -1
332
338
}
333
339
function apply_frame {
334
340
#ARGS: {frame: int}
335
-
REPEAT (animation.includedNodes) as node {
341
+
REPEAT (animation.includedNodes.sort(nodeSorter)) as node {
336
342
IF (['bone', 'text_display', 'item_display', 'block_display'].includes(node.type)) {
337
-
$execute on passengers run data modify entity @s[tag=<%TAGS.LOCAL_BONE(export_namespace, node.name)%>] {} merge from storage aj.<%export_namespace%>:animations list.<%animation.storageSafeName%>.frames[$(frame)].<%node.name%>
343
+
$execute on passengers if entity @s[tag=<%TAGS.LOCAL_BONE(export_namespace, node.name)%>] run data modify entity @s {} merge from \
}:animations list.${animation.storageSafeName} set value ${animStorage.toString()}`
450
-
if(str.length>2000000){
451
-
// FIXME - Temporary patch. Split each animation's storage into multiple commands if it's too large.
452
-
thrownewError(
453
-
`The animation storage for '${animation.name}' is too large! The data command must be less than 2000000 characters long. (Currently ${str.length} characters).`
454
-
)
455
-
}
456
-
storage.push(str)
477
+
addFrameDataCommand()
478
+
PROGRESS.set(PROGRESS.get()+1)
479
+
awaitlimiter.sync()
457
480
}
458
-
returnstorage
481
+
482
+
returndataCommands
459
483
}
460
484
485
+
// function createAnimationStorage(animations: IRenderedAnimation[]) {
486
+
// const storage: string[] = []
487
+
488
+
// for (const animation of animations) {
489
+
// const frames = new NbtList([
490
+
// new NbtCompound(), // This compound is just to make the list 1-indexed
491
+
// ])
492
+
// const animStorage = new NbtCompound().set('frames', frames)
// }:animations list.${animation.storageSafeName} set value ${animStorage.toString()}`
510
+
// if (str.length > 2000000) {
511
+
// // FIXME - Temporary patch. Split each animation's storage into multiple commands if it's too large.
512
+
// throw new Error(
513
+
// `The animation storage for '${animation.name}' is too large! The data command must be less than 2000000 characters long. (Currently ${str.length} characters).`
0 commit comments