Class Task

    • Constructor Detail

      • Task

        public Task()
    • Method Detail

      • execute

        public abstract boolean execute()
      • sleep

        public void sleep​(int ticks)
        Parameters:
        ticks - Sets the amount of ticks to sleep after this task executes before executing it again. The default is 1, so sleep(1) does nothing
      • sleepUntil

        public void sleepUntil​(BooleanSupplier condition,
                               int timeout)
        Sets a conditional sleep to take place after this task executes
        Parameters:
        condition - The condition of which to sleep until it's met
        timeout - The number of ticks to timeout at if the condition never passes
      • sleepUntil

        public void sleepUntil​(BooleanSupplier condition,
                               BooleanSupplier reset,
                               int timeout)
        Sets a conditional sleep to take place after this task executes
        Parameters:
        condition - The condition of which to sleep until it's met
        reset - A condition that's checked every tick and if met, the sleep is reset
        timeout - The number of ticks to timeout at if the condition never passes
      • sleepWhile

        @Deprecated
        public void sleepWhile​(BooleanSupplier condition,
                               int timeout)
        Deprecated.
        Use sleepUntil(BooleanSupplier, int) with an inverted condition. Maintaining this function as well as other overloads is bloat
        Sets a conditional sleep to take place after this task executes
        Parameters:
        condition - The condition of which to sleep while it's met
        timeout - The number of ticks to timeout at if the condition never fails
      • getParent

        public Task getParent()