Record Class ItemStackComponent
java.lang.Object
java.lang.Record
dev.latvian.mods.kubejs.recipe.component.ItemStackComponent
- All Implemented Interfaces:
RecipeComponent<net.minecraft.world.item.ItemStack>
public record ItemStackComponent(RecipeComponentType<?> type, com.mojang.serialization.Codec<net.minecraft.world.item.ItemStack> codec, boolean allowEmpty, net.minecraft.world.item.crafting.Ingredient filter)
extends Record
implements RecipeComponent<net.minecraft.world.item.ItemStack>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RecipeComponentType<?> static final RecipeComponentType<net.minecraft.world.item.ItemStack> static final RecipeComponentType<net.minecraft.world.item.ItemStack> -
Constructor Summary
ConstructorsConstructorDescriptionItemStackComponent(RecipeComponentType<?> type, boolean allowEmpty, net.minecraft.world.item.crafting.Ingredient filter) ItemStackComponent(RecipeComponentType<?> type, com.mojang.serialization.Codec<net.minecraft.world.item.ItemStack> codec, boolean allowEmpty, net.minecraft.world.item.crafting.Ingredient filter) Creates an instance of aItemStackComponentrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of theallowEmptyrecord component.voidbuildUniqueId(UniqueIdBuilder builder, net.minecraft.world.item.ItemStack value) com.mojang.serialization.Codec<net.minecraft.world.item.ItemStack> codec()Returns the value of thecodecrecord component.final booleanIndicates whether some other object is "equal to" this one.net.minecraft.world.item.crafting.Ingredientfilter()Returns the value of thefilterrecord component.final inthashCode()Returns a hash code value for this object.booleanhasPriority(RecipeMatchContext cx, Object from) Declares whether this component should take priority when being considered by e.g.booleanisEmpty(net.minecraft.world.item.ItemStack value) Shallow empty check functionbooleanmatches(RecipeMatchContext cx, net.minecraft.world.item.ItemStack value, ReplacementMatchInfo match) List<net.minecraft.world.item.ItemStack> spread(net.minecraft.world.item.ItemStack value) toString()Returns a string representation of this record class.toString(OpsContainer ops, net.minecraft.world.item.ItemStack value) type()Returns the value of thetyperecord component.dev.latvian.mods.rhino.type.TypeInfotypeInfo()Defines a description for how this component may be constructed.voidvalidate(RecipeValidationContext ctx, net.minecraft.world.item.ItemStack value) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.latvian.mods.kubejs.recipe.component.RecipeComponent
asConditionalList, asConditionalListOrSelf, asList, asListOrSelf, asMap, asPatternKey, createBuilder, inputKey, isIgnored, key, or, orSelf, otherKey, outputKey, readFromJson, replace, withCodec, wrap, writeToJson
-
Field Details
-
ITEM_STACK
-
OPTIONAL_ITEM_STACK
-
FILTERED_ITEM_STACK
-
-
Constructor Details
-
ItemStackComponent
public ItemStackComponent(RecipeComponentType<?> type, boolean allowEmpty, net.minecraft.world.item.crafting.Ingredient filter) -
ItemStackComponent
public ItemStackComponent(RecipeComponentType<?> type, com.mojang.serialization.Codec<net.minecraft.world.item.ItemStack> codec, boolean allowEmpty, net.minecraft.world.item.crafting.Ingredient filter) Creates an instance of aItemStackComponentrecord class.- Parameters:
type- the value for thetyperecord componentcodec- the value for thecodecrecord componentallowEmpty- the value for theallowEmptyrecord componentfilter- the value for thefilterrecord component
-
-
Method Details
-
typeInfo
public dev.latvian.mods.rhino.type.TypeInfo typeInfo()Description copied from interface:RecipeComponentDefines a description for how this component may be constructed. Type descriptions may be comprised of a primitive type such as a string, number or Java class (which may be useful if that that class has an appropriate type wrapper for it already), an array of fixed or dynamic length, a map / object, or a union of multiple types.Type descriptions are used by addons like ProbeJS to provide typing hints.
- Specified by:
typeInfoin interfaceRecipeComponent<net.minecraft.world.item.ItemStack>- Returns:
- A description of how this component may be constructed
-
hasPriority
Description copied from interface:RecipeComponentDeclares whether this component should take priority when being considered by e.g. anEitherRecipeComponentduring deserialization.- Specified by:
hasPriorityin interfaceRecipeComponent<net.minecraft.world.item.ItemStack>- Parameters:
cx- Script contextfrom- The object to be deserialized from- Returns:
- Whether this component should take priority
-
matches
public boolean matches(RecipeMatchContext cx, net.minecraft.world.item.ItemStack value, ReplacementMatchInfo match) - Specified by:
matchesin interfaceRecipeComponent<net.minecraft.world.item.ItemStack>- Parameters:
cx- Script contextvalue- The value to checkmatch- The replacement match to check against- Returns:
- true if the given value matches the given replacement match.
-
isEmpty
public boolean isEmpty(net.minecraft.world.item.ItemStack value) Description copied from interface:RecipeComponentShallow empty check function- Specified by:
isEmptyin interfaceRecipeComponent<net.minecraft.world.item.ItemStack>
-
buildUniqueId
- Specified by:
buildUniqueIdin interfaceRecipeComponent<net.minecraft.world.item.ItemStack>
-
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. -
toString
- Specified by:
toStringin interfaceRecipeComponent<net.minecraft.world.item.ItemStack>
-
validate
- Specified by:
validatein interfaceRecipeComponent<net.minecraft.world.item.ItemStack>
-
spread
- Specified by:
spreadin interfaceRecipeComponent<net.minecraft.world.item.ItemStack>
-
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. -
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 '=='. -
type
Returns the value of thetyperecord component.- Specified by:
typein interfaceRecipeComponent<net.minecraft.world.item.ItemStack>- Returns:
- the value of the
typerecord component
-
codec
public com.mojang.serialization.Codec<net.minecraft.world.item.ItemStack> codec()Returns the value of thecodecrecord component.- Specified by:
codecin interfaceRecipeComponent<net.minecraft.world.item.ItemStack>- Returns:
- the value of the
codecrecord component
-
allowEmpty
public boolean allowEmpty()Returns the value of theallowEmptyrecord component.- Specified by:
allowEmptyin interfaceRecipeComponent<net.minecraft.world.item.ItemStack>- Returns:
- the value of the
allowEmptyrecord component
-
filter
public net.minecraft.world.item.crafting.Ingredient filter()Returns the value of thefilterrecord component.- Returns:
- the value of the
filterrecord component
-