Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-274309

Holding leather horse armor in offhand and clicking moves it to your main hand

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 1.21
    • None
    • Community Consensus
    • Input, Inventory
    • Normal
    • Platform

       Reproduction Steps:

      • Hold leather horse armor in your offhand
      • Hold another item (like coal) in your main hand
      • Right-click, and notice how the items were swapped

       
      Issue:
      Equipable#swapWithEquipmentSlot calls LivingEntity#getEquipmentSlotForItem to get the slot for the item. The issue is that getEquipmentSlotForItem returns MAINHAND if the item is not usable by that entity (which in this case, leather horse armor returns false for canUseSlot)

      So this causes swapWithEquipmentSlot to incorrectly swap the items, as it thinks that item can be used.
       

            Unassigned Unassigned
            Owen1212055 Owen
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: