TimeCheck
Link to timecheck
Builder for the 'TimeCheck' loot condition.
This condition checks the current game time, counted from day 0, making sure that it fits within some defined boundaries. The checked time may undergo a modulo operation if desired, to ensure that the time period doesn't increase infinitely or to restrict the game time to a specific portion of the world time.
A 'TimeCheck' condition requires at least a minimum or a maximum bound for the world time. Moreover, the time period must not be negative, if such a value gets specified.
Importing the class
Link to importing-the-class
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport crafttweaker.api.loot.conditions.vanilla.TimeCheck;
Implemented Interfaces
Link to implemented-interfaces
TimeCheck implements the following interfaces. That means all methods defined in these interfaces are also available in TimeCheck
Methods
Link to methods
Name: withExactValue
Sets the game time to exactly match the given value
.
If the game time had already some bounds specified, then the bounds will get overwritten.
This parameter is required.
Returns: This builder for chaining.
Return Type: TimeCheck
ZenScript CopyTimeCheck.withExactValue(value as int) as TimeCheck
Parameter | Type | Description |
---|---|---|
Parameter value | Type int | Description The exact value the world time must have. |
Name: withMaximumValue
Sets the maximum value of the game time to max
.
If the game time had already some bounds specified, then the maximum value of the bound will be overwritten with
the new value specified in min
. On the other hand, if the game time didn't have any specified
bounds, the maximum value is set, leaving the lower end unbounded.
The maximum value is inclusive, meaning that a value that is equal to max
will pass the check.
This parameter is required.
Returns: This builder for chaining.
Return Type: TimeCheck
ZenScript CopyTimeCheck.withMaximumValue(max as int) as TimeCheck
Parameter | Type | Description |
---|---|---|
Parameter max | Type int | Description The maximum value the game time can have. |
Name: withMinimumValue
Sets the minimum value of the game time to min
.
If the game time had already some bounds specified, then the minimum value of the bound will be overwritten with
the new value specified in min
. On the other hand, if the game time didn't have any specified
bounds, the minimum value is set, leaving the upper end unbounded.
The minimum value is inclusive, meaning that a value that is equal to min
will pass the check.
This parameter is required.
Returns: This builder for chaining.
Return Type: TimeCheck
ZenScript CopyTimeCheck.withMinimumValue(min as int) as TimeCheck
Parameter | Type | Description |
---|---|---|
Parameter min | Type int | Description The minimum value the game time can have. |
Name: withRangedValue
Sets both the minimum and maximum values of the game time respectively to min
and max
.
If the game time had already some bounds specified, then the bounds will get completely overwritten with the new values.
Both minimum and maximum values are inclusive, meaning that a value that is equal to either min
or
max
will pass the check.
This parameter is required.
Returns: This builder for chaining.
Return Type: TimeCheck
ZenScript CopyTimeCheck.withRangedValue(min as int, max as int) as TimeCheck
Parameter | Type | Description |
---|---|---|
Parameter min | Type int | Description The minimum value the game time can have. |
Parameter max | Type int | Description The maximum value the game time can have. |
Name: withTimePeriod
Sets the time period to use for the modulo operation.
This effectively restricts the value of the time to check between 0 (inclusive) and period
(exclusive), making it particularly useful to track elements such as days or weeks. As an example, the value to
give period
to track day time is 24000.
A value of 0 disables the operation from being carried out. On the other hand a negative value is forbidden.
Returns: This builder for chaining.
Return Type: TimeCheck
ZenScript CopyTimeCheck.withTimePeriod(period as int) as TimeCheck
Parameter | Type | Description |
---|---|---|
Parameter period | Type int | Description The time period to use for the modulo operation. |