Interface RecipeComponentWithParent<T>
- Type Parameters:
T- The value type of this component
- All Superinterfaces:
RecipeComponent<T>
- All Known Implementing Classes:
RecipeComponentWithCodec
A recipe component that may delegate most of its logic to a parent component.
A common example of using this would be to define a custom item output component
with different serialization or matching logic, but that can still use the same
base ItemOutput type as its parent.
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleandefault voidbuildUniqueId(UniqueIdBuilder builder, T value) default com.mojang.serialization.Codec<T> codec()default @Nullable RecipeComponentBuilderdefault booleanhasPriority(RecipeMatchContext cx, Object from) Declares whether this component should take priority when being considered by e.g.default booleanShallow empty check functiondefault booleanmatches(RecipeMatchContext cx, T value, ReplacementMatchInfo match) default Treplace(RecipeScriptContext cx, T original, ReplacementMatchInfo match, Object with) default List<?> default dev.latvian.mods.rhino.type.TypeInfotypeInfo()Defines a description for how this component may be constructed.default voidvalidate(RecipeValidationContext ctx, T value) default Twrap(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 interface dev.latvian.mods.kubejs.recipe.component.RecipeComponent
asConditionalList, asConditionalListOrSelf, asList, asListOrSelf, asMap, asPatternKey, inputKey, isIgnored, key, or, orSelf, otherKey, outputKey, readFromJson, toString, type, withCodec, writeToJson
-
Method Details
-
parentComponent
RecipeComponent<T> parentComponent() -
codec
- Specified by:
codecin interfaceRecipeComponent<T>
-
typeInfo
default 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<T>- Returns:
- A description of how this component may be constructed
-
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<T>- Parameters:
cx- Script contextfrom- An object to be converted to a value for this component- Returns:
- The value read from the input
-
hasPriority
Description copied from interface:RecipeComponentDeclares whether this component should take priority when being considered by e.g. anEitherRecipeComponentduring deserialization.- Specified by:
hasPriorityin interfaceRecipeComponent<T>- Parameters:
cx- Script contextfrom- The object to be deserialized from- Returns:
- Whether this component should take priority
-
matches
- Specified by:
matchesin interfaceRecipeComponent<T>- 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
- Specified by:
replacein interfaceRecipeComponent<T>
-
allowEmpty
default boolean allowEmpty()- Specified by:
allowEmptyin interfaceRecipeComponent<T>
-
validate
- Specified by:
validatein interfaceRecipeComponent<T>
-
isEmpty
Description copied from interface:RecipeComponentShallow empty check function- Specified by:
isEmptyin interfaceRecipeComponent<T>
-
buildUniqueId
- Specified by:
buildUniqueIdin interfaceRecipeComponent<T>
-
createBuilder
- Specified by:
createBuilderin interfaceRecipeComponent<T>
-
spread
- Specified by:
spreadin interfaceRecipeComponent<T>
-