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
Summon a horse:
/summon horse ~ ~ ~ {Tame:1}
Add a saddle:
/replaceitem entity @e[type=horse,limit=1] horse.saddle saddle
→ ✔ See "Replaced a slot on Horse with [Saddle]"
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".
Linked issues
relates to 2
Comments 2
Still an issue for Mules/Donkeys/Zombie Horses/Skeleton Horses.
Created MC-205220
In 20w29a