Record Class ClockTimeMarker
java.lang.Object
java.lang.Record
net.minecraft.world.clock.ClockTimeMarker
public record ClockTimeMarker(Holder<WorldClock> clock, int ticks, Optional<Integer> periodTicks, boolean showInCommands)
extends Record
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Holder<WorldClock> The field for theclockrecord component.static final com.mojang.serialization.Codec<ResourceKey<ClockTimeMarker>> The field for theperiodTicksrecord component.private final booleanThe field for theshowInCommandsrecord component.private final intThe field for theticksrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionClockTimeMarker(Holder<WorldClock> clock, int ticks, Optional<Integer> periodTicks, boolean showInCommands) Creates an instance of aClockTimeMarkerrecord class. -
Method Summary
Modifier and TypeMethodDescriptionclock()Returns the value of theclockrecord component.private static longdurationToNext(int periodTicks, long from, long to) final booleanIndicates whether some other object is "equal to" this one.longgetNextOccurenceAfter(long totalTicks) longgetRepetitionCount(long totalTicks) final inthashCode()Returns a hash code value for this object.booleanoccursAt(long totalTicks) Returns the value of theperiodTicksrecord component.booleanReturns the value of theshowInCommandsrecord component.intticks()Returns the value of theticksrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
clock
The field for theclockrecord component. -
ticks
private final int ticksThe field for theticksrecord component. -
periodTicks
-
showInCommands
private final boolean showInCommandsThe field for theshowInCommandsrecord component. -
KEY_CODEC
-
-
Constructor Details
-
ClockTimeMarker
public ClockTimeMarker(Holder<WorldClock> clock, int ticks, Optional<Integer> periodTicks, boolean showInCommands) Creates an instance of aClockTimeMarkerrecord class.- Parameters:
clock- the value for theclockrecord componentticks- the value for theticksrecord componentperiodTicks- the value for theperiodTicksrecord componentshowInCommands- the value for theshowInCommandsrecord component
-
-
Method Details
-
getRepetitionCount
public long getRepetitionCount(long totalTicks) -
getNextOccurenceAfter
public long getNextOccurenceAfter(long totalTicks) -
occursAt
public boolean occursAt(long totalTicks) -
durationToNext
private static long durationToNext(int periodTicks, long from, long to) -
toString
-
hashCode
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
clock
Returns the value of theclockrecord component.- Returns:
- the value of the
clockrecord component
-
ticks
public int ticks()Returns the value of theticksrecord component.- Returns:
- the value of the
ticksrecord component
-
periodTicks
-
showInCommands
public boolean showInCommands()Returns the value of theshowInCommandsrecord component.- Returns:
- the value of the
showInCommandsrecord component
-