Record Class RegistryComponent<T>
java.lang.Object
java.lang.Record
dev.latvian.mods.kubejs.recipe.component.RegistryComponent<T>
- All Implemented Interfaces:
RecipeComponent<net.minecraft.core.Holder<T>>
public record RegistryComponent<T>(net.minecraft.core.Registry<T> registry, @Nullable RegistryType<T> regType, com.mojang.serialization.Codec<net.minecraft.core.Holder<T>> codec, dev.latvian.mods.rhino.type.TypeInfo typeInfo)
extends Record
implements RecipeComponent<net.minecraft.core.Holder<T>>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRegistryComponent(RegistryAccessContainer registries, @Nullable RegistryType<T> regType, net.minecraft.resources.ResourceKey key) RegistryComponent(RegistryAccessContainer registries, net.minecraft.resources.ResourceKey key) RegistryComponent(net.minecraft.core.Registry<T> registry, @Nullable RegistryType<T> regType, com.mojang.serialization.Codec<net.minecraft.core.Holder<T>> codec, dev.latvian.mods.rhino.type.TypeInfo typeInfo) Creates an instance of aRegistryComponentrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidbuildUniqueId(UniqueIdBuilder builder, net.minecraft.core.Holder<T> value) com.mojang.serialization.Codec<net.minecraft.core.Holder<T>> 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.booleanhasPriority(RecipeMatchContext cx, Object from) Declares whether this component should take priority when being considered by e.g.net.minecraft.core.Registry<T> registry()Returns the value of theregistryrecord component.@Nullable RegistryType<T> regType()Returns the value of theregTyperecord component.toString()Returns a string representation of this record class.type()dev.latvian.mods.rhino.type.TypeInfotypeInfo()Returns the value of thetypeInforecord component.net.minecraft.core.Holder<T> 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, inputKey, isEmpty, isIgnored, key, matches, or, orSelf, otherKey, outputKey, readFromJson, replace, spread, toString, validate, withCodec, writeToJson
-
Field Details
-
TYPE
-
-
Constructor Details
-
RegistryComponent
public RegistryComponent(RegistryAccessContainer registries, @Nullable @Nullable RegistryType<T> regType, net.minecraft.resources.ResourceKey key) -
RegistryComponent
public RegistryComponent(RegistryAccessContainer registries, net.minecraft.resources.ResourceKey key) -
RegistryComponent
public RegistryComponent(net.minecraft.core.Registry<T> registry, @Nullable @Nullable RegistryType<T> regType, com.mojang.serialization.Codec<net.minecraft.core.Holder<T>> codec, dev.latvian.mods.rhino.type.TypeInfo typeInfo) Creates an instance of aRegistryComponentrecord class.- Parameters:
registry- the value for theregistryrecord componentregType- the value for theregTyperecord componentcodec- the value for thecodecrecord componenttypeInfo- the value for thetypeInforecord component
-
-
Method Details
-
type
- Specified by:
typein interfaceRecipeComponent<T>
-
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
-
buildUniqueId
- Specified by:
buildUniqueIdin interfaceRecipeComponent<T>
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
registry
Returns the value of theregistryrecord component.- Returns:
- the value of the
registryrecord component
-
regType
Returns the value of theregTyperecord component.- Returns:
- the value of the
regTyperecord component
-
codec
Returns the value of thecodecrecord component.- Specified by:
codecin interfaceRecipeComponent<T>- 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<T>- Returns:
- the value of the
typeInforecord component
-