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
is duplicated by
relates to
Comments


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

Confirmed.

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.

Resolving as invalid since blocking was removed in 15w33c.

Still applies to shields.

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.

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

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;
}
}
}

How are they duplicates? Marking them as related instead

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.

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.
Confirmed for 18w30b
Confirmed for 18w31a

Confirmed for 18w50a

Affects 20w13b

Affects 20w17a

Fixed in 1.16 Pre-release 8.
Confirmed fixed in 1.16-pre8.
confirmed, but only when both are occupied by a sword