Record Class FoodFacts

java.lang.Object
java.lang.Record
ke.ric.api.food.FoodFacts
Record Components:
itemId - normalized uppercase item identifier
ingredientIds - uppercase ingredient identifiers
categories - uppercase inferred dietary categories
tags - uppercase custom item tags
dietaryFacts - map of dietary flags to FoodFacts.Truth
complete - true when lineage classification is complete

public record FoodFacts(String itemId, Set<String> ingredientIds, Set<String> categories, Set<String> tags, Map<String, FoodFacts.Truth> dietaryFacts, boolean complete) extends Record
Legacy V1 immutable description of what is known about one food stack. Prefer FoodFactsV2 and HeirloomAPI.foodFactsV2(org.bukkit.inventory.ItemStack) for new integrations.
  • Constructor Details

    • FoodFacts

      public FoodFacts(String itemId, Set<String> ingredientIds, Set<String> categories, Set<String> tags, Map<String, FoodFacts.Truth> dietaryFacts, boolean complete)
      Creates an instance of a FoodFacts record class.
      Parameters:
      itemId - the value for the itemId record component
      ingredientIds - the value for the ingredientIds record component
      categories - the value for the categories record component
      tags - the value for the tags record component
      dietaryFacts - the value for the dietaryFacts record component
      complete - the value for the complete record component
  • Method Details

    • single

      public static FoodFacts single(String itemId, Set<String> tags)
      A directly identified, pure ingredient. Call only when its source is known.
    • vanilla

      public static FoodFacts vanilla(org.bukkit.Material material)
      Known fixed vanilla recipes expose their real inputs; other mixed foods remain unknown.
    • unknown

      public static FoodFacts unknown(String itemId, Set<String> knownIngredients, Set<String> tags)
      Legacy or external item: positive clues remain usable; absence is unproved.
    • produced

      public static FoodFacts produced(String itemId, Set<String> tags, Collection<FoodFacts> inputs)
      Merge every consumed ingredient, including nested provenance and the result's own metadata.
    • produced

      public static FoodFacts produced(FoodFacts result, Collection<FoodFacts> inputs)
    • read

      public static FoodFacts read(org.bukkit.inventory.ItemStack item)
      Read current facts or conservatively interpret older Heirloom metadata.
    • write

      public static void write(org.bukkit.inventory.ItemStack item, FoodFacts facts)
      Persist normalized facts on the actual output without touching amount or other metadata.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • itemId

      public String itemId()
      Returns the value of the itemId record component.
      Returns:
      the value of the itemId record component
    • ingredientIds

      public Set<String> ingredientIds()
      Returns the value of the ingredientIds record component.
      Returns:
      the value of the ingredientIds record component
    • categories

      public Set<String> categories()
      Returns the value of the categories record component.
      Returns:
      the value of the categories record component
    • tags

      public Set<String> tags()
      Returns the value of the tags record component.
      Returns:
      the value of the tags record component
    • dietaryFacts

      public Map<String, FoodFacts.Truth> dietaryFacts()
      Returns the value of the dietaryFacts record component.
      Returns:
      the value of the dietaryFacts record component
    • complete

      public boolean complete()
      Returns the value of the complete record component.
      Returns:
      the value of the complete record component