Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

Removing a specific trade from a villager (minecraft 1.16)

Writer Matthew Martinez

I'm trying to make it so that when a villager runs out of stock of a specific trade, it removes that trade from the villager.

I'm stuck at the part where I remove the trade. So far I can only wipe the villager's trades or add a new trade, but not remove a specific trade.

I've tried using

/data modify with the path : Offers.Recipes[{buy:{id:”minecraft:stone”},sell:{id:”minecraft stone”}}]

I've also tried it with the Count tag, but it does not work either.

4

1 Answer

Instead of using /data modify, use /data remove.

/data remove @e[type=villager,name="TheVillagerToActUpon",limit=1] Offers.Recipes[{buy:{id:"minecraft:stone"},sell:{id:"minecraft:stone"},Uses:5}]

Replace the 5 in Uses:5 to say how many times the trade can be used. Put the command in a repeating command block.

1