Time class
Object that represents time in minecraft. Usually translated into ticks (20ticks = 1 second).
A more intuitive way is to use built in getters on the num
type and operators.
On any number(int, double, ...
) you can call .ticks, .seconds, .minutes
and .days
t = 2400.ticks,
t = 90.seconds,
t = 1.5.minutes,
Constructors
- Time(int ticks)
-
Object that represents time in minecraft. Usually translated into ticks (20ticks = 1 second).
const
- Time.days(int days)
-
const
- Time.duration({int ticks = 0, num? days, num? seconds, num? minutes})
-
For a handy interface which does the conversions automatically, use
Time.duration
:factory - Time.infinite()
-
In case of the Effect widget, it might be useful to pass infinite time.
This can be done with
Time.infinite()
.
Otherwise when a finite time is expected, an error is thrown.const - Time.minutes(int minutes)
-
const
- Time.seconds(int seconds)
-
const
Properties
Methods
-
compareTo(
Time other) → int -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
{bool reduce = true}) → String -
In commands when Time is used, string are generated dynamically.
When days can be expressed in
0.5
steps, the suffixd
is generated. When seconds can be expressed in0.25
steps, the suffixs
is generated.override
Operators
-
operator *(
num factor) → Time -
Multiplies this Time by the given
factor
and returns the result as a new Time object. -
operator +(
Time other) → Time -
Adds this Duration and
other
and returns the sum as a new Duration object. -
operator -(
Time other) → Time -
Subtracts
other
from this Duration and returns the difference as a new Duration object. -
operator <(
Time other) → bool -
Whether this Time is shorter than
other
. -
operator <=(
Time other) → bool -
Whether this Time is shorter than or equal to
other
. -
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator >(
Time other) → bool -
Whether this Time is longer than
other
. -
operator >=(
Time other) → bool -
Whether this Time is longer than or equal to
other
. -
operator ~/(
int quotient) → Time -
Divides this Time by the given
quotient
and returns the truncated result as a new Time object.