I'm trying to have a custom villager trade be: input a shulker box with 1 stone in the first slot, to receive 1 stone. I plan to have the trade be other things, but I can't get this fundamental trade to work.
The villager's trade gui seems correct, he properly asks for a white shulker box with a tag of 1x stone. However, when trying to give him a white shulker box with 1 stone in slot 0, or any slot for that matter, he won't accept it.
I've done the reverse and made him sell me the shulker box by giving him 1 stone, and I receive a white shulker box with 1 stone in slot 0. Strangely enough, he accepts the exact shulker box he sold me as input for the first trade, despite there being no differences from a box I create. If I take the box he sold me, take the stone out, and put it back in, then he won't accept it as input for the first trade.
Are villagers unable to properly check contents of a shulker box? Or is there some other hidden data that needs to be established? Any help would be appreciated.
This is no longer working in 1.12.2 -- even villagers generated by MCStacker won't recognize shulker boxes populated with the correct items. Couldn't find anything with a google search, any idea why?
Apparently, I had to add the "minecraft:" prefix to id names, and add the Damage:0s tags. He now accepts player-made shulker boxes.
Yep. Whenever you test for nbt in entities, they have to be prefixed and suffixed correctly.
All items must have the "minecraft:item" format
Counts, Slots, etc are a BYTE (b)
Motion, direction, etc are DOUBLES (d)
and so on and so forth
It looks like there was an extra Damage tag for the shulker box itself that I was missing in my own code. I looked more closely this time and got it working
I'm trying to have a custom villager trade be: input a shulker box with 1 stone in the first slot, to receive 1 stone. I plan to have the trade be other things, but I can't get this fundamental trade to work.
The command:
/summon Villager ~1 ~ ~ {
Profession: 0,
CustomName: "Jeff",
CustomNameVisible: 1,
Career: 1,
CareerLevel: 42,
CanPickUpLoot: 0,
PersistenceRequired: 1,
Invulnerable: 1,
Offers: {
Recipes: [
{
buy: {
id: "white_shulker_box",tag:{BlockEntityTag:{Items:[{id:"stone",Slot:0b,Count:1b}]}},
Count: 1
},
maxUses: 9999999,
sell: {
id: "stone",
Count: 1
},
rewardExp: false
}
]
}
}
The villager's trade gui seems correct, he properly asks for a white shulker box with a tag of 1x stone. However, when trying to give him a white shulker box with 1 stone in slot 0, or any slot for that matter, he won't accept it.
I've done the reverse and made him sell me the shulker box by giving him 1 stone, and I receive a white shulker box with 1 stone in slot 0. Strangely enough, he accepts the exact shulker box he sold me as input for the first trade, despite there being no differences from a box I create. If I take the box he sold me, take the stone out, and put it back in, then he won't accept it as input for the first trade.
Are villagers unable to properly check contents of a shulker box? Or is there some other hidden data that needs to be established? Any help would be appreciated.
Thanks so much! The working command is:
/summon Villager ~1 ~ ~ {
Profession: 0,
CustomName: "Jeff",
CustomNameVisible: 1,
Career: 1,
CareerLevel: 42,
CanPickUpLoot: 0,
PersistenceRequired: 1,
Invulnerable: 1,
Offers: {
Recipes: [
{
buy: {
id: "minecraft:white_shulker_box",tag:{BlockEntityTag:{Items:[0:{id:"minecraft:stone",Slot:0b,Count:1b,Damage:0s}]}},Damage:0s,
Count: 1b
},
maxUses: 9999999,
sell: {
id: "stone",
Count: 1
},
rewardExp: false
}
]
}
}
Apparently, I had to add the "minecraft:" prefix to id names, and add the Damage:0s tags. He now accepts player-made shulker boxes.
This is no longer working in 1.12.2 -- even villagers generated by MCStacker won't recognize shulker boxes populated with the correct items. Couldn't find anything with a google search, any idea why?
Yep. Whenever you test for nbt in entities, they have to be prefixed and suffixed correctly.
All items must have the "minecraft:item" format
Counts, Slots, etc are a BYTE (b)
Motion, direction, etc are DOUBLES (d)
and so on and so forth
YouTube: https://www.youtube.com/channel/UCzGDRYWcrGreMmQFo_d5N5Q
Facebook:https://goo.gl/s0r12d
Website:https://theusaf.weebly.com
JavaScript Projects: https://theusaf.github.io
Link Shortener: https://shortr.github.io
Twitter:https://www.twitter.com/theusafyt
It looks like there was an extra Damage tag for the shulker box itself that I was missing in my own code. I looked more closely this time and got it working