Record Class FoodFactsV2
java.lang.Object
java.lang.Record
ke.ric.api.food.FoodFactsV2
- Record Components:
itemId- source-qualified identity of this food, ornullfor empty/air itemsingredientIds- immutable set of observed source-qualified ingredient IDscategories- immutable set of uppercase dietary categories (e.g.,PLANT,MEAT,DAIRY,ALCOHOL)- immutable set of normalized uppercase custom tagsdietaryFacts- immutable map of dietary flags (e.g.,VEGAN,VEGETARIAN,PORK_FREE,ALCOHOL_FREE) toFoodFactsV2.Truthcomplete-trueif every contributing ingredient lineage is knowncategoriesComplete-trueif every known ingredient's category classification is complete
public record FoodFactsV2(String itemId, Set<String> ingredientIds, Set<String> categories, Set<String> tags, Map<String, FoodFactsV2.Truth> dietaryFacts, boolean complete, boolean categoriesComplete)
extends Record
Immutable, source-qualified evidence about one food. Ingredient completeness and
category completeness are separate: neither is a certification of the food.
Reads are observational and never reconstruct historical custom recipes.
Identities use source-qualified keys (heirloom:<id>, minecraft:<material>,
or <provider>:<item>). Check complete() and categoriesComplete()
before treating FoodFactsV2.Truth.UNKNOWN or FoodFactsV2.Truth.TRUE as conclusive.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecategoriesrecord component.booleanReturns the value of thecategoriesCompleterecord component.booleancomplete()Returns the value of thecompleterecord component.Returns the value of thedietaryFactsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theingredientIdsrecord component.itemId()Returns the value of theitemIdrecord component.static FoodFactsV2produced(FoodFactsV2 result, Collection<FoodFactsV2> inputs) Combine actual consumed inputs with explicitly supplied result evidence.static FoodFactsV2read(org.bukkit.inventory.ItemStack item) Read current V2 evidence or a conservative view of legacy metadata.tags()Returns the value of thetagsrecord component.final StringtoString()Returns a string representation of this record class.static voidwrite(org.bukkit.inventory.ItemStack item, FoodFactsV2 facts) Write only the V2 key.static voidwriteProduced(org.bukkit.inventory.ItemStack output, List<org.bukkit.inventory.ItemStack> actualInputs, String explicitQualifiedOutputId) Record a production boundary from its actual stacks.
-
Constructor Details
-
FoodFactsV2
public FoodFactsV2(String itemId, Set<String> ingredientIds, Set<String> categories, Set<String> tags, Map<String, FoodFactsV2.Truth> dietaryFacts, boolean complete, boolean categoriesComplete) Creates an instance of aFoodFactsV2record class.- Parameters:
itemId- the value for theitemIdrecord componentingredientIds- the value for theingredientIdsrecord componentcategories- the value for thecategoriesrecord componenttags- the value for thetagsrecord componentdietaryFacts- the value for thedietaryFactsrecord componentcomplete- the value for thecompleterecord componentcategoriesComplete- the value for thecategoriesCompleterecord component
-
-
Method Details
-
read
Read current V2 evidence or a conservative view of legacy metadata. Does not write. -
write
Write only the V2 key. Positive alcohol metadata on the actual stack always wins. -
produced
Combine actual consumed inputs with explicitly supplied result evidence. The caller must not pass a synthetic vanilla output recipe as result evidence. Every input is consumed, even when its identity matches the output. Use read/write directly for identity-preserving copies instead of this merger. -
writeProduced
public static void writeProduced(org.bukkit.inventory.ItemStack output, List<org.bukkit.inventory.ItemStack> actualInputs, String explicitQualifiedOutputId) Record a production boundary from its actual stacks. A qualified declaration supplies an output identity only when the stack has no actual custom owner. Read inputs before mutating the output so an in-place operation is supported. -
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
itemId
-
ingredientIds
Returns the value of theingredientIdsrecord component.- Returns:
- the value of the
ingredientIdsrecord component
-
categories
Returns the value of thecategoriesrecord component.- Returns:
- the value of the
categoriesrecord component
-
tags
-
dietaryFacts
Returns the value of thedietaryFactsrecord component.- Returns:
- the value of the
dietaryFactsrecord component
-
complete
-
categoriesComplete
public boolean categoriesComplete()Returns the value of thecategoriesCompleterecord component.- Returns:
- the value of the
categoriesCompleterecord component
-