mojira.dev
MC-275917

Consumable blocking animation is broken in first person

When using the "block" animation via the consumable component, there is no visual animation in first person

/give @s iron_sword[consumable={animation:"block",consume_seconds:72000}]
[media][media]

My proposition to fix this, is by using this piece of code taken from one of the early 1.9 snapshots before shields where added, and still had sword blocking:

(The piece of code has been updated to work in 1.21 (Mappings: Mojang (via Intermediary)))

this.applyItemArmTransform(matrices, arm, equipProgress);
this.applyItemArmAttackTransform(matrices, arm, swingProgress);
matrices.translate(l * -0.14142136F, 0.08F, 0.14142136F);
matrices.mulPose(Axis.XP.rotationDegrees(-102.25F));
matrices.mulPose(Axis.YP.rotationDegrees(l * 13.365F));
matrices.mulPose(Axis.ZP.rotationDegrees(l * 78.05F));

This piece of code is from ItemInHandRenderer.renderArmWithItem, in the item usage switch branch for BLOCK enum value

Do note, this code doesn't work with the shield model sadly but does work for everything else. This is presumably because, the shield has a predicate & seperate model for when blocking which this collides with.

Linked issues

Attachments

Comments 2

I know this is a longshot, but if this gets fixed I hope it also would be possible for swords to have their old 3rd person animation too from 1.7, as it was so much better

lowercasebtw

(Unassigned)

1287857

Confirmed

Expansion B

Normal

Player Animation

24w34a, 24w35a, 24w36a, 24w38a, 1.21.2

24w44a

Retrieved