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 Summary
Modifier and TypeMethodDescriptionbooleanhasBlockTick(BlockPosition position, TypedKey<BlockType> block) Returnstrueif a tick of a block type is pending at a position.booleanhasFluidTick(BlockPosition position, TypedKey<Fluid> fluid) Returnstrueif a tick of a fluid is pending at a position.voidscheduleBlockTick(BlockPosition position, TypedKey<BlockType> block, int delay) Schedules a tick for a block, ofTickPriority.NORMALpriority.voidscheduleBlockTick(BlockPosition position, TypedKey<BlockType> block, int delay, TickPriority priority) Schedules a tick for a block.voidscheduleFluidTick(BlockPosition position, TypedKey<Fluid> fluid, int delay) Schedules a tick for a fluid: it flows on, dries up or turns into a source then.booleanwillBlockTickThisTick(BlockPosition position, TypedKey<BlockType> block) Returnstrueif a tick of a block type is due in the current game tick and has not run yet.
-
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 isblock- the block type to tick; the tick is dropped if another block stands there once duedelay- in how many game ticks it is due,0or less for the next game tickpriority- the order of the ticks due in the same game tick- Since:
- 0.1.0
-
scheduleBlockTick
Schedules a tick for a block, ofTickPriority.NORMALpriority.- Parameters:
position- where the block isblock- the block type to tickdelay- in how many game ticks it is due- Since:
- 0.1.0
-
hasBlockTick
Returnstrueif 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 isblock- the block type- Returns:
trueif a tick of a block type is pending at a position- Since:
- 0.1.0
-
willBlockTickThisTick
Returnstrueif 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 isblock- the block type- Returns:
trueif a tick of a block type is due in the current game tick and has not run yet- Since:
- 0.1.0
-
scheduleFluidTick
Schedules a tick for a fluid: it flows on, dries up or turns into a source then.- Parameters:
position- where the fluid isfluid- the fluid to tick,FluidKeys.WATERorFluidKeys.LAVA; the tick is dropped if the block holds another one once duedelay- in how many game ticks it is due,0or less for the next game tick- Throws:
IllegalArgumentException- if the fluid is neither water nor lava- Since:
- 0.1.0
-
hasFluidTick
Returnstrueif a tick of a fluid is pending at a position.- Parameters:
position- where the fluid isfluid- the fluid- Returns:
trueif a tick of a fluid is pending at a position- Since:
- 0.1.0
-