Record Class EnumComponent<T extends Enum<T> & net.minecraft.util.StringRepresentable>

java.lang.Object
java.lang.Record
dev.latvian.mods.kubejs.recipe.component.EnumComponent<T>
All Implemented Interfaces:
RecipeComponent<T>

public record EnumComponent<T extends Enum<T> & net.minecraft.util.StringRepresentable>(@Nullable RecipeComponentType<?> typeOverride, dev.latvian.mods.rhino.type.EnumTypeInfo typeInfo, com.mojang.serialization.Codec<T extends Enum<T> & net.minecraft.util.StringRepresentable> codec) extends Record implements RecipeComponent<T>
  • Field Details

  • Constructor Details

    • EnumComponent

      public EnumComponent(@Nullable @Nullable RecipeComponentType<?> typeOverride, dev.latvian.mods.rhino.type.EnumTypeInfo typeInfo, com.mojang.serialization.Codec<T> codec)
      Creates an instance of a EnumComponent record class.
      Parameters:
      typeOverride - the value for the typeOverride record component
      typeInfo - the value for the typeInfo record component
      codec - the value for the codec record component
  • Method Details

    • of

      public static <T extends Enum<T> & net.minecraft.util.StringRepresentable> RecipeComponentType<T> of(net.minecraft.resources.ResourceLocation id, Class<T> enumClass, com.mojang.serialization.Codec<T> codec)
    • of

      public static <T extends Enum<T> & net.minecraft.util.StringRepresentable> RecipeComponentType<T> of(net.minecraft.resources.ResourceLocation id, Class<T> enumClass)
    • type

      public RecipeComponentType<?> type()
      Specified by:
      type in interface RecipeComponent<T extends Enum<T> & net.minecraft.util.StringRepresentable>
    • buildUniqueId

      public void buildUniqueId(UniqueIdBuilder builder, T value)
      Specified by:
      buildUniqueId in interface RecipeComponent<T extends Enum<T> & net.minecraft.util.StringRepresentable>
    • 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
    • toString

      public String toString(OpsContainer ops, T value)
      Specified by:
      toString in interface RecipeComponent<T extends Enum<T> & net.minecraft.util.StringRepresentable>
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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
    • typeInfo

      public dev.latvian.mods.rhino.type.EnumTypeInfo typeInfo()
      Returns the value of the typeInfo record component.
      Specified by:
      typeInfo in interface RecipeComponent<T extends Enum<T> & net.minecraft.util.StringRepresentable>
      Returns:
      the value of the typeInfo record component
    • codec

      public com.mojang.serialization.Codec<T> codec()
      Returns the value of the codec record component.
      Specified by:
      codec in interface RecipeComponent<T extends Enum<T> & net.minecraft.util.StringRepresentable>
      Returns:
      the value of the codec record component