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

When doLimitedCrafting is enabled, recipe result won't always be found when it exists

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 19w36a, 20w17a, 1.16.4, 20w51a, 1.20.5 Pre-Release 1
    • None
    • Plausible
    • (Unassigned)

      The bug

      Consider the following recipe:

      {
          "type": "minecraft:crafting_shapeless",
          "ingredients": [{
              "tag": "minecraft:logs"
          }],
          "result": {
              "item": "minecraft:apple"
          }
      } 

      Assume the doLimitedCrafting gamerule is on and this is the only recipe in the player's book.

      The vanilla planks recipes will still conflict with this one, resulting inĀ no item appearing in the results box for some logs.

      Analysis

      slotChangedCraftingGrid in CraftingMenu uses getRecipeFor to find the "first" recipe that matches the provided ingredients. Then, setRecipeUsed in the RecipeHolder interface can reject this recipe because the gamerule being enabled requires it to be present in the player's recipe book. As a result, nothing appears in the results slot.

      For a given log, if the custom recipe happens to be found first, all is well. But if the vanilla recipe is found first, it will be rejected and the custom recipe will never be checked. Since order is arbitrary, there is no consistency, but it is almost certain that some logs will have this problem in a given restart.

            Unassigned Unassigned
            tryashtar [Mod] tryashtar
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              CHK: