mojira.dev
MC-82995

Blocking with two shields in 3rd person mode

The bug

In first person mode you will only block with your main hand shield, but in third person mode you will block with both. Though I think it isn't needed

How to reproduce

Video demonstrating the issue: https://www.youtube.com/watch?v=a6rJKS9DR6o

Code analysis

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

Related issues

MC-82975 When in F5 and duel wielding with 2 swords, right clicking to block blocks with both of them. MC-82996 You can dual block in third person mode MC-83007 Both hands rightclickable MC-83611 Double sword blocking in 3rd person MC-83889 sword animation problem MC-84203 Second Hand Not Working? MC-84212 Minecraft Sword-Bug MC-84221 When you keep 2 swords and blocking, left hand doesn't blocking in fps. but it shows in 3rd grade screen. MC-84263 Double Blocking MC-84271 Dual Wielding in third person with right click action activates both items MC-84478 Double Block MC-84553 A Bug with blocking with 2 swords with 2 hands MC-84996 Dual sword blocking appearance bug MC-85008 Minecraft Snapshot 15w31c Dual wielding swords shows one sword blocking in first person, but in third person it shows both blocking MC-85024 Swords in Off-Hand Ignore if Main Hand has right click function MC-85193 When blocking in third person with 2 swords, both block MC-85236 Dual Wielding in Third Person MC-85266 Dual-Wielding - Blocking bug MC-85283 It looks like you can block with 2 swords in F5 mode. MC-85431 While in F5 mode sword in offhand slot appears to block while left-clicking with sword in main hand MC-86149 Graphical Glitch MC-86655 When in testudo formation with shield only the shield in main hand takes damage MC-86658 Shield block bug MC-86950 Shield Duel Glitch MC-106376 Holding shields in both the main and off hands and pressing right click in third person shows both shields in use MC-114078 Graphical Shield Bug In Snapshot MC-122338 Dual Shield Visual Glitch MC-123561 Shield right click problem

Comments

migrated

confirmed, but only when both are occupied by a sword

migrated

Confirmed.

Also happens with swords (at least with diamond sword...)

migrated

Confirmed.

migrated

Will you please look at my bug report, too? It was marked as a duplicate of this, but it is much more informative and also tells bugs about dual wielding with other items such as bows, tools, and eyes of enders.

MC-85236

migrated

Resolving as invalid since blocking was removed in 15w33c.

migrated

Still applies to shields.

migrated

I tested it in the latest snapshot (34a). Both shields are protecting you from damage (tested using skeletons on both shields). Even though both shields block, only one of the shields get damaged for it [MC-86655] is not completely this bug, they are related though. Only the main hand shield gets damaged, while indeed both shields block you from damage.

marcono1234

Confirmed for

  • 15w36c You can also block with the offhand shield first by holding the right mouse button on an empty slot and while that switching to a slot with a shield

marcono1234

Confirmed for

  • 1.9.2

This report is duplicated by:

marcono1234

Please link to this comment in the description

The following is based on decompiled version of Minecraft 1.11 using MCP 9.35 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.renderer.entity.RenderPlayer.setModelVisibilities(AbstractClientPlayer) is not setting the ArmPose's based on the used item, but instead based on what the items in both hands can do.
The following shows how this could be solved using the existing methods net.minecraft.entity.EntityLivingBase.getActiveItemStack() and net.minecraft.entity.EntityLivingBase.getActiveHand().

private void setModelVisibilities(AbstractClientPlayer clientPlayer)
{
    ModelPlayer modelplayer = this.getMainModel();

    if (clientPlayer.isSpectator())
    {
        modelplayer.setInvisible(false);
        modelplayer.bipedHead.showModel = true;
        modelplayer.bipedHeadwear.showModel = true;
    }
    else
    {
        ItemStack itemstack = clientPlayer.getHeldItemMainhand();
        ItemStack itemstack1 = clientPlayer.getHeldItemOffhand();
        //...
        ModelBiped.ArmPose modelbiped$armpose = ModelBiped.ArmPose.EMPTY;
        ModelBiped.ArmPose modelbiped$armpose1 = ModelBiped.ArmPose.EMPTY;

        // Replaced this 
        
        //if (itemstack != null)
        //{
        //    modelbiped$armpose = ModelBiped.ArmPose.ITEM;
        //
        //    if (clientPlayer.getItemInUseCount() > 0)
        //    {
        //        EnumAction enumaction = itemstack.getItemUseAction();
        //
        //        if (enumaction == EnumAction.BLOCK)
        //        {
        //            modelbiped$armpose = ModelBiped.ArmPose.BLOCK;
        //        }
        //        else if (enumaction == EnumAction.BOW)
        //        {
        //            modelbiped$armpose = ModelBiped.ArmPose.BOW_AND_ARROW;
        //        }
        //    }
        //}
        //
        //if (itemstack1 != null)
        //{
        //    modelbiped$armpose1 = ModelBiped.ArmPose.ITEM;
        //
        //    if (clientPlayer.getItemInUseCount() > 0)
        //    {
        //        EnumAction enumaction1 = itemstack1.getItemUseAction();
        //
        //        if (enumaction1 == EnumAction.BLOCK)
        //        {
        //            modelbiped$armpose1 = ModelBiped.ArmPose.BLOCK;
        //        }
        //    }
        //}

        if (itemstack != null) {
            modelbiped$armpose = ModelBiped.ArmPose.ITEM;
        }
        
        if (itemstack1 != null) {
            modelbiped$armpose1 = ModelBiped.ArmPose.ITEM;
        }
        
        ItemStack itemStackInUse = clientPlayer.getActiveItemStack();
        if (itemStackInUse != null) {
            ModelBiped.ArmPose armPose = ModelBiped.ArmPose.EMPTY;
            EnumAction enumAction = itemStackInUse.getItemUseAction();
            
            if (enumAction == EnumAction.BLOCK) {
                armPose = ModelBiped.ArmPose.BLOCK;
            }
            else if (enumAction == EnumAction.BOW) {
                armPose = ModelBiped.ArmPose.BOW_AND_ARROW;
            }
            
            if (clientPlayer.getActiveHand() == EnumHand.MAIN_HAND) {
                modelbiped$armpose = armPose;
            }
            else {
                modelbiped$armpose1 = armPose;
            }
        }
        // End replacement

        if (clientPlayer.getPrimaryHand() == EnumHandSide.RIGHT)
        {
            modelplayer.rightArmPose = modelbiped$armpose;
            modelplayer.leftArmPose = modelbiped$armpose1;
        }
        else
        {
            modelplayer.rightArmPose = modelbiped$armpose1;
            modelplayer.leftArmPose = modelbiped$armpose;
        }
    }
}

This change also fixes MC-88356 & MC-86197.

migrated

How are they duplicates? Marking them as related instead

marcono1234

They are duplicates because the RenderPlayer is setting the pose to what can be done with both items. For example with MC-86197 the one item has eating as action and the other item has blocking as action. Both poses would be diplayed, but as eating has no arm pose only blocking is displayed.

But you can leave them as related if you want to.

migrated

Is this still an issue in the latest snapshot 16w44a? If so please update the affected versions.

This is an automated comment on any open or reopened issue with out-of-date affected versions.

Asteraoth

Confirmed for 18w30b

Asteraoth

Confirmed for 18w31a

migrated

Confirmed for 18w50a

migrated

Affects 20w13b

migrated

Affects 20w17a

j_p_smith

Fixed in 1.16 Pre-release 8.

violine1101

Confirmed fixed in 1.16-pre8.

Asteraoth

(Unassigned)

Confirmed

(Unassigned)

block, shield, third-person

Minecraft 15w31a, Minecraft 15w31b, Minecraft 15w32a, Minecraft 15w32c, Minecraft 15w33c, ..., Minecraft 1.14.3, 1.15.2, 20w12a, 20w13b, 20w17a

1.16 Pre-release 8

Retrieved