Hi, I hope I didn't overlooked an already existing bugreport but pretty sure it isn't WAI.
Basically you can add items to an Inventory of a piglin but can't remove it or set the count lower via /data. But it works for things like Handitems of the same piglin. It even duplicates every (non selected) slot of the piglin inventory.
Steps to Reproduce:
1.) spawn a piglin via
/summon minecraft:piglin ~ ~ ~ {IsImmuneToZombification:1b,NoAI:1b,Inventory[{id:"minecraft:stone",Count:2b}]}
2.) try to remove the stone:
/data remove entity @e[type=minecraft:piglin,limit=1,sort=nearest] Inventory[0]
It says "Modified entity data of Piglin"
3.) run
/data get entity @e[type=minecraft:piglin,limit=1,sort=nearest] Inventory
❌ We get the feedback "Piglin has the following entity data: [{id: "minecraft:stone",Count: 2b}]"
Please note:
Works too, if the piglin itself picket up items (will pick up if in the piglins loved tag).
NoAI:1b was set so the piglin don't wander of and IsImmuneToZombification to work in the overworld but these aren't necessary at all to see the bug.
If you try to override the Inventory list with another one, like with chest placed right under you
/data modify entity @e[type=minecraft:piglin,limit=1,sort=nearest] Inventory set from block ~ ~ ~ Items
it will add all the items of the chest ❌ but will not remove any from the piglins inventory.
If you do
/data modify entity @e[type=minecraft:piglin,limit=1,sort=nearest] Inventory[0].Count set value 1
❌ it will add all positive values but not substract negative ones.
Yes I'm on a fresh singleplayer world without datapacks and it happens without any mods.
Related issues
Attachments
Comments

Thank you for the detailed report, however unfortunately this falls under the same case as MC-112826