Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-275911

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 1.21.1, 24w34a
    • None
    • Unconfirmed
    • (Unassigned)

      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:

       

      Tested in 1.21, 1.21.1, 24w34a

            Unassigned Unassigned
            EnigmaTek EnigmaTek
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: