Interface ScheduledTicks


public interface ScheduledTicks
The ticks scheduled in a world: a block or a fluid asks to be ticked again some game ticks later, as a repeater does to switch or water to flow on.

On every game tick, the block ticks due run first, by priority then in the order they were scheduled, then the fluid ticks due, then the block events. A tick due when its block or fluid is no longer there is dropped. A block or a fluid has at most one tick of its type pending at a position: scheduling another one while it waits does nothing.

The ticks of the blocks of a chunk are saved with it, each with the number of game ticks it is still due in, and scheduled again once the chunk is loaded: a world picks up where it was stopped.

Scheduling hands the tick over to the region owning the position when another one runs the calling thread; the queries only answer for positions the calling thread owns.

Since:
0.1.0
See Also:
  • Method Details

    • scheduleBlockTick

      void scheduleBlockTick(BlockPosition position, TypedKey<BlockType> block, int delay, TickPriority priority)
      Schedules a tick for a block.
      Parameters:
      position - where the block is
      block - the block type to tick; the tick is dropped if another block stands there once due
      delay - in how many game ticks it is due, 0 or less for the next game tick
      priority - the order of the ticks due in the same game tick
      Since:
      0.1.0
    • scheduleBlockTick

      void scheduleBlockTick(BlockPosition position, TypedKey<BlockType> block, int delay)
      Schedules a tick for a block, of TickPriority.NORMAL priority.
      Parameters:
      position - where the block is
      block - the block type to tick
      delay - in how many game ticks it is due
      Since:
      0.1.0
    • hasBlockTick

      boolean hasBlockTick(BlockPosition position, TypedKey<BlockType> block)
      Returns true if a tick of a block type is pending at a position., not counting one taken to run in the current game tick
      Parameters:
      position - where the block is
      block - the block type
      Returns:
      true if a tick of a block type is pending at a position
      Since:
      0.1.0
    • willBlockTickThisTick

      boolean willBlockTickThisTick(BlockPosition position, TypedKey<BlockType> block)
      Returns true if a tick of a block type is due in the current game tick and has not run yet.: what a repeater looks at not to turn off while another one ahead still has to turn on
      Parameters:
      position - where the block is
      block - the block type
      Returns:
      true if a tick of a block type is due in the current game tick and has not run yet
      Since:
      0.1.0
    • scheduleFluidTick

      void scheduleFluidTick(BlockPosition position, TypedKey<Fluid> fluid, int delay)
      Schedules a tick for a fluid: it flows on, dries up or turns into a source then.
      Parameters:
      position - where the fluid is
      fluid - the fluid to tick, FluidKeys.WATER or FluidKeys.LAVA; the tick is dropped if the block holds another one once due
      delay - in how many game ticks it is due, 0 or less for the next game tick
      Throws:
      IllegalArgumentException - if the fluid is neither water nor lava
      Since:
      0.1.0
    • hasFluidTick

      boolean hasFluidTick(BlockPosition position, TypedKey<Fluid> fluid)
      Returns true if a tick of a fluid is pending at a position.
      Parameters:
      position - where the fluid is
      fluid - the fluid
      Returns:
      true if a tick of a fluid is pending at a position
      Since:
      0.1.0