Record Class MapRecipeComponent<K,V>
java.lang.Object
java.lang.Record
dev.latvian.mods.kubejs.recipe.component.MapRecipeComponent<K,V>
- All Implemented Interfaces:
RecipeComponent<TinyMap<K,V>>
public record MapRecipeComponent<K,V> (RecipeComponent<K> key, RecipeComponent<V> component, boolean patternKey, IntBounds bounds, com.mojang.serialization.Codec<TinyMap<K,V>> codec, dev.latvian.mods.rhino.type.TypeInfo typeInfo)
extends Record
implements RecipeComponent<TinyMap<K,V>>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RecipeComponentType<?> static final RecipeComponentType<?> -
Constructor Summary
ConstructorsConstructorDescriptionMapRecipeComponent(RecipeComponent<K> key, RecipeComponent<V> component, boolean patternKey, IntBounds bounds, com.mojang.serialization.Codec<TinyMap<K, V>> codec, dev.latvian.mods.rhino.type.TypeInfo typeInfo) Creates an instance of aMapRecipeComponentrecord class.MapRecipeComponent(RecipeComponent<K> key, RecipeComponent<V> component, IntBounds bounds, boolean patternKey) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbounds()Returns the value of theboundsrecord component.voidbuildUniqueId(UniqueIdBuilder builder, TinyMap<K, V> value) codec()Returns the value of thecodecrecord component.Returns the value of thecomponentrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanShallow empty check functionkey()Returns the value of thekeyrecord component.booleanmatches(RecipeMatchContext cx, TinyMap<K, V> value, ReplacementMatchInfo match) static <K,V> MapRecipeComponent <K, V> of(RecipeComponent<K> key, RecipeComponent<V> component, IntBounds bounds) booleanReturns the value of thepatternKeyrecord component.static <V> MapRecipeComponent<Character, V> patternOf(RecipeComponent<V> component, IntBounds bounds) replace(RecipeScriptContext cx, TinyMap<K, V> original, ReplacementMatchInfo match, Object with) toString()Returns a string representation of this record class.type()dev.latvian.mods.rhino.type.TypeInfotypeInfo()Returns the value of thetypeInforecord component.voidvalidate(RecipeValidationContext ctx, TinyMap<K, V> value) wrap(RecipeScriptContext cx, Object from) Method to read the value contained within this component from an input object; this may be some arbitrary value passed into aschema'sconstructor(s) or automatically generated builder methods.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, hasPriority, inputKey, isIgnored, key, or, orSelf, otherKey, outputKey, readFromJson, spread, toString, withCodec, writeToJson
-
Field Details
-
TYPE
-
PATTERN_TYPE
-
-
Constructor Details
-
MapRecipeComponent
public MapRecipeComponent(RecipeComponent<K> key, RecipeComponent<V> component, IntBounds bounds, boolean patternKey) -
MapRecipeComponent
public MapRecipeComponent(RecipeComponent<K> key, RecipeComponent<V> component, boolean patternKey, IntBounds bounds, com.mojang.serialization.Codec<TinyMap<K, V>> codec, dev.latvian.mods.rhino.type.TypeInfo typeInfo) Creates an instance of aMapRecipeComponentrecord class.- Parameters:
key- the value for thekeyrecord componentcomponent- the value for thecomponentrecord componentpatternKey- the value for thepatternKeyrecord componentbounds- the value for theboundsrecord componentcodec- the value for thecodecrecord componenttypeInfo- the value for thetypeInforecord component
-
-
Method Details
-
of
public static <K,V> MapRecipeComponent<K,V> of(RecipeComponent<K> key, RecipeComponent<V> component, IntBounds bounds) -
patternOf
public static <V> MapRecipeComponent<Character,V> patternOf(RecipeComponent<V> component, IntBounds bounds) -
type
- Specified by:
typein interfaceRecipeComponent<K>
-
wrap
Description copied from interface:RecipeComponentMethod to read the value contained within this component from an input object; this may be some arbitrary value passed into aschema'sconstructor(s) or automatically generated builder methods. By default, it will attempt to type wrap based onRecipeComponent.typeInfo()- Specified by:
wrapin interfaceRecipeComponent<K>- Parameters:
cx- Script contextfrom- An object to be converted to a value for this component- Returns:
- The value read from the input
-
validate
- Specified by:
validatein interfaceRecipeComponent<K>
-
allowEmpty
public boolean allowEmpty()- Specified by:
allowEmptyin interfaceRecipeComponent<K>
-
isEmpty
Description copied from interface:RecipeComponentShallow empty check function- Specified by:
isEmptyin interfaceRecipeComponent<K>
-
matches
- Specified by:
matchesin interfaceRecipeComponent<K>- 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.
-
replace
public TinyMap<K,V> replace(RecipeScriptContext cx, TinyMap<K, V> original, ReplacementMatchInfo match, Object with) - Specified by:
replacein interfaceRecipeComponent<K>
-
buildUniqueId
- Specified by:
buildUniqueIdin interfaceRecipeComponent<K>
-
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. -
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 '=='. -
key
Returns the value of thekeyrecord component.- Returns:
- the value of the
keyrecord component
-
component
Returns the value of thecomponentrecord component.- Returns:
- the value of the
componentrecord component
-
patternKey
public boolean patternKey()Returns the value of thepatternKeyrecord component.- Returns:
- the value of the
patternKeyrecord component
-
bounds
Returns the value of theboundsrecord component.- Returns:
- the value of the
boundsrecord component
-
codec
Returns the value of thecodecrecord component.- Specified by:
codecin interfaceRecipeComponent<K>- Returns:
- the value of the
codecrecord component
-
typeInfo
public dev.latvian.mods.rhino.type.TypeInfo typeInfo()Returns the value of thetypeInforecord component.- Specified by:
typeInfoin interfaceRecipeComponent<K>- Returns:
- the value of the
typeInforecord component
-