Interface IDhApiTerrainDataRepo
public interface IDhApiTerrainDataRepo
Used to interface with Distant Horizons' terrain data.
- Since:
- API 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionDhApiResult<DhApiTerrainDataPoint[][][]> getAllTerrainDataAtChunkPos(IDhApiLevelWrapper levelWrapper, int chunkPosX, int chunkPosZ) Returns every datapoint in the given chunk's X and Z position.DhApiResult<DhApiTerrainDataPoint[][][]> getAllTerrainDataAtDetailLevelAndPos(IDhApiLevelWrapper levelWrapper, byte detailLevel, int posX, int posZ) Returns every datapoint in the column located at the given detail level and X/Z position.DhApiResult<DhApiTerrainDataPoint[][][]> getAllTerrainDataAtRegionPos(IDhApiLevelWrapper levelWrapper, int regionPosX, int regionPosZ) Returns every datapoint in the given region's X and Z position.getColumnDataAtBlockPos(IDhApiLevelWrapper levelWrapper, int blockPosX, int blockPosZ) Returns every datapoint in the column located at the given block X and Z position top to bottom.getSingleDataPointAtBlockPos(IDhApiLevelWrapper levelWrapper, int blockPosX, int blockPosY, int blockPosZ) Returns the terrain datapoint at the given block position, at/or containing the given Y position.overwriteChunkDataAsync(IDhApiLevelWrapper levelWrapper, Object[] chunkObjectArray) Sets the LOD data for the given chunk at the chunk's position.raycast(IDhApiLevelWrapper levelWrapper, double rayOriginX, double rayOriginY, double rayOriginZ, float rayDirectionX, float rayDirectionY, float rayDirectionZ, int maxRayBlockLength) Returns the datapoint and position of the LOD at the end of the given ray.
-
Method Details
-
getSingleDataPointAtBlockPos
DhApiResult<DhApiTerrainDataPoint> getSingleDataPointAtBlockPos(IDhApiLevelWrapper levelWrapper, int blockPosX, int blockPosY, int blockPosZ) Returns the terrain datapoint at the given block position, at/or containing the given Y position. -
getColumnDataAtBlockPos
DhApiResult<DhApiTerrainDataPoint[]> getColumnDataAtBlockPos(IDhApiLevelWrapper levelWrapper, int blockPosX, int blockPosZ) Returns every datapoint in the column located at the given block X and Z position top to bottom. -
getAllTerrainDataAtChunkPos
DhApiResult<DhApiTerrainDataPoint[][][]> getAllTerrainDataAtChunkPos(IDhApiLevelWrapper levelWrapper, int chunkPosX, int chunkPosZ) Returns every datapoint in the given chunk's X and Z position.
The returned array is ordered: [relativeBlockX][relativeBlockZ][columnIndex]
RelativeBlockX/Z are relative to the block position closest to negative infinity in the chunk's position.
The column data is ordered from top to bottom. Note: each column may have a different number of values. -
getAllTerrainDataAtRegionPos
DhApiResult<DhApiTerrainDataPoint[][][]> getAllTerrainDataAtRegionPos(IDhApiLevelWrapper levelWrapper, int regionPosX, int regionPosZ) Returns every datapoint in the given region's X and Z position.
The returned array is ordered: [relativeBlockX][relativeBlockZ][columnIndex]
RelativeBlockX/Z are relative to the block position closest to negative infinity in the region's position.
The column data is ordered from top to bottom. Note: each column may have a different number of values. -
getAllTerrainDataAtDetailLevelAndPos
DhApiResult<DhApiTerrainDataPoint[][][]> getAllTerrainDataAtDetailLevelAndPos(IDhApiLevelWrapper levelWrapper, byte detailLevel, int posX, int posZ) Returns every datapoint in the column located at the given detail level and X/Z position.
This can be used to return terrain data for non-standard sizes (IE 2x2 blocks or 2x2 chunks).- Parameters:
detailLevel- a positive byte defining the detail level of the returned data.
Every increase doubles the width of the returned area.
Example values: 0 = block, 1 = 2x2 blocks, 2 = 4x4 blocks, ... 4 = chunk (16x16 blocks), ... 9 = region (512x512 blocks)
SeeEDhApiDetailLevelfor more information.
-
raycast
DhApiResult<DhApiRaycastResult> raycast(IDhApiLevelWrapper levelWrapper, double rayOriginX, double rayOriginY, double rayOriginZ, float rayDirectionX, float rayDirectionY, float rayDirectionZ, int maxRayBlockLength) Returns the datapoint and position of the LOD at the end of the given ray.
Will return "success" with a null datapoint if the ray reaches the max length without finding any data. -
overwriteChunkDataAsync
DhApiResult<Void> overwriteChunkDataAsync(IDhApiLevelWrapper levelWrapper, Object[] chunkObjectArray) throws ClassCastException Sets the LOD data for the given chunk at the chunk's position.
Notes:
- Only works if the givenIDhApiLevelWrapperpoints to a loaded level.
- If the player travels to this chunk, or the chunk is updated in some other way; your data will be replaced by whatever the current chunk is.
- This method may not update the LOD data immediately. Any other chunks have been queued to update, they will be handled first.- Parameters:
levelWrapper- the level wrapper that the chunk should be saved to.chunkObjectArray- seeIDhApiWorldGenerator.generateChunks(int, int, byte, byte, com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiDistantGeneratorMode, java.util.concurrent.ExecutorService, java.util.function.Consumer<java.lang.Object[]>)for what objects are expected.- Throws:
ClassCastException- if chunkObjectArray doesn't contain the right objects. The exception will contain the expected object(s).
-