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

Shapeless recipes cannot be crafted using named or enchanted ingredients

XMLWordPrintable

    • Unconfirmed

      The bug

      As of the snapshots, any shapeless recipe cannot be crafted if any of its reagents are named or enchanted. This does not affect shaped recipes.

      For example, "flint and steel" cannot be crafted if either ingredient has been renamed in an anvil. Regarding single-item recipes (such as bones to bonemeal or ingots to nuggets), the crafting files are inconsistent, sometimes defining them as shapeless and sometimes as shaped, but with one ingredient. Only recipes defined as shapeless are affected.

      Code analysis by pokechu22:

      In the snapshots, the code for ShapelessRecipes.matches was changed from using a List<Ingredient> and several loops checking ingredient.apply to using RecipeItemHelper and accountStack. ingredient.apply did not care about NBT, but in RecipeItemHelper:

      public void accountStack(ItemStack stack)
      {
          if (!stack.isEmpty() && !stack.isItemDamaged() && !stack.isItemEnchanted() && !stack.hasDisplayName())
          {
              int i = pack(stack);
              int j = stack.getCount();
              this.increment(i, j);
          }
      }
      

      Shaped recipes continue to use ingredient.apply, so they are not affected.

      RecipeItemHelper is "mainly for the recipe book" deciding which items should be selected (to fix MC-116905), but it's also rendering those items invalid in the recipe itself. Again, this only affects shapeless recipes. If it is intended that named/enchanted items should be disallowed as crafting reagents, then shaped recipes should follow suit.

            grum [Mojang] Grum (Erik Broes)
            tryashtar [Mod] tryashtar
            Votes:
            5 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: