Class SequenceBuilder<T,U>

java.lang.Object
com.blamejared.crafttweaker.api.util.sequence.SequenceBuilder<T,U>

@ZenRegister public class SequenceBuilder<T,U> extends Object
A builder for Sequence.
DocParam:
this level.sequence()
  • Constructor Details

  • Method Details

    • addTask

      public SequenceBuilder<T,U> addTask(ISequenceTask<T,U> task)
      Adds a task to the sequence.
      Parameters:
      task - The task to add.
      Returns:
      This builder to chain calls.
      DocParam:
      task new SleepTask(20)
    • sleep

      public SequenceBuilder<T,U> sleep(long ticks)
      Sleep (wait) for the given amount of ticks.
      Parameters:
      ticks - The amount of ticks to wait.
      Returns:
      This builder to chain calls.
      DocParam:
      ticks 20
    • sleepUntil

      public SequenceBuilder<T,U> sleepUntil(Predicate<T> condition)
      Sleeps until the given condition is met.
      Parameters:
      condition - The condition to wait for.
      Returns:
      This builder to chain calls.
      DocParam:
      condition (level) => level.isRaining
    • sleepUntil

      public SequenceBuilder<T,U> sleepUntil(BiPredicate<T,SequenceContext<T,U>> condition)
      Sleeps until the given condition is met.
      Parameters:
      condition - The condition to wait for.
      Returns:
      This builder to chain calls.
      DocParam:
      condition (level, context) => level.isRaining
    • run

      public SequenceBuilder<T,U> run(Consumer<T> function)
      Runs the function as part of the sequence.
      Parameters:
      function - The function to run.
      Returns:
      This builder to chain calls.
      DocParam:
      function (level) => level.setRainLevel(0.5)
    • run

      public SequenceBuilder<T,U> run(BiConsumer<T,SequenceContext<T,U>> function)
      Runs the function as part of the sequence.
      Parameters:
      function - The function to run.
      Returns:
      This builder to chain calls.
      DocParam:
      function (level, context) => level.setRainLevel(0.5)
    • then

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

      This method is an alias for run

      Parameters:
      function - The function to run.
      Returns:
      This builder to chain calls.
      DocParam:
      function (level) => level.setRainLevel(0.5)
    • then

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

      This method is an alias for run

      Parameters:
      function - The function to run.
      Returns:
      This builder to chain calls.
      DocParam:
      function (level, context) => level.setRainLevel(0.5)
    • start

      public Sequence<T,U> start()
      Builds and starts the sequence.
      Returns:
      The sequence that was built.