0

I am trying to summon a villager that will trade custom player heads in 1.15.2.

Here is the code I have found to summon a villager trading a mob head:

/summon villager ~ ~1 ~ {VillagerData:{profession:farmer,level:5,type:plains},Offers:{Recipes:[{buy:{id:emerald,Count:1},sell:{id:dragon_head,Count:1},maxUses:1}]}}

Here is the code I have found to give myself a custom player head from FreshCoal.com, but it seems that something may be slightly off with this code. It works in a command block, but also triggers a warning:

/give @p player_head{display:{Name:"Strawberry Jam"},SkullOwner:{Id:"adc3ea73-5b42-4fea-a237-4a72b5",Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzBiOGI1ODg5ZWUxYzYzODhkYzZjMmM1ZGJkNzBiNjk4NGFlZmU1NDMxOWEwOTVlNjRkYjc2MzgwOTdiODIxIn19fQ=="}]}}}

Here is the code that I try for the custom villager, but it does not work:

/summon villager ~ ~1 ~ {VillagerData:{profession:farmer,level:5,type:plains},Offers:{Recipes:[{buy:{id:emerald,Count:1},sell:{id:player_head{display:{Name:"Strawberry Jam"},SkullOwner:{Id:"adc3ea73-5b42-4fea-a237-4a72b5",Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzBiOGI1ODg5ZWUxYzYzODhkYzZjMmM1ZGJkNzBiNjk4NGFlZmU1NDMxOWEwOTVlNjRkYjc2MzgwOTdiODIxIn19fQ=="}]}}},Count:1},maxUses:1}]}}

How can I change the code to make it work correctly? Right now, my villager trades only air.

0

When using /give, all the data you write between the curly brackets is moved into the item's tag compound. For example, this will give you a named stick:

/give @s stick{display:{Name:"\"Hello world\""}}

Everything you write in between the first pair of curly brackets (stick{display:{Name:"\"Hello world\""}}) is actually tag:{display:{Name:"\"Hello world\""}}.

This way of specifying NBT only works with the /give command and you can't use it in other NBT tags. More info on the item data structure: https://minecraft.gamepedia.com/Item_(entity)#Data_values

here is the correct version of your command:

/summon villager ~ ~1 ~ {VillagerData:{profession:farmer,level:5,type:plains},Offers:{Recipes:[{buy:{id:emerald,Count:1},sell:{id:"player_head",tag:{display:{Name:"Strawberry Jam"},SkullOwner:{Id:"adc3ea73-5b42-4fea-a237-4a72b5",Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzBiOGI1ODg5ZWUxYzYzODhkYzZjMmM1ZGJkNzBiNjk4NGFlZmU1NDMxOWEwOTVlNjRkYjc2MzgwOTdiODIxIn19fQ=="}]}}},Count:1},maxUses:1}]}}
| improve this answer | |
  • Thank you! This worked perfectly! – Megan Mar 8 at 23:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.