mojira.dev
MC-275911

Villagers can't have custom trades with buy items using removed components (e.g. "!minecraft:food")

Trying to set custom villager trades which is buying items using negated/removed components causes a console error, and sets the trade incorrectly. When it's in the buy slot, the component in question is ignored, and when in the buyB slot it seems to just remove the buyB entry entirely. 

 

Reproduce:

Take a villager, give them any workstation so they have a profession, then run the following command from a command block to add a custom trade using removed components.

data modify entity @e[type=villager,sort=nearest,limit=1] Offers.Recipes append value {buy:{id:"minecraft:porkchop",components:{"!minecraft:food":{}}},buyB:{id:"minecraft:porkchop",components:{"!minecraft:food":{}}},sell:{id:"minecraft:porkchop",components:{"!minecraft:food":{}}}}

The buyB slot is not present when the villager GUI is opened, and when running the following command, they show that the "!minecraft:food" component has been removed in the buy slot, but not in the sell slot

data get entity @e[type=villager,sort=nearest,limit=1] Offers.Recipes[-1]

 

The following error is also logged to the console:

[media]

 

Tested in 1.21, 1.21.1, 24w34a

Linked issues

Attachments

Comments 2

Thank you for your report!
We're tracking this issue in MC-274451, so this ticket is being resolved and linked as a duplicate.

That ticket has already been resolved as invalid. Please take a look at the parent ticket (MC-274451) and see if an explanation is provided there in the description of the ticket or in the comments for why this issue is invalid.

If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

EnigmaTek

(Unassigned)

Unconfirmed

(Unassigned)

1.21.1, 24w34a

Retrieved