Solved ShapedRecipe Ingredient Map

Discussion in 'Spigot Plugin Development' started by worthless_hobo, Jun 22, 2016.

  1. So I'm working on a plugin for someone, part of the plugin allows them to configure recipes for new items in a config file. The plan is to allow the use of Lore and Names in the recipe. Currently I just listen to the PrepareItemCraftEvent however when I was looking through the JavaDocs I noticed that the ingredient map is actually saved as a Map<Character, ItemStack>.

    What I'm wondering is if it would be possible to manually put an ItemStack into the map instead of using the setIngredient() method that just uses Materials.
     
  2. Nope, both the CraftBukkit classes convert them to id/data, and the NMS classes (ShapelessRecipes and ShapedRecipes) only check id, data and amount. But if you inject your own ShapedRecipes/ShapelessRecipes extensions you could let it check for NBT (which contains your metadata)

    As for furnace recipes, they might already be supported by NMS (but this needs confirmation), but CraftBukkit has no support for it. (See RecipesFurnace#a(ItemStack, ItemStack, float))

    It would be interesting to see a PR for this :)
     
    • Informative Informative x 1
  3. Alright thanks.