Uploaded image for project: 'Minecraft API'
  1. Minecraft API
  2. MCAPI-560

Recipes use interface rather than item stacks



    • Type: New Feature
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Labels:


      Proposed Addition:
      Crafting recipes should use an interface for input items, rather than item stacks.

      Specific Features:
      Instead of comparing workbench contents against other item stacks with a single wildcard value, the input items should be checked with an interface method. The item stack class would implement this interface, but it would also be possible for mods/plugins to provide their own implementations, when more advanced matching is desired.

      For example, rather than having a wildcard damage value, the input stack could be wrapped in a WildcardDamageInput() instance. Or, possibly a DamageRangeInput() instance, if you only want diamond swords with less than 20 uses remaining to match the recipe.

      This would also replace Forge's ore dictionary shaped and shapeless recipe implementations with a single ore dictionary input stack implementation, which could be used in furnaces as well, and any compatible mod machine recipe.

      Justification and Use Case:
      This would allow a single unified crafting input, which is far more flexible than comparing against an item stack, as well as separating the concept of a recipe input matcher from the concept of a physical item which the player can interact with.

      Being an interface, rather than a class, it can clearly be included in the API and excluded from obfuscation.

      It would allow for very advanced comparisons, such as "Enchanted with Smite III", "any pickaxe", "has a furnace fuel value of at least one full smelt", "either cobblestone or mossy cobblestone", "blue", "metal ingot", or "ore" to be used in any existing or new crafting recipe, as well as furnace recipes.

      It would even permit silly things like "gold block if <weather site> reports that it is currently sunny at the Mojang offices, obsidian if it is night, grey wool if it is overcast, or water bucket if it is raining".

      Challenges Faced:
      Existing code may have to be changed, though only in mods which interact with recipes beyond checking if they match an input (such as displaying recipes, or removing recipes that contain a specific item), and in how Minecraft compares furnace and workbench input to find a matching recipe.




            • Assignee:
              uristqwerty Uristqwerty
            • Votes:
              1 Vote for this issue
              1 Start watching this issue


              • Created: