Package io.papermc.paper.util
Class Tick
java.lang.Object
io.papermc.paper.util.Tick
- All Implemented Interfaces:
- TemporalUnit
A TemporalUnit that represents the target length of one server tick. This is defined
 as 50 milliseconds. Note that this class is not for measuring the length that a tick
 took, rather it is used for simple conversion between times and ticks.
- See Also:
- 
Method SummaryModifier and TypeMethodDescription<R extends Temporal>
 RaddTo(R temporal, long amount) longintfromDuration(@NotNull Duration duration) Gets the number of whole ticks that occur in the provided duration.booleanbooleanbooleanof(long ticks) Creates a duration from an amount of ticks.tick()Gets the instance of the tick temporal unit.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.time.temporal.TemporalUnitisSupportedBy, toString
- 
Method Details- 
tickGets the instance of the tick temporal unit.- Returns:
- the tick instance
 
- 
ofCreates a duration from an amount of ticks. This is shorthand forDuration.of(long, TemporalUnit)called with the amount of ticks andtick().- Parameters:
- ticks- the amount of ticks
- Returns:
- the duration
 
- 
fromDurationGets the number of whole ticks that occur in the provided duration. Note that this method returns anintas this is the unit that Minecraft stores ticks in.- Parameters:
- duration- the duration
- Returns:
- the number of whole ticks in this duration
- Throws:
- ArithmeticException- if the duration is zero or an overflow occurs
 
- 
getDuration- Specified by:
- getDurationin interface- TemporalUnit
 
- 
isDurationEstimatedpublic boolean isDurationEstimated()- Specified by:
- isDurationEstimatedin interface- TemporalUnit
 
- 
isDateBasedpublic boolean isDateBased()- Specified by:
- isDateBasedin interface- TemporalUnit
 
- 
isTimeBasedpublic boolean isTimeBased()- Specified by:
- isTimeBasedin interface- TemporalUnit
 
- 
addTo- Specified by:
- addToin interface- TemporalUnit
 
- 
between- Specified by:
- betweenin interface- TemporalUnit
 
 
-