Skip to content

Commit 41adae4

Browse files
committed
🛠️ Half-Fix anim data cmd going over char limit
1 parent f35ed16 commit 41adae4

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/systems/animated_java.mcb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ dir <%export_namespace%> {
124124

125125
function on_load {
126126
IF (use_storage_for_animation) {
127-
data modify storage aj.<%export_namespace%>:animations list set value <%animationStorage.toString()%>
127+
data modify storage aj.<%export_namespace%>:animations list set value {}
128+
<%animationStorage.join('\n')%>
128129
}
129130
execute as @e[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] \
130131
unless score @s <%OBJECTIVES.IS_RIG_LOADED()%> matches 1 at @s run \

src/systems/datapackCompiler.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,13 +423,12 @@ class AJMeta {
423423
}
424424

425425
function createAnimationStorage(animations: IRenderedAnimation[]) {
426-
const storage: NbtCompound = new NbtCompound()
426+
const storage: string[] = []
427427
for (const animation of animations) {
428428
const frames = new NbtList([
429429
new NbtCompound(), // This compound is just to make the list 1-indexed
430430
])
431431
const animStorage = new NbtCompound().set('frames', frames)
432-
storage.set(animation.storageSafeName, animStorage)
433432
for (const frame of animation.frames) {
434433
const frameStorage = new NbtCompound()
435434
frames.add(frameStorage)
@@ -443,6 +442,16 @@ function createAnimationStorage(animations: IRenderedAnimation[]) {
443442
)
444443
}
445444
}
445+
const str = `data modify storage aj.${
446+
Project!.animated_java.export_namespace
447+
}:animations list.${animation.storageSafeName} set value ${animStorage.toString()}`
448+
if (str.length > 2000000) {
449+
// FIXME - Temporary patch. Split each animation's storage into multiple commands if it's too large.
450+
throw new Error(
451+
`The animation storage for '${animation.name}' is too large! The data command must be less than 2000000 characters long. (Currently ${str.length} characters).`
452+
)
453+
}
454+
storage.push(str)
446455
}
447456
return storage
448457
}

0 commit comments

Comments
 (0)