Record Class EitherRecipeComponent<H,L>
java.lang.Object
java.lang.Record
dev.latvian.mods.kubejs.recipe.component.EitherRecipeComponent<H,L>
- All Implemented Interfaces:
RecipeComponent<com.mojang.datafixers.util.Either<H,L>>
public record EitherRecipeComponent<H,L> (RecipeComponent<H> left, RecipeComponent<L> right, com.mojang.serialization.Codec<com.mojang.datafixers.util.Either<H,L>> codec, dev.latvian.mods.rhino.type.TypeInfo typeInfo)
extends Record
implements RecipeComponent<com.mojang.datafixers.util.Either<H,L>>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEitherRecipeComponent(RecipeComponent<H> left, RecipeComponent<L> right) EitherRecipeComponent(RecipeComponent<H> left, RecipeComponent<L> right, com.mojang.serialization.Codec<com.mojang.datafixers.util.Either<H, L>> codec, dev.latvian.mods.rhino.type.TypeInfo typeInfo) Creates an instance of aEitherRecipeComponentrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidbuildUniqueId(UniqueIdBuilder builder, com.mojang.datafixers.util.Either<H, L> value) codec()Returns the value of thecodecrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.left()Returns the value of theleftrecord component.booleanmatches(RecipeMatchContext cx, com.mojang.datafixers.util.Either<H, L> value, ReplacementMatchInfo match) replace(RecipeScriptContext cx, com.mojang.datafixers.util.Either<H, L> original, ReplacementMatchInfo match, Object with) right()Returns the value of therightrecord component.List<?> toString()Returns a string representation of this record class.toString(OpsContainer ops, com.mojang.datafixers.util.Either<H, L> value) type()dev.latvian.mods.rhino.type.TypeInfotypeInfo()Returns the value of thetypeInforecord component.voidvalidate(RecipeValidationContext ctx, com.mojang.datafixers.util.Either<H, L> 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
allowEmpty, asConditionalList, asConditionalListOrSelf, asList, asListOrSelf, asMap, asPatternKey, createBuilder, hasPriority, inputKey, isEmpty, isIgnored, key, or, orSelf, otherKey, outputKey, readFromJson, withCodec, writeToJson
-
Field Details
-
TYPE
-
-
Constructor Details
-
EitherRecipeComponent
-
EitherRecipeComponent
public EitherRecipeComponent(RecipeComponent<H> left, RecipeComponent<L> right, com.mojang.serialization.Codec<com.mojang.datafixers.util.Either<H, L>> codec, dev.latvian.mods.rhino.type.TypeInfo typeInfo) Creates an instance of aEitherRecipeComponentrecord class.- Parameters:
left- the value for theleftrecord componentright- the value for therightrecord componentcodec- the value for thecodecrecord componenttypeInfo- the value for thetypeInforecord component
-
-
Method Details
-
type
- Specified by:
typein interfaceRecipeComponent<H>
-
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<H>- Parameters:
cx- Script contextfrom- An object to be converted to a value for this component- Returns:
- The value read from the input
-
matches
public boolean matches(RecipeMatchContext cx, com.mojang.datafixers.util.Either<H, L> value, ReplacementMatchInfo match) - Specified by:
matchesin interfaceRecipeComponent<H>- 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 com.mojang.datafixers.util.Either<H,L> replace(RecipeScriptContext cx, com.mojang.datafixers.util.Either<H, L> original, ReplacementMatchInfo match, Object with) - Specified by:
replacein interfaceRecipeComponent<H>
-
buildUniqueId
- Specified by:
buildUniqueIdin interfaceRecipeComponent<H>
-
validate
- Specified by:
validatein interfaceRecipeComponent<H>
-
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<H>
-
spread
- Specified by:
spreadin interfaceRecipeComponent<H>
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
left
Returns the value of theleftrecord component.- Returns:
- the value of the
leftrecord component
-
right
Returns the value of therightrecord component.- Returns:
- the value of the
rightrecord component
-
codec
Returns the value of thecodecrecord component.- Specified by:
codecin interfaceRecipeComponent<H>- 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<H>- Returns:
- the value of the
typeInforecord component
-