Package dev.latvian.mods.klib.util
Record Class Timestamp
java.lang.Object
java.lang.Record
dev.latvian.mods.klib.util.Timestamp
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTimestamp(long utc, long tick) Creates an instance of aTimestamprecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic longdeflateUTC(long value) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static longinflateUTC(long value) booleanisNone()static Timestampnow(long tick) static Timestampof(long utc, long tick) static Timestamplongtick()Returns the value of thetickrecord component.final StringtoString()Returns a string representation of this record class.longutc()Returns the value of theutcrecord component.voidwrite(DataOutput out)
-
Field Details
-
EPOCH
public static final long EPOCH- See Also:
-
NONE
-
MAP_CODEC
-
CODEC
-
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,Timestamp> STREAM_CODEC -
DATA_TYPE
-
-
Constructor Details
-
Timestamp
public Timestamp(long utc, long tick) Creates an instance of aTimestamprecord class.- Parameters:
utc- the value for theutcrecord componenttick- the value for thetickrecord component
-
-
Method Details
-
deflateUTC
public static long deflateUTC(long value) -
inflateUTC
public static long inflateUTC(long value) -
of
-
now
-
read
- Throws:
IOException
-
write
- Throws:
IOException
-
isNone
public boolean isNone() -
toInstant
-
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. -
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 with '=='. -
utc
public long utc()Returns the value of theutcrecord component.- Returns:
- the value of the
utcrecord component
-
tick
public long tick()Returns the value of thetickrecord component.- Returns:
- the value of the
tickrecord component
-