Class AbstractDhApiChunkWorldGenerator
java.lang.Object
com.seibel.distanthorizons.api.interfaces.override.worldGenerator.AbstractDhApiChunkWorldGenerator
- All Implemented Interfaces:
IDhApiOverrideable,IDhApiWorldGenerator,IBindable,Closeable,AutoCloseable
public abstract class AbstractDhApiChunkWorldGenerator
extends Object
implements Closeable, IDhApiOverrideable, IDhApiWorldGenerator
- Since:
- API 1.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract DhApiChunkgenerateApiChunk(int chunkPosX, int chunkPosZ, EDhApiDistantGeneratorMode generatorMode) This method is called to generate terrain over a given area from a thread defined by Distant Horizons.final 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 whenIDhApiWorldGenerator.getReturnType()returnsEDhApiWorldGeneratorReturnType.API_CHUNKS.abstract Object[]generateChunk(int chunkPosX, int chunkPosZ, EDhApiDistantGeneratorMode generatorMode) This method is called to generate terrain over a given area from a thread defined by Distant Horizons.final 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 whenIDhApiWorldGenerator.getReturnType()returnsEDhApiWorldGeneratorReturnType.VANILLA_CHUNKS.final byteDefines the largest datapoint size that can be generated at a time.final byteDefines the smallest datapoint size that can be generated at a time.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IBindable
finishDelayedSetup, getDelayedSetupCompleteMethods inherited from interface com.seibel.distanthorizons.api.interfaces.override.IDhApiOverrideable
getPriorityMethods inherited from interface com.seibel.distanthorizons.api.interfaces.override.worldGenerator.IDhApiWorldGenerator
close, generateLod, getReturnType, preGeneratorTaskStart, runApiValidation
-
Constructor Details
-
AbstractDhApiChunkWorldGenerator
public AbstractDhApiChunkWorldGenerator()
-
-
Method Details
-
getSmallestDataDetailLevel
public final byte getSmallestDataDetailLevel()Description copied from interface:IDhApiWorldGeneratorDefines 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.- Specified by:
getSmallestDataDetailLevelin interfaceIDhApiWorldGenerator- See Also:
-
getLargestDataDetailLevel
public final byte getLargestDataDetailLevel()Description copied from interface:IDhApiWorldGeneratorDefines 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.- Specified by:
getLargestDataDetailLevelin interfaceIDhApiWorldGenerator- See Also:
-
generateChunks
public final CompletableFuture<Void> generateChunks(int chunkPosMinX, int chunkPosMinZ, int generationRequestChunkWidthCount, byte targetDataDetail, EDhApiDistantGeneratorMode generatorMode, ExecutorService worldGeneratorThreadPool, Consumer<Object[]> resultConsumer) throws ClassCastException Description copied from interface:IDhApiWorldGeneratorThis method is called by Distant Horizons to generate terrain over a given area whenIDhApiWorldGenerator.getReturnType()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]- Specified by:
generateChunksin interfaceIDhApiWorldGenerator- 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. SeeEDhApiDetailLevelfor additional information.generatorMode- how far into the world gen pipeline this method should run. SeeEDhApiDistantGeneratorModefor 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.
- Throws:
ClassCastException
-
generateApiChunks
public final CompletableFuture<Void> generateApiChunks(int chunkPosMinX, int chunkPosMinZ, int generationRequestChunkWidthCount, byte targetDataDetail, EDhApiDistantGeneratorMode generatorMode, ExecutorService worldGeneratorThreadPool, Consumer<DhApiChunk> resultConsumer) Description copied from interface:IDhApiWorldGeneratorThis method is called by Distant Horizons to generate terrain over a given area whenIDhApiWorldGenerator.getReturnType()returnsEDhApiWorldGeneratorReturnType.API_CHUNKS.
After theDhApiChunkhas been generated, it should be passed into the resultConsumer'sConsumer.accept(Object)method. Note: if air blocks aren't included in the with theDhApiChunkwith proper lighting, lower detail levels will appear as black/unlit.- Specified by:
generateApiChunksin interfaceIDhApiWorldGenerator- 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. SeeEDhApiDetailLevelfor additional information.generatorMode- how far into the world gen pipeline this method should run. SeeEDhApiDistantGeneratorModefor 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.
-
generateChunk
public abstract Object[] generateChunk(int chunkPosX, int chunkPosZ, EDhApiDistantGeneratorMode generatorMode) This method is called to generate terrain over a given area from a thread defined by Distant Horizons.- Parameters:
chunkPosX- the chunk X position in the level (not to be confused with the chunk's BlockPos in the level)chunkPosZ- the chunk Z position in the level (not to be confused with the chunk's BlockPos in the level)generatorMode- how far into the world gen pipeline this method should run. SeeEDhApiDistantGeneratorModefor additional documentation.- Returns:
- See
IDhApiWorldGenerator.generateChunksfor the list of Object's this method should return along with additional documentation. - See Also:
-
generateApiChunk
public abstract DhApiChunk generateApiChunk(int chunkPosX, int chunkPosZ, EDhApiDistantGeneratorMode generatorMode) This method is called to generate terrain over a given area from a thread defined by Distant Horizons.- Parameters:
chunkPosX- the chunk X position in the level (not to be confused with the chunk's BlockPos in the level)chunkPosZ- the chunk Z position in the level (not to be confused with the chunk's BlockPos in the level)generatorMode- how far into the world gen pipeline this method should run. SeeEDhApiDistantGeneratorModefor additional documentation.- Returns:
- A
DhApiChunkwith the generatedDhApiTerrainDataPointincluding air blocks. Note: if air blocks aren't included with the proper lighting, lower detail levels will appear as black/unlit. - Since:
- API 3.0.0
- See Also:
-