Home Commands Examples Getting Started With Scripts Global Keywords
BracketDumpers BracketHandlers BracketValidators ResourceLocationBracketHandler

SequenceBuilder

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.api.util.sequence.SequenceBuilder;

Description

A builder for Sequence.

Members

addTask(task as ISequenceTask<T, U>) as SequenceBuilder<T, U>
Adds a task to the sequence.

Returns: This builder to chain calls.

script.zs
// SequenceBuilder<T,U>.addTask(task as ISequenceTask<T, U>) as SequenceBuilder<T, U>;
mySequenceBuilder.addTask(new SleepTask(20));

Parameters:

task Type: ISequenceTask<T, U> - The task to add.

Return Type: SequenceBuilder<T, U>

run(function as function(t as T) as void) as SequenceBuilder<T, U>
Runs the function as part of the sequence.

Returns: This builder to chain calls.

script.zs
// SequenceBuilder<T,U>.run(function as function(t as T) as void) as SequenceBuilder<T, U>;
mySequenceBuilder.run((level) => level.setRainLevel(0.5));

Parameters:

function Type: function(t as T) as void - The function to run.

Return Type: SequenceBuilder<T, U>

run(function as BiConsumer<T, SequenceContext<T, U>>) as SequenceBuilder<T, U>
Runs the function as part of the sequence.

Returns: This builder to chain calls.

script.zs
// SequenceBuilder<T,U>.run(function as BiConsumer<T, SequenceContext<T, U>>) as SequenceBuilder<T, U>;
mySequenceBuilder.run((level, context) => level.setRainLevel(0.5));

Parameters:

function Type: BiConsumer<T, SequenceContext<T, U>> - The function to run.

Return Type: SequenceBuilder<T, U>

sleep(ticks as long) as SequenceBuilder<T, U>
Sleep (wait) for the given amount of ticks.

Returns: This builder to chain calls.

script.zs
// SequenceBuilder<T,U>.sleep(ticks as long) as SequenceBuilder<T, U>;
mySequenceBuilder.sleep(20);

Parameters:

ticks Type: long - The amount of ticks to wait.

Return Type: SequenceBuilder<T, U>

sleepUntil(condition as function(t as T) as bool) as SequenceBuilder<T, U>
Sleeps until the given condition is met.

Returns: This builder to chain calls.

script.zs
// SequenceBuilder<T,U>.sleepUntil(condition as function(t as T) as bool) as SequenceBuilder<T, U>;
mySequenceBuilder.sleepUntil((level) => level.isRaining);

Parameters:

condition Type: function(t as T) as bool - The condition to wait for.

Return Type: SequenceBuilder<T, U>

sleepUntil(condition as BiPredicate<T, SequenceContext<T, U>>) as SequenceBuilder<T, U>
Sleeps until the given condition is met.

Returns: This builder to chain calls.

script.zs
// SequenceBuilder<T,U>.sleepUntil(condition as BiPredicate<T, SequenceContext<T, U>>) as SequenceBuilder<T, U>;
mySequenceBuilder.sleepUntil((level, context) => level.isRaining);

Parameters:

condition Type: BiPredicate<T, SequenceContext<T, U>> - The condition to wait for.

Return Type: SequenceBuilder<T, U>

start() as Sequence<T, U>
Builds and starts the sequence.

Returns: The sequence that was built.

script.zs
// SequenceBuilder<T,U>.start() as Sequence<T, U>;
mySequenceBuilder.start();

Return Type: Sequence<T, U>

then(function as function(t as T) as void) as SequenceBuilder<T, U>
Runs the function as part of the sequence.

This method is an alias for run

Returns: This builder to chain calls.

script.zs
// SequenceBuilder<T,U>.then(function as function(t as T) as void) as SequenceBuilder<T, U>;
mySequenceBuilder.then((level) => level.setRainLevel(0.5));

Parameters:

function Type: function(t as T) as void - The function to run.

Return Type: SequenceBuilder<T, U>

then(function as BiConsumer<T, SequenceContext<T, U>>) as SequenceBuilder<T, U>
Runs the function as part of the sequence.

This method is an alias for run

Returns: This builder to chain calls.

script.zs
// SequenceBuilder<T,U>.then(function as BiConsumer<T, SequenceContext<T, U>>) as SequenceBuilder<T, U>;
mySequenceBuilder.then((level, context) => level.setRainLevel(0.5));

Parameters:

function Type: BiConsumer<T, SequenceContext<T, U>> - The function to run.

Return Type: SequenceBuilder<T, U>