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

Shapeless recipes accept anything if one of their ingredients is an empty tag

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 1.21.2 Pre-Release 1
    • 24w39a
    • None
    • Confirmed
    • (Unassigned)
    • Low
    • Platform

      Shapeless recipes accept anything in empty tag ingredients. (As long as there is something).

      For example, the following recipe:

      {
        "type": "minecraft:crafting_shapeless",
        "category": "building",
        "ingredients": [
          "minecraft:diorite",
          "#c:cobblestones/doesntexist"
        ],
        "result": {
          "count": 2,
          "id": "minecraft:diamond"
        }
      }
      

      with the following tag file for the tag:

      {
        "values": []
      }
      

      causes a warning to be printed in the chat:

      Recipe minecraft:test_recipe can't be placed due to empty ingredients and will be ignored
      

      However, the recipe will accept any two items and give two diamonds as a result.

      How to reproduce:

      The attached data pack contains a shapeless recipe that accepts stone and an empty tag and returns smooth stone, and an empty item tag.

      1. Add the attached data pack to a world.
      2. Place any two items in a crafting grid.
        Smooth stone appears in the crafting output.

      Expected result:

      The recipe wouldn't validate due to the empty tag in the ingredients list.

      Observed result:

      A message is printed in the log saying that the recipe didn't validate, but putting any two items in a crafting grid outputs smooth stone.

      Possible cause:

      Looks like the PlacementInfo for the recipe is `PlacementInfo.NOT_PLACEABLE`, but that doesn't prevent the shapeless recipe from matching as long as the item count is equal to the ingredient count.

            boq [Mojang] Bartosz Bok
            Technici4n Technici4n
            Votes:
            5 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: