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

Cannot remove horse saddle using /replaceitem


    • Icon: Bug Bug
    • Resolution: Fixed
    • 20w46a
    • Minecraft 1.11, Minecraft 1.12 Pre-Release 6, Minecraft 1.12, Minecraft 1.12.1 Pre-Release 1, Minecraft 1.12.2, Minecraft 17w47b, Minecraft 18w02a, Minecraft 18w11a, Minecraft 18w19b, Minecraft 1.13-pre1, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 18w48a, Minecraft 18w48b, Minecraft 18w49a, Minecraft 18w50a, Minecraft 19w12b, Minecraft 19w13b, 1.15.1, 1.15.2 Pre-release 2, 1.15.2, 20w06a, 20w14a, 20w15a, 20w16a, 20w17a, 20w18a, 20w19a, 20w20a, 20w20b, 20w21a, 20w22a, 1.16 Pre-release 5, 1.16 Pre-release 8
    • Confirmed
    • (Unassigned)

      The bug

      Using /replaceitem you cannot set the horse saddle to air (remove it), one would expect it to function the same as any other slot.

      How to reproduce

      1. Summon a horse:
        /summon horse ~ ~ ~ {Tame:1}
      2. Add a saddle:
        /replaceitem entity @e[type=horse,limit=1] horse.saddle saddle

        See "Replaced a slot on Horse with [Saddle]"

      3. Try to remove the saddle:
        /replaceitem entity @e[type=horse,limit=1] horse.saddle air

        See "Could not put [Air] in slot 400"

      Code analysis

      The following is based on a decompiled version of Minecraft using MCP for 1.11.
      The replaceItemInInventory() method in class net.minecraft.entity.passive.AbstractHorse requires the item to be a saddle at all times:

      if (i == 0 && itemStackIn.getItem() != Items.SADDLE)
          return false;

      This is unlike other mob equipment such as ArmorItems, where the contents can be deleted by replacing with "air".

            Unassigned Unassigned
            urielsalis [Mod] Urielsalis
            13 Vote for this issue
            6 Start watching this issue