When trying to modify villager inventory with /data (specifically the item Count) it always either adds or duplicates the value.
How to recreate:
/summon villager
Drop some items that villager can pick up (in this case 3 potatoes)
/data get entity @e[type=villager,sort=nearest,limit=1] Inventory
The item Count will show 3/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/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/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.