1

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
  • Welcome to Arqade! Could you please specify what you have tried?
    – WarpPrime
    Jul 29, 2020 at 18:15
  • ive tried /data modify entity @e[type=“minecraft:villager”] Offers.Recipes[trade] insert 1 value newtrade Ive also tried this for append set merge and prepend and am usure if my target path is sufficent for what i am trying to do.
    – Ironotor
    Jul 29, 2020 at 18:49
  • im trying to make a datapack that adds a quest system to minecraft. the quests are started by quest items sold by villagers. i want the quests trades to be removed when they run out of stock but still keep the original trades that the villagers have. this way i can refresh the quests trades after a certain amount of time.
    – Ironotor
    Jul 29, 2020 at 19:01
  • 1
    It would be better if you put that content from the comment into your post by editing it.
    – WarpPrime
    Jul 29, 2020 at 19:48

1 Answer 1

0

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
  • Thanks! it took a bit of tinkering but i was able to remove a trade using this!
    – Ironotor
    Jul 29, 2020 at 19:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .