mojira.dev
MC-83620

Placing items on armor stand from off-hand impossible

The bug

If you try to put an item on an armor stand with the off-hand, nothing happens.

Fix

EntityArmorStand.java

public EnumActionResult applyPlayerInteraction(EntityPlayer player, Vec3d vec, EnumHand stack)
    {
        ItemStack itemstack = player.getHeldItem(stack);
		
        if (!this.hasMarker() && itemstack.getItem() != Items.NAME_TAG)
        {
//          if (!this.world.isRemote && !player.isSpectator())
++          if (!player.isSpectator())
            {
                EntityEquipmentSlot entityequipmentslot = EntityLiving.getSlotForItemStack(itemstack);

                if (itemstack.isEmpty())
                {
                    EntityEquipmentSlot entityequipmentslot1 = this.getClickedSlot(vec);
                    EntityEquipmentSlot entityequipmentslot2 = this.isDisabled(entityequipmentslot1) ? entityequipmentslot : entityequipmentslot1;

                    if (this.hasItemInSlot(entityequipmentslot2))
                    {
                        this.swapItem(player, entityequipmentslot2, itemstack, stack);
++                      return EnumActionResult.SUCCESS;
                    }
                    
++                  return EnumActionResult.FAIL;
                }
                else
                {
                    if (this.isDisabled(entityequipmentslot))
                    {
                        return EnumActionResult.FAIL;
                    }

                    if (entityequipmentslot.getSlotType() == EntityEquipmentSlot.Type.HAND && !this.getShowArms())
                    {
                        return EnumActionResult.FAIL;
                    }

                    this.swapItem(player, entityequipmentslot, itemstack, stack);
                }

                return EnumActionResult.SUCCESS;
            }
            else
            {
//              return EnumActionResult.SUCCESS;
++              return EnumActionResult.PASS;
            }
        }
        else
        {
            return EnumActionResult.PASS;
        }
    }

Fixing this also fixes MC-112995.

Linked issues

Attachments

Comments 15

Confirmed. Happens even when main hand is empty.

confirmed for 15w44b

Can confirm for MC 1.12.1.

Can confirm in 20w51a.

Can confirm in 21w03a.

5 more comments

Can confirm in 1.17.1.

Can confirm in 1.18.1.

Can confirm in 1.18.2.

Can confirm in 1.19 and 1.19.1 Pre-release 2.

Can confirm in 1.19.2.

bob robert

lord.quadrato

(Unassigned)

Confirmed

Platform

Normal

Entities, Player

armor_stand, item, off-hand

Minecraft 15w31a, Minecraft 15w44b, Minecraft 1.10.2, Minecraft 16w32a, Minecraft 16w32b, ..., 1.20.1, 1.20.3 Release Candidate 1, 1.20.4, 24w44a, 1.21.3

Retrieved