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

Stonecutter does not support multiple recipes with the same result item type


    • Icon: Bug Bug
    • Resolution: Fixed
    • 1.20.5 Pre-Release 2
    • 24w10a, 24w12a
    • None
    • Confirmed
    • Crafting, UI
    • Important
    • Platform

      This issue has existed for a while, but until 24w10a it didn't apply to vanilla as there was no way to add recipes to a stonecutter for which the result itemstack had any custom data. With data components and the codecs for recipes being updated to allow custom data, this issue is now reproducible in vanilla.

      You cannot add 2 recipes with a common input whose outputs are the same item type. I have attached a datapack that reproduces the problem, adding 16 recipes, one for each light block level when given an oak plank as an input. You can see that by clicking on the buttons for each recipe, the output does not match the button you clicked.

      The cause is a little complex and I first explained it here. The gist is that the Stonecutter recipe selection system relies on a list index for all applicable recipes being the same on the client and server. But the *ordering* of that list is set by RecipeManager#getRecipesFor(RecipeType, Container, Level). In getRecipesFor, the list is sorted using a Comparator that compares the description IDs for the result item which leads to ambiguous ordering when 2 identical result items are present. So the indices in this list get out of sync between the client and the server leading to the visual inconsistency between the button icons and the itemstack put into the result slot of the stonecutter inventory.

      Steps to Reproduce

      1. Download and install the attached test_datapack.
      2. Place an oak_plank inside a Stonecutter and click around on the various recipes that show up, recipes that are added by the datapack
      3. Observe that the item created in the result slot does not match the recipe that you clicked on.

            gegy1000 [Mojang] Gegy
            Machine Maker Jake Potrebic
            11 Vote for this issue
            5 Start watching this issue