Record Class NumberComponent.LongRange

java.lang.Object
java.lang.Record
dev.latvian.mods.kubejs.recipe.component.NumberComponent.LongRange
All Implemented Interfaces:
NumberComponent<NumberComponent.LongRange,Long>, RecipeComponent<Long>
Enclosing interface:
NumberComponent<S,T extends Number>

public static record NumberComponent.LongRange(@Nullable RecipeComponentType<?> typeOverride, Long min, Long max, com.mojang.serialization.Codec<Long> codec) extends Record implements NumberComponent<NumberComponent.LongRange,Long>
  • Constructor Details

    • LongRange

      public LongRange(@Nullable @Nullable RecipeComponentType<?> typeOverride, Long min, Long max, com.mojang.serialization.Codec<Long> codec)
      Creates an instance of a LongRange record class.
      Parameters:
      typeOverride - the value for the typeOverride record component
      min - the value for the min record component
      max - the value for the max record component
      codec - the value for the codec record component
  • Method Details

    • of

      public static NumberComponent.LongRange of(@Nullable @Nullable RecipeComponentType<?> typeOverride, Long min, Long max)
    • type

      public RecipeComponentType<?> type()
      Specified by:
      type in interface RecipeComponent<Long>
    • codec

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

      public dev.latvian.mods.rhino.type.TypeInfo typeInfo()
      Description copied from interface: RecipeComponent
      Defines 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:
      typeInfo in interface NumberComponent<NumberComponent.LongRange,Long>
      Specified by:
      typeInfo in interface RecipeComponent<Long>
      Returns:
      A description of how this component may be constructed
    • wrap

      public Long 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<Long>
      Parameters:
      cx - Script context
      from - An object to be converted to a value for this component
      Returns:
      The value read from the input
    • range

      public NumberComponent.LongRange range(Long min, Long max)
      Specified by:
      range in interface NumberComponent<NumberComponent.LongRange,Long>
    • 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. 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
    • min

      public Long min()
      Returns the value of the min record component.
      Specified by:
      min in interface NumberComponent<NumberComponent.LongRange,Long>
      Returns:
      the value of the min record component
    • max

      public Long max()
      Returns the value of the max record component.
      Specified by:
      max in interface NumberComponent<NumberComponent.LongRange,Long>
      Returns:
      the value of the max record component