Minecraft command: villager trading adventure mode items

Minecraft command: villager trading adventure mode items - Red Airplane Toy

Can someone tell me why this command doesn't work?

/summon Villager ~ ~1 ~ {CustomName:Jerry,CustomNameVisible:0,NoAI:1,Offers:{Recipes:[{maxUses:10,buy:{id:lever,Count:1,Damage:#},buyB:{id:cooked_porkchop,Count:30,Damage:#},sell:{id:lever 1 0 {CanPlaceOn:["minecraft:diamond_ore"]},Count:1,Damage:#}}]}}

the villager isn't selling adventure mode item



Best Answer

Your id value for the sell compound is incorrect. It appears you may have copy/pasted a /give command into NBT data. The entire line "lever 1 0 {CanPlaceOn:["minecraft:diamond_ore"]}" is seen as the item's ID, which is invalid.

Any tags that are not the root id, Damage, Count, and Slot must be placed within a single tag compound.

Fixed command:

/summon Villager ~ ~1 ~ {CustomName:Jerry,CustomNameVisible:0,NoAI:1,Offers:{Recipes:[{maxUses:10,buy:{id:lever,Count:1,Damage:0},buyB:{id:cooked_porkchop,Count:30,Damage:0},sell:{id:lever,Count:1,Damage:0,tag:{CanPlaceOn:["minecraft:diamond_ore"]}}}]}}



Pictures about "Minecraft command: villager trading adventure mode items"

Minecraft command: villager trading adventure mode items - Elderly Men in a Street Sale
Minecraft command: villager trading adventure mode items - Green Trees and Houses Under White Clouds
Minecraft command: villager trading adventure mode items -  Niesen Funicular Staircase



How do you get villagers to trade specific items?

There is (currently) no way to change a villager type's trades using a data pack. But you can detect the career using commands and then change the trades directly. This command has to be put into an always active repeating command block in the spawn chunks or into a ticking function.



Setting up CUSTOM TRADES in Vanilla Minecraft 1.17! (Part 1)




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Porapak Apichodilok, Надежда Ильина, Markus Spiske, Corinna Widmer