Skip to content

Commit 82d49f6

Browse files
committed
✨ Sync animation changes with static
1 parent 5032016 commit 82d49f6

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

src/systems/datapackCompiler/1.20.4/static.mcb

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ IF (!auto_update_rig_orientation) {
108108
if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] \
109109
run function ./on_tick/transform_floating_entities
110110
}
111-
112111
execute at @s on passengers run tp @s ~ ~ ~ ~ ~
113112
}
114113
} ELSE {
@@ -550,33 +549,40 @@ IF (Object.keys(rig.variants).length > 1) {
550549
debug assert executed_as_root_entity
551550

552551
<%%
553-
global.filteredBones = Object.values(rig.nodes).filter(
554-
node => node.type === 'bone' &&
555-
!variant.excluded_nodes.includes(node.uuid) &&
556-
( // Variant has a model override or a config override for this bone.
557-
variant.models[node.uuid] !== undefined ||
552+
global.filteredNodes = Object.values(rig.nodes).filter(
553+
node => (
554+
node.type === 'bone' &&
555+
!variant.excluded_nodes.includes(node.uuid) &&
556+
( // Variant has a model override or a config override for this bone.
557+
variant.models[node.uuid] !== undefined ||
558+
node.configs.variants[variant.uuid] !== undefined
559+
)
560+
) || (
561+
BONE_TYPES.includes(node.type) &&
562+
!variant.excluded_nodes.includes(node.uuid) &&
563+
// Variant has a config override for this node.
558564
node.configs.variants[variant.uuid] !== undefined
559565
)
560566
)
561567
%%>
562568

563-
REPEAT (global.filteredBones) as bone {
569+
REPEAT (global.filteredNodes) as node {
564570
execute \
565571
on passengers \
566-
if entity @s[tag=<%TAGS.PROJECT_NODE_NAMED(export_namespace, bone.storage_name)%>] \
572+
if entity @s[tag=<%TAGS.PROJECT_NODE_NAMED(export_namespace, node.storage_name)%>] \
567573
run \
568-
block zzz/apply_to_bone_<%bone.storage_name%> {
569-
IF (variant.models[bone.uuid] !== undefined) {
574+
block zzz/apply_to_node_<%node.storage_name%> {
575+
IF (node.type === 'bone' && variant.models[node.uuid] !== undefined) {
570576
# Special case for `animated_java:empty` model.
571-
IF (variant.models[bone.uuid].model === null) {
577+
IF (variant.models[node.uuid].model === null) {
572578
data modify entity @s item.tag.CustomModelData set value 1
573579
} ELSE {
574-
data modify entity @s item.tag.CustomModelData set value <%variant.models[bone.uuid].custom_model_data%>
580+
data modify entity @s item.tag.CustomModelData set value <%variant.models[node.uuid].custom_model_data%>
575581
}
576582
}
577-
IF (bone.configs.variants[variant.uuid]) {
583+
IF (node.configs.variants[variant.uuid]) {
578584
<%%
579-
global.config = BoneConfig.fromJSON(bone.configs.variants[variant.uuid])
585+
global.config = DisplayEntityConfig.fromJSON(node.configs.variants[variant.uuid])
580586
%%>
581587
IF (!global.config.isDefault()) {
582588
data merge entity @s <%global.config.toNBT(undefined, variant.is_default)%>

0 commit comments

Comments
 (0)