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.

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
Copy
import crafttweaker.api.loot.conditions.vanilla.TimeCheck;

已实现的接口

Link to 已实现的接口

TimeCheck implements the following interfaces. That means all methods defined in these interfaces are also available in TimeCheck

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
Copy
TimeCheck.withExactValue(value as int) as TimeCheck
参数类型描述
参数
value
类型
int
描述
The exact value the world time must have.

Link to withMaximumValue

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
Copy
TimeCheck.withMaximumValue(max as int) as TimeCheck
参数类型描述
参数
max
类型
int
描述
The maximum value the game time can have.

Link to withMinimumValue

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
Copy
TimeCheck.withMinimumValue(min as int) as TimeCheck
参数类型描述
参数
min
类型
int
描述
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
Copy
TimeCheck.withRangedValue(min as int, max as int) as TimeCheck
参数类型描述
参数
min
类型
int
描述
The minimum value the game time can have.
参数
max
类型
int
描述
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
Copy
TimeCheck.withTimePeriod(period as int) as TimeCheck
参数类型描述
参数
period
类型
int
描述
The time period to use for the modulo operation.