SequenceBuilder<T : Object, U : Object>

Link to sequencebuildert--object-u--object

A builder for Sequence<T,U>.

Импорт класса

Link to импорт-класса

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.util.sequence.SequenceBuilder;

Name: addTask

Adds a task to the sequence.

Returns: This builder to chain calls.
Return Type: SequenceBuilder<T,U>

ZenScript
Copy
// SequenceBuilder.addTask(task as ISequenceTask<T,U>) as SequenceBuilder<T,U>

level.sequence().addTask(new SleepTask(20));
ПараметрТипОписание
Параметр
task
Тип
ISequenceTask<T,U>
Описание
The task to add.

Name: run

Runs the function as part of the sequence.

Returns: This builder to chain calls.
Return Type: SequenceBuilder<T,U>

ZenScript
Copy
// SequenceBuilder.run(function as BiConsumer<T,SequenceContext<T,U>>) as SequenceBuilder<T,U>

level.sequence().run((level, context) => level.setRainLevel(0.5));
ПараметрТипОписание
Параметр
function
Тип
BiConsumer<T,SequenceContext<T,U>>
Описание
The function to run.

Name: run

Runs the function as part of the sequence.

Returns: This builder to chain calls.
Return Type: SequenceBuilder<T,U>

ZenScript
Copy
// SequenceBuilder.run(function as Consumer<T>) as SequenceBuilder<T,U>

level.sequence().run((level) => level.setRainLevel(0.5));
ПараметрТипОписание
Параметр
function
Тип
Consumer<T>
Описание
The function to run.

Name: sleep

Sleep (wait) for the given amount of ticks.

Returns: This builder to chain calls.
Return Type: SequenceBuilder<T,U>

ZenScript
Copy
// SequenceBuilder.sleep(ticks as long) as SequenceBuilder<T,U>

level.sequence().sleep(20);
ПараметрТипОписание
Параметр
ticks
Тип
long
Описание
The amount of ticks to wait.

Name: sleepUntil

Sleeps until the given condition is met.

Returns: This builder to chain calls.
Return Type: SequenceBuilder<T,U>

ZenScript
Copy
// SequenceBuilder.sleepUntil(condition as BiPredicate<T,SequenceContext<T,U>>) as SequenceBuilder<T,U>

level.sequence().sleepUntil((level, context) => level.isRaining);
ПараметрТипОписание
Параметр
condition
Тип
BiPredicate<T,SequenceContext<T,U>>
Описание
The condition to wait for.

Name: sleepUntil

Sleeps until the given condition is met.

Returns: This builder to chain calls.
Return Type: SequenceBuilder<T,U>

ZenScript
Copy
// SequenceBuilder.sleepUntil(condition as Predicate<T>) as SequenceBuilder<T,U>

level.sequence().sleepUntil((level) => level.isRaining);
ПараметрТипОписание
Параметр
condition
Тип
Predicate<T>
Описание
The condition to wait for.

Name: start

Builds and starts the sequence.

Returns: The sequence that was built.
Return Type: Sequence<T,U>

ZenScript
Copy
// SequenceBuilder.start() as Sequence<T,U>

level.sequence().start();

Name: then

Runs the function as part of the sequence.

This method is an alias for run

Returns: This builder to chain calls.
Return Type: SequenceBuilder<T,U>

ZenScript
Copy
// SequenceBuilder.then(function as BiConsumer<T,SequenceContext<T,U>>) as SequenceBuilder<T,U>

level.sequence().then((level, context) => level.setRainLevel(0.5));
ПараметрТипОписание
Параметр
function
Тип
BiConsumer<T,SequenceContext<T,U>>
Описание
The function to run.

Name: then

Runs the function as part of the sequence.

This method is an alias for run

Returns: This builder to chain calls.
Return Type: SequenceBuilder<T,U>

ZenScript
Copy
// SequenceBuilder.then(function as Consumer<T>) as SequenceBuilder<T,U>

level.sequence().then((level) => level.setRainLevel(0.5));
ПараметрТипОписание
Параметр
function
Тип
Consumer<T>
Описание
The function to run.