Interface IDhApiWorldGenerator
- All Superinterfaces:
AutoCloseable
,Closeable
,IBindable
,IDhApiOverrideable
- All Known Implementing Classes:
AbstractDhApiChunkWorldGenerator
- Since:
- API 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
default CompletableFuture
<Void> generateApiChunks
(int chunkPosMinX, int chunkPosMinZ, int generationRequestChunkWidthCount, byte targetDataDetail, EDhApiDistantGeneratorMode generatorMode, ExecutorService worldGeneratorThreadPool, Consumer<DhApiChunk> resultConsumer) This method is called by Distant Horizons to generate terrain over a given area whengetReturnType()
returnsEDhApiWorldGeneratorReturnType.API_CHUNKS
.default CompletableFuture
<Void> generateChunks
(int chunkPosMinX, int chunkPosMinZ, int generationRequestChunkWidthCount, byte targetDataDetail, EDhApiDistantGeneratorMode generatorMode, ExecutorService worldGeneratorThreadPool, Consumer<Object[]> resultConsumer) This method is called by Distant Horizons to generate terrain over a given area whengetReturnType()
returnsEDhApiWorldGeneratorReturnType.VANILLA_CHUNKS
.default CompletableFuture
<Void> generateLod
(int chunkPosMinX, int chunkPosMinZ, int lodPosX, int lodPosZ, byte detailLevel, IDhApiFullDataSource pooledFullDataSource, EDhApiDistantGeneratorMode generatorMode, ExecutorService worldGeneratorThreadPool, Consumer<IDhApiFullDataSource> resultConsumer) This method is called by Distant Horizons to generate terrain over a given area whengetReturnType()
returnsEDhApiWorldGeneratorReturnType.API_DATA_SOURCES
.default byte
Defines the largest datapoint size that can be generated at a time.default EDhApiWorldGeneratorReturnType
This method controls how Distant Horizons requests generated chunks.default byte
Defines the smallest datapoint size that can be generated at a time.void
Called before a new generator task is started.default boolean
Methods inherited from interface com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IBindable
finishDelayedSetup, getDelayedSetupComplete
Methods inherited from interface com.seibel.distanthorizons.api.interfaces.override.IDhApiOverrideable
getPriority
-
Method Details
-
getSmallestDataDetailLevel
default byte getSmallestDataDetailLevel()Defines the smallest datapoint size that can be generated at a time.
Maximum detail level (smallest numerical value) is 0 (1 block)
Default detail level is 0
For more information on what detail levels represent see:EDhApiDetailLevel
.- Since:
- API 1.0.0
- See Also:
-
getLargestDataDetailLevel
default byte getLargestDataDetailLevel()Defines the largest datapoint size that can be generated at a time.
Maximum detail level (smallest numerical value) is 0 (1 block)
Default detail level is 0
For more information on what detail levels represent see:EDhApiDetailLevel
.- Since:
- API 1.0.0
- See Also:
-
runApiValidation
default boolean runApiValidation()Used ifgetReturnType()
returnsEDhApiWorldGeneratorReturnType.API_CHUNKS
orEDhApiWorldGeneratorReturnType.API_DATA_SOURCES
.
If true DH will run additional validation on theDhApiChunk
orIDhApiFullDataSource
's returned.
This should be disabled during release but should be enabled during development to help spot issues with your data format.- Since:
- API 4.0.0
- See Also:
-
generateChunks
default CompletableFuture<Void> generateChunks(int chunkPosMinX, int chunkPosMinZ, int generationRequestChunkWidthCount, byte targetDataDetail, EDhApiDistantGeneratorMode generatorMode, ExecutorService worldGeneratorThreadPool, Consumer<Object[]> resultConsumer) This method is called by Distant Horizons to generate terrain over a given area whengetReturnType()
returnsEDhApiWorldGeneratorReturnType.VANILLA_CHUNKS
.
After a chunk has been generated it (and any necessary supporting objects as listed below) should be passed into the resultConsumer'sConsumer.accept(T)
method. If the Consumer is given the wrong data type(s) it will disable the world generator and log an error with a list of objects it was expecting.
Note: these objects are minecraft version dependent and will change without notice! Please run your generator in game at least once to confirm the objects you are returning are correct.
Consumer expected inputs for each minecraft version (in order):
1.16, 1.17, 1.18, 1.19, 1.20:
- [net.minecraft.world.level.chunk.ChunkAccess]
- [net.minecraft.world.level.ServerLevel] or [net.minecraft.world.level.ClientLevel]- Parameters:
chunkPosMinX
- the chunk X position closest to negative infinitychunkPosMinZ
- the chunk Z position closest to negative infinitygenerationRequestChunkWidthCount
- how many chunks wide you should generatetargetDataDetail
- the LOD Detail level requested to generate. SeeEDhApiDetailLevel
for additional information.generatorMode
- how far into the world gen pipeline this method should run. SeeEDhApiDistantGeneratorMode
for additional documentation.worldGeneratorThreadPool
- the thread pool that should be used when generating the returnedCompletableFuture
.resultConsumer
- the consumer that should be fired whenever a chunk finishes generating.- Returns:
- a future that should run on the worldGeneratorThreadPool and complete once the given generation task has completed.
- Since:
- API 1.0.0
- Implementation Note:
- the default implementation of this method throws an
UnsupportedOperationException
, and must be overridden whengetReturnType()
returnsEDhApiWorldGeneratorReturnType.VANILLA_CHUNKS
. sincegetReturnType()
returnsEDhApiWorldGeneratorReturnType.VANILLA_CHUNKS
by default, this method must also be overridden whengetReturnType()
is NOT overridden.
-
generateApiChunks
default CompletableFuture<Void> generateApiChunks(int chunkPosMinX, int chunkPosMinZ, int generationRequestChunkWidthCount, byte targetDataDetail, EDhApiDistantGeneratorMode generatorMode, ExecutorService worldGeneratorThreadPool, Consumer<DhApiChunk> resultConsumer) This method is called by Distant Horizons to generate terrain over a given area whengetReturnType()
returnsEDhApiWorldGeneratorReturnType.API_CHUNKS
.
After theDhApiChunk
has been generated, it should be passed into the resultConsumer'sConsumer.accept(Object)
method. Note: if air blocks aren't included in the with theDhApiChunk
with proper lighting, lower detail levels will appear as black/unlit.- Parameters:
chunkPosMinX
- the chunk X position closest to negative infinitychunkPosMinZ
- the chunk Z position closest to negative infinitygenerationRequestChunkWidthCount
- how many chunks wide you should generatetargetDataDetail
- the LOD Detail level requested to generate. SeeEDhApiDetailLevel
for additional information.generatorMode
- how far into the world gen pipeline this method should run. SeeEDhApiDistantGeneratorMode
for additional documentation.worldGeneratorThreadPool
- the thread pool that should be used when generating the returnedCompletableFuture
.resultConsumer
- the consumer that should be fired whenever a chunk finishes generating.- Returns:
- a future that should run on the worldGeneratorThreadPool and complete once the given generation task has completed.
- Since:
- API 2.0.0
- Implementation Note:
- the default implementation of this method throws an
UnsupportedOperationException
, and must be overridden whengetReturnType()
returnsEDhApiWorldGeneratorReturnType.API_CHUNKS
.
-
generateLod
default CompletableFuture<Void> generateLod(int chunkPosMinX, int chunkPosMinZ, int lodPosX, int lodPosZ, byte detailLevel, IDhApiFullDataSource pooledFullDataSource, EDhApiDistantGeneratorMode generatorMode, ExecutorService worldGeneratorThreadPool, Consumer<IDhApiFullDataSource> resultConsumer) This method is called by Distant Horizons to generate terrain over a given area whengetReturnType()
returnsEDhApiWorldGeneratorReturnType.API_DATA_SOURCES
.
After theIDhApiWorldGenerator
has been generated, it should be passed into the resultConsumer'sConsumer.accept(Object)
method. Note: if air blocks aren't included in the with theDhApiChunk
with proper lighting, lower detail levels will appear as black/unlit.- Parameters:
chunkPosMinX
- the chunk X position closest to negative infinitychunkPosMinZ
- the chunk Z position closest to negative infinitylodPosX
- the LOD's X position, relative to the givenEDhApiDetailLevel
lodPosZ
- the LOD's Z position, relative to the givenEDhApiDetailLevel
detailLevel
- the LOD Detail level requested to generate. SeeEDhApiDetailLevel
for additional information.pooledFullDataSource
- The data source you should populate during your world generation. This data source is pooled by DH and may be reused multiple times by different internal DH systems.
This data source should not be referenced or stored outside of this method nor the executor provided by worldGeneratorThreadPool. Attempting to do so will corrupt DH's data.generatorMode
- how far into the world gen pipeline this method should run. SeeEDhApiDistantGeneratorMode
for additional documentation.worldGeneratorThreadPool
- the thread pool that should be used when generating the returnedCompletableFuture
.resultConsumer
- the consumer that should be fired whenever a chunk finishes generating.- Returns:
- a future that should run on the worldGeneratorThreadPool and complete once the given generation task has completed.
- Since:
- API 4.0.0
- Implementation Note:
- the default implementation of this method throws an
UnsupportedOperationException
, and must be overridden whengetReturnType()
returnsEDhApiWorldGeneratorReturnType.API_CHUNKS
.
-
getReturnType
This method controls how Distant Horizons requests generated chunks. By default, the return value isEDhApiWorldGeneratorReturnType.VANILLA_CHUNKS
, which means thatgenerateChunks(int, int, int, byte, EDhApiDistantGeneratorMode, ExecutorService, Consumer)
will be invoked whenever Distant Horizons wants to generate terrain with this world generator.- Since:
- API 2.0.0
-
preGeneratorTaskStart
void preGeneratorTaskStart()Called before a new generator task is started.
This can be used to run cleanup on existing tasks before new tasks are started.- Since:
- API 1.0.0
-
close
void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-