Record Class TagKeyComponent<T>

java.lang.Object
java.lang.Record
dev.latvian.mods.kubejs.recipe.component.TagKeyComponent<T>
All Implemented Interfaces:
RecipeComponent<net.minecraft.tags.TagKey<T>>

public record TagKeyComponent<T>(@Nullable RecipeComponentType<?> typeOverride, net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> registry, dev.latvian.mods.rhino.type.TypeInfo registryType, com.mojang.serialization.Codec<net.minecraft.tags.TagKey<T>> codec, dev.latvian.mods.rhino.type.TypeInfo typeInfo, boolean hashed) extends Record implements RecipeComponent<net.minecraft.tags.TagKey<T>>
  • Field Details

    • TAG_KEY_TYPE

      public static final dev.latvian.mods.rhino.type.TypeInfo TAG_KEY_TYPE
    • BLOCK

      public static final RecipeComponentType<net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block>> BLOCK
    • ITEM

      public static final RecipeComponentType<net.minecraft.tags.TagKey<net.minecraft.world.item.Item>> ITEM
    • ENTITY_TYPE

      public static final RecipeComponentType<net.minecraft.tags.TagKey<net.minecraft.world.entity.EntityType<?>>> ENTITY_TYPE
    • BIOME

      public static final RecipeComponentType<net.minecraft.tags.TagKey<net.minecraft.world.level.biome.Biome>> BIOME
    • FLUID

      public static final RecipeComponentType<net.minecraft.tags.TagKey<net.minecraft.world.level.material.Fluid>> FLUID
    • HASHED_BLOCK

      public static final RecipeComponentType<net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block>> HASHED_BLOCK
    • HASHED_ITEM

      public static final RecipeComponentType<net.minecraft.tags.TagKey<net.minecraft.world.item.Item>> HASHED_ITEM
    • HASHED_ENTITY_TYPE

      public static final RecipeComponentType<net.minecraft.tags.TagKey<net.minecraft.world.entity.EntityType<?>>> HASHED_ENTITY_TYPE
    • HASHED_BIOME

      public static final RecipeComponentType<net.minecraft.tags.TagKey<net.minecraft.world.level.biome.Biome>> HASHED_BIOME
    • HASHED_FLUID

      public static final RecipeComponentType<net.minecraft.tags.TagKey<net.minecraft.world.level.material.Fluid>> HASHED_FLUID
    • TYPE

      public static final RecipeComponentType<?> TYPE
  • Constructor Details

    • TagKeyComponent

      public TagKeyComponent(@Nullable @Nullable RecipeComponentType<?> typeOverride, net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> registry, dev.latvian.mods.rhino.type.TypeInfo registryType, boolean hashed)
    • TagKeyComponent

      public TagKeyComponent(@Nullable @Nullable RecipeComponentType<?> typeOverride, net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> registry, dev.latvian.mods.rhino.type.TypeInfo registryType, com.mojang.serialization.Codec<net.minecraft.tags.TagKey<T>> codec, dev.latvian.mods.rhino.type.TypeInfo typeInfo, boolean hashed)
      Creates an instance of a TagKeyComponent record class.
      Parameters:
      typeOverride - the value for the typeOverride record component
      registry - the value for the registry record component
      registryType - the value for the registryType record component
      codec - the value for the codec record component
      typeInfo - the value for the typeInfo record component
      hashed - the value for the hashed record component
  • Method Details

    • type

      public RecipeComponentType<?> type()
      Specified by:
      type in interface RecipeComponent<T>
    • hasPriority

      public boolean hasPriority(RecipeMatchContext cx, Object from)
      Description copied from interface: RecipeComponent
      Declares whether this component should take priority when being considered by e.g. an EitherRecipeComponent during deserialization.
      Specified by:
      hasPriority in interface RecipeComponent<T>
      Parameters:
      cx - Script context
      from - The object to be deserialized from
      Returns:
      Whether this component should take priority
    • wrap

      public net.minecraft.tags.TagKey<T> wrap(RecipeScriptContext cx, Object from)
      Description copied from interface: RecipeComponent
      Method to read the value contained within this component from an input object; this may be some arbitrary value passed into a schema's constructor(s) or automatically generated builder methods. By default, it will attempt to type wrap based on RecipeComponent.typeInfo()
      Specified by:
      wrap in interface RecipeComponent<T>
      Parameters:
      cx - Script context
      from - An object to be converted to a value for this component
      Returns:
      The value read from the input
    • buildUniqueId

      public void buildUniqueId(UniqueIdBuilder builder, net.minecraft.tags.TagKey<T> value)
      Specified by:
      buildUniqueId in interface RecipeComponent<T>
    • toString

      public String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • typeOverride

      @Nullable public @Nullable RecipeComponentType<?> typeOverride()
      Returns the value of the typeOverride record component.
      Returns:
      the value of the typeOverride record component
    • registry

      public net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> registry()
      Returns the value of the registry record component.
      Returns:
      the value of the registry record component
    • registryType

      public dev.latvian.mods.rhino.type.TypeInfo registryType()
      Returns the value of the registryType record component.
      Returns:
      the value of the registryType record component
    • codec

      public com.mojang.serialization.Codec<net.minecraft.tags.TagKey<T>> codec()
      Returns the value of the codec record component.
      Specified by:
      codec in interface RecipeComponent<T>
      Returns:
      the value of the codec record component
    • typeInfo

      public dev.latvian.mods.rhino.type.TypeInfo typeInfo()
      Returns the value of the typeInfo record component.
      Specified by:
      typeInfo in interface RecipeComponent<T>
      Returns:
      the value of the typeInfo record component
    • hashed

      public boolean hashed()
      Returns the value of the hashed record component.
      Returns:
      the value of the hashed record component