Record Class TickDuration

java.lang.Object
java.lang.Record
dev.latvian.mods.kubejs.util.TickDuration
All Implemented Interfaces:
TemporalAmount

public record TickDuration(long ticks) extends Record implements TemporalAmount
  • Field Details

    • ZERO

      public static final TickDuration ZERO
    • CODEC

      public static final com.mojang.serialization.Codec<TickDuration> CODEC
    • SECONDS_CODEC

      public static final com.mojang.serialization.Codec<TickDuration> SECONDS_CODEC
    • MINUTES_CODEC

      public static final com.mojang.serialization.Codec<TickDuration> MINUTES_CODEC
    • HOURS_CODEC

      public static final com.mojang.serialization.Codec<TickDuration> HOURS_CODEC
    • TYPE_INFO

      public static final dev.latvian.mods.rhino.type.TypeInfo TYPE_INFO
  • Constructor Details

    • TickDuration

      public TickDuration(long ticks)
      Creates an instance of a TickDuration record class.
      Parameters:
      ticks - the value for the ticks record component
  • Method Details

    • of

      public static TickDuration of(long ticks)
    • wrap

      public static TickDuration wrap(dev.latvian.mods.rhino.Context cx, Object from)
    • get

      public long get(TemporalUnit unit)
      Specified by:
      get in interface TemporalAmount
    • getUnits

      public List<TemporalUnit> getUnits()
      Specified by:
      getUnits in interface TemporalAmount
    • addTo

      public Temporal addTo(Temporal temporal)
      Specified by:
      addTo in interface TemporalAmount
    • subtractFrom

      public Temporal subtractFrom(Temporal temporal)
      Specified by:
      subtractFrom in interface TemporalAmount
    • 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
    • intTicks

      public int intTicks()
    • 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 '=='.
      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.
    • ticks

      public long ticks()
      Returns the value of the ticks record component.
      Returns:
      the value of the ticks record component