mojira.dev
MC-82965

Main hand item use animation plays when using offhand (3rd person mode)

When you place something with your left hand, it will take action with your right hand.

Reproduce:
Do F5 and see your body, Have a torch on left hand, right click on the 'block', and it will use your right hand to place it.


Code analysis by @unknown can be found in this comment.

Linked issues

MC-83311 When in F3 mode and using an item in off hand, main hand swings Resolved MC-83557 Left Hand Dual Wield Animation Resolved MC-83603 Offhand and Mainhand Animation Bug Resolved MC-83752 Wrong animation when using offhand slot Resolved MC-84206 Incorrect Placing Movement Resolved

Attachments

Comments 11

Confirmed for 15w44b.

Still an issue in 15w47c.

Still an issue in 1.9-pre2. Particularly odd when using a bow in the off-hand.

1 more comments

not fixed in <insert minecraft version here>
or
confirmed for <insert minecraft version here>
are usefull
no fix :/
isn't as usefull at all

Confirmed for

  • 1.9-pre3

Please link to this comment in the description

The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.

The reason why this happens is because the method net.minecraft.client.model.ModelBiped.setRotationAngles(float, float, float, float, float, float, Entity) is using the method net.minecraft.client.model.ModelBiped.getMainHand(Entity) to determine the hand the animation should play for, which is as the name suggests always the mainhand.

/**
 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
 * "far" arms and legs can swing at most.
 */
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
{
    //...

    if (this.swingProgress > 0.0F)
    {
        EnumHandSide enumhandside = this.getMainHand(entityIn);
        
        // Added this
        if (entityIn instanceof EntityLivingBase && !(((EntityLivingBase) entityIn).field_184622_au == EnumHand.MAIN_HAND)) {
            enumhandside = enumhandside.opposite();
        }
        
        //...
    }
    
    //...
}

Confirmed for 1.9.3-pre3

Dito Windyaksa

Agnes Larsson

Confirmed

animation, item, third-person

Minecraft 15w31a, Minecraft 15w31b, Minecraft 15w32a, Minecraft 15w32c, Minecraft 15w35e, ..., Minecraft 16w14a, Minecraft 1.9.3 Pre-Release 1, Minecraft 1.9.3 Pre-Release 3, Minecraft 16w21b, Minecraft 1.10

Minecraft 16w33a

Retrieved