mojira.dev
MC-137700

/drop with weapon slot can place items in the head slot

How to reproduce

  1. Run the following command

    /drop entity @s weapon loot minecraft:chests/buried_treasure

    → Notice that it put items in your mainhand, offhand and head slot. It doesn't put items in any other part of your inventory

Note: The same happens when using weapon.mainhand. When using weapon.offhand, only the offhand and the head slot are filled with items

Linked issues

Comments 3

Working as intended: if used without `count`, `/drop entity` will fill consecutive slots with drops. Armor slots are filled because their numbers start just after weapons (`weapon.offhand + 1` == `armor.head`).

Use `/drop entity @s weapon 1 loot minecraft:chests/buried_treasure` if you want to use only that slot (note: slot will be cleared if loot table drops nothing).

@unknown Even if filling other slots if you don't specify a count is intended, it's really weird that it could fill armor slots. And the thing is, only the head slot is affected. No other slots, which seems inconsistent.

Armor slots are in the same id "namespace" as normal inventory, ender chest, etc. (part of functionality for making `/replaceitem` works). I don't see any need to hardcode that specific distinction. I can even see that being used as feature, to replace all armor slot at once (armor sets? randomized armor selection?).

As for "inconsistency" - it works same as `/replaceitem`: only head slot accepts any item, other armor slots accepts only armor or elytra. If loot table had valid items for that slots, it would place without problem.

Misode

boq

Confirmed

/drop

Minecraft 18w43b

Retrieved