public static interface ChunkPreGenerate.Builder extends ResettableBuilder<ChunkPreGenerate,ChunkPreGenerate.Builder>
The task is synchronous and repeating with a given interval and either a target number of chunks per ticks and/or a percentage of the tick time.
Chunk order is not defined but a proper implementation should use and "inside-out" strategy for better results if the task is cancelled.
| Modifier and Type | Method and Description |
|---|---|
ChunkPreGenerate.Builder |
addListener(Consumer<ChunkPreGenerationEvent> listener)
Adds a
ChunkPreGenerationEvent listener callback that will be
called for this, and only this, pre-generation routine. |
ChunkPreGenerate.Builder |
chunksPerTick(int chunkCount)
Sets maximum number of chunks per tick to generate.
|
ChunkPreGenerate.Builder |
logger(org.slf4j.Logger logger)
Adds a logger for logging generator efforts.
|
ChunkPreGenerate.Builder |
owner(Object plugin)
Sets the owner of the resulting task.
|
ChunkPreGenerate |
start()
Schedules the task with the
Game.getScheduler(). |
ChunkPreGenerate.Builder |
tickInterval(int tickInterval)
Sets the number of ticks between generation runs.
|
ChunkPreGenerate.Builder |
tickPercentLimit(float tickPercent)
Sets the limit of tick time that can be used to generate chunks as a
percentage of
Scheduler.getPreferredTickInterval(). |
from, resetChunkPreGenerate.Builder owner(Object plugin)
Mandatory.
plugin - The owner pluginChunkPreGenerate.Builder logger(@Nullable org.slf4j.Logger logger)
Optional. No effect if null is passed.
logger - A logger for the generatorChunkPreGenerate.Builder tickInterval(int tickInterval)
Must be greater than 0.
Optional.
Default is 4.
tickInterval - The tick intervalChunkPreGenerate.Builder chunksPerTick(int chunkCount)
Use a value smaller or equal to 0 to disable.
Optional if tickPercentLimit(float) is used.
Default is disabled.
chunkCount - The maximum number of chunks to generateChunkPreGenerate.Builder tickPercentLimit(float tickPercent)
Scheduler.getPreferredTickInterval(). The
percentage must be a value in the range (0, 1]. No estimation is
used to decide when to stop so the actual value will always be
somewhere above the given percentage.
Use a value smaller or equal to 0 to disable.
Optional if chunksPerTick(int) is used.
Default is 80%.
tickPercent - The maximum percentage of the tick time to use
for this generation pass.ChunkPreGenerate.Builder addListener(Consumer<ChunkPreGenerationEvent> listener)
ChunkPreGenerationEvent listener callback that will be
called for this, and only this, pre-generation routine. Note that
this does not change whether the various ChunkPreGenerationEvent
events will be called, this is a convenience method to simply setup
a listener bound to this pre-generation.listener - The Consumer that will handle the events.ChunkPreGenerate start()
Game.getScheduler().ChunkPreGenerate that can be used
obtain progress