Page 1 of 1

How to make Shop keepers giving custom items?

PostPosted: 19 May 2021 05:51
by Soper21
I am trying to make shop keepers give a custom item of a book with a custom name can anyone help me with this thanks

How to make Shop keepers giving custom items?

PostPosted: 20 May 2021 17:34
by Scizith
I have been trying this as well. This page shows how to add a lore bit: https://pixelmonmod.com/wiki/NPC_JSONs#Shopkeepers
But not how to add a custom name to an item. This is possible through commands so I assume it’s possible through the JSON, the syntax is just weird and not sure how to do it. I have tried getting help on the discord but no help so far.

How to make Shop keepers giving custom items?

PostPosted: 25 May 2021 05:00
by Soper21
Thank you very much this has helped a fair amount

Re: How to make Shop keepers giving custom items?

PostPosted: 11 Aug 2023 04:26
by Erlandux
Hello I'm triyng to do the exact same thing, so after 2 days of researching I found this site: https://www.gamergeeks.net/apps/minecra ... nted-books
(Please don't forget when you enter the site to select "Java 1.12.2"

Here you use commands to give you a custom enchanted book, and after you select the enchanted book you want for example "Aqua Affinity" if you go to "Text" you can change the Name and the Lore of the book for wathever you want, for example instead having "Enchanted Book" you can have "Aqua Affinity 1".
To use that in shopkeepers, you need to copy this part "[{id:aqua_affinity,lvl:1}],display:{Name:"Aqua Affinity 1"}}" and paste it in the "shopItems.json" on "nbtData" of the enchanted book you want.

One example of an Aqua Affinity 1 enchanted book is:
{
"id": "aqua_affinity",
"name": "minecraft:enchanted_book",
"nbtData": "[{id:aqua_affinity,lvl:1}],display:{Name:"Aqua Affinity 1"}",
"buy": 10000
}

I hope I was able to help people to use the custom Shopkeepers of Pixelmon.

How to make Shop keepers giving custom items?

PostPosted: 11 Aug 2023 04:47
by Erlandux
When I explain the nbtData in if:... I forgot to select "Enchantments" in the website, so in reality it needs to be this ways:
"nbtData": "{display:{Name:"Affinity Book 1"},ench:[{id:6,lvl:1}]}"

One example is:

{
"id": "aqua_affinity",
"name": "minecraft:enchanted_book",
"nbtData": "{display:{Name:Aqua_Affinity_1},ench:[{id:6,lvl:1}]}",
"buy": 10000
}

I dont figure out, how can I use the display name with spaces, if someone knows pls tell me.

How to make Shop keepers giving custom items?

PostPosted: 11 Aug 2023 07:38
by SKyTheThunder
My approach would be to either use single quotes ( ' ) around the name, or if it doesn't take that to escape the double quotes inside your NBT text string ( \" ).
Your first version will register as two text strings ("[{id:aqua_affinity,lvl:1}],display:{Name:" and "}") with something in between that it doesn't understand.