Class CalculatedRecipe

java.lang.Object
studio.magemonkey.fusion.data.recipes.CalculatedRecipe

public class CalculatedRecipe extends Object
A “calculated” recipe icon + canCraft flag. We build lore lines (ingredients, money, xp, etc.) once per relevant change, and store the final Icon + canCraft in a single object.
  • Constructor Details

    • CalculatedRecipe

      public CalculatedRecipe(Recipe recipe, org.bukkit.inventory.ItemStack icon, boolean canCraft)
  • Method Details

    • create

      public static CalculatedRecipe create(Recipe recipe, Map<IngredientFingerprint,Integer> invCounts, org.bukkit.entity.Player player, CraftingTable craftingTable) throws InvalidPatternItemException
      Builds a CalculatedRecipe for the given Recipe and a snapshot of the player’s inventory counts.
      Parameters:
      recipe - The Recipe to evaluate
      invCounts - a Map<IngredientFingerprint, Integer> representing the count of each ingredient in the player’s inventory
      player - The player who is crafting
      craftingTable - The CraftingTable (for level checks)
      Returns:
      a new CalculatedRecipe containing: - recipe (underlying Recipe) - icon (cloned ItemStack with assembled lore) - canCraft (true if player meets all requirements)
      Throws:
      InvalidPatternItemException - if building fails
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • isSimilar

      public static boolean isSimilar(org.bukkit.inventory.ItemStack is1, org.bukkit.inventory.ItemStack is2)
      Unchanged “isSimilar” from before—compares two ItemStacks in a relaxed manner.