Class CalculatedRecipe
java.lang.Object
studio.magemonkey.fusion.data.recipes.CalculatedRecipe
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 Summary
ConstructorsConstructorDescriptionCalculatedRecipe(Recipe recipe, org.bukkit.inventory.ItemStack icon, boolean canCraft) -
Method Summary
Modifier and TypeMethodDescriptionstatic CalculatedRecipecreate(Recipe recipe, Map<IngredientFingerprint, Integer> invCounts, org.bukkit.entity.Player player, CraftingTable craftingTable) Builds a CalculatedRecipe for the given Recipe and a snapshot of the player’s inventory counts.booleaninthashCode()static booleanisSimilar(org.bukkit.inventory.ItemStack is1, org.bukkit.inventory.ItemStack is2) Unchanged “isSimilar” from before—compares two ItemStacks in a relaxed manner.
-
Constructor Details
-
CalculatedRecipe
-
-
Method Details
-
create
public static CalculatedRecipe create(Recipe recipe, Map<IngredientFingerprint, Integer> invCounts, org.bukkit.entity.Player player, CraftingTable craftingTable) throws InvalidPatternItemExceptionBuilds a CalculatedRecipe for the given Recipe and a snapshot of the player’s inventory counts.- Parameters:
recipe- The Recipe to evaluateinvCounts- aMap<IngredientFingerprint,Integer> representing the count of each ingredient in the player’s inventoryplayer- The player who is craftingcraftingTable- 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
-
hashCode
public int hashCode() -
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.
-