Time constructor

const Time(
  1. int ticks
)

Object that represents time in minecraft. Usually translated into ticks (20ticks = 1 second).

You can directly construct the time from the integer number of ticks:

var t = Time(2400);

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,

Also all common math and comparison operators are available:

t = 1.minutes + 30.seconds
t += 20.seconds
if(t > 10.seconds) {
	// do something conditional
}

Implementation

// Using this style is highly recommended, as it leads to readable and understandable code.
///
const Time(this.ticks) : isInfinite = false;