mojira.dev
MC-159946

/data works incorrectly with villager inventory

When trying to modify villager inventory with /data (specifically the item Count) it always either adds or duplicates the value.

How to recreate:

  1. /summon villager

  2. Drop some items that villager can pick up (in this case 3 potatoes)

  3. /data get entity @e[type=villager,sort=nearest,limit=1] Inventory
    The item Count will show 3

  4. /data modify entity @e[type=villager,sort=nearest,limit=1] Inventory[0].Count set value 1
    /data get entity @e[type=villager,sort=nearest,limit=1] Inventory
    The Count now will be 4

  5. /data modify entity @e[type=villager,sort=nearest,limit=1] Inventory insert 0 value {}
    /data get entity @e[type=villager,sort=nearest,limit=1] Inventory
    Item Count is now doubled and shows 8

  6. /data modify entity @e[type=villager,sort=nearest,limit=1] Inventory append value {id:"minecraft:wheat",Count:1b}
    /data get entity @e[type=villager,sort=nearest,limit=1] Inventory
    The potato Count is now doubled again and shows 16
    if this step is repeated the values will double again, showing 32 potatoes in slot 0 and 3 wheat in slot 1, one more and counts will be 64 and 7

Related issues

Comments

No comments.

Andrey

(Unassigned)

Unconfirmed

Commands

/data, command, duplication, inventory, mob

1.14.4

Retrieved