Record Class ResourceKeyComponent<T>
java.lang.Object
java.lang.Record
dev.latvian.mods.kubejs.recipe.component.ResourceKeyComponent<T>
- All Implemented Interfaces:
RecipeComponent<net.minecraft.resources.ResourceKey<T>>
public record ResourceKeyComponent<T>(@Nullable RecipeComponentType<?> typeOverride, net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> registryKey, com.mojang.serialization.Codec<net.minecraft.resources.ResourceKey<T>> codec, dev.latvian.mods.rhino.type.TypeInfo typeInfo)
extends Record
implements RecipeComponent<net.minecraft.resources.ResourceKey<T>>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RecipeComponentType<net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level>> static final RecipeComponentType<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>> static final RecipeComponentType<?> -
Constructor Summary
ConstructorsConstructorDescriptionResourceKeyComponent(@Nullable RecipeComponentType<?> typeOverride, net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> registryKey, com.mojang.serialization.Codec<net.minecraft.resources.ResourceKey<T>> codec, dev.latvian.mods.rhino.type.TypeInfo typeInfo) Creates an instance of aResourceKeyComponentrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.Codec<net.minecraft.resources.ResourceKey<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.net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> Returns the value of theregistryKeyrecord component.toString()Returns a string representation of this record class.toString(OpsContainer ops, net.minecraft.resources.ResourceKey<T> value) type()dev.latvian.mods.rhino.type.TypeInfotypeInfo()Returns the value of thetypeInforecord component.@Nullable RecipeComponentType<?> Returns the value of thetypeOverriderecord component.net.minecraft.resources.ResourceKey<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, buildUniqueId, createBuilder, hasPriority, inputKey, isEmpty, isIgnored, key, matches, or, orSelf, otherKey, outputKey, readFromJson, replace, spread, validate, withCodec, writeToJson
-
Field Details
-
DIMENSION
public static final RecipeComponentType<net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level>> DIMENSION -
LOOT_TABLE
public static final RecipeComponentType<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>> LOOT_TABLE -
TYPE
-
-
Constructor Details
-
ResourceKeyComponent
public ResourceKeyComponent(@Nullable @Nullable RecipeComponentType<?> typeOverride, net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> registryKey, com.mojang.serialization.Codec<net.minecraft.resources.ResourceKey<T>> codec, dev.latvian.mods.rhino.type.TypeInfo typeInfo) Creates an instance of aResourceKeyComponentrecord class.- Parameters:
typeOverride- the value for thetypeOverriderecord componentregistryKey- the value for theregistryKeyrecord 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
-
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<T>
-
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). -
typeOverride
Returns the value of thetypeOverriderecord component.- Returns:
- the value of the
typeOverriderecord component
-
registryKey
Returns the value of theregistryKeyrecord component.- Returns:
- the value of the
registryKeyrecord 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
-