Create the outline for the TerrainDataApi methods and objects

This commit is contained in:
James Seibel
2022-07-11 22:14:14 -05:00
parent 6629ec9dc0
commit 32747baadf
5 changed files with 130 additions and 1 deletions
@@ -1 +1 @@
The data api package holds objects and methods for getting/setting terrain data stored by Distant Horizons.
The data api package holds objects and methods for getting/setting data stored by Distant Horizons.
@@ -0,0 +1,76 @@
package com.seibel.lod.core.api.external.data;
import com.seibel.lod.core.api.external.data.objects.TerrainDataPoint;
import com.seibel.lod.core.api.external.sharedObjects.DhApiResult;
/**
* Allows getting and setting any data Distant Horizons has stored.
*
* TODO once 1.7's data refactor is complete ask Leetom and/or Leonardo for help on setting these up
*
* @author James Seibel
* @version 2022-7-11
*/
public class TerrainDataApi
{
/**
* Returns the terrain data at the given block position.
* Null if the position hasn't been generated.
*/
public static TerrainDataPoint getDataAtBlockPos(int blockPosX, int blockPosY, int blockPosZ)
{
throw new UnsupportedOperationException();
}
/** Sets the terrain data at the given block position. */
public static DhApiResult setDataAtBlockPos(int blockPosX, int blockPosY, int blockPosZ, TerrainDataPoint newData)
{
throw new UnsupportedOperationException();
}
/**
* Returns the average color for the chunk at the given chunk position.
* Returns null if the position hasn't been generated.
*/
public static TerrainDataPoint getDataAtChunkPos(int chunkPosX, int chunkPosZ)
{
throw new UnsupportedOperationException();
}
/** Sets the terrain data at the given chunk position. */
public static DhApiResult setDataAtChunkPos(int chunkPosX, int chunkPosZ, TerrainDataPoint newData)
{
throw new UnsupportedOperationException();
}
/**
* Returns the average color for the chunk at the given chunk position.
* May return inaccurate data if the whole region hasn't been generated yet.
* Returns null if the position hasn't been generated.
*/
public static TerrainDataPoint getDataAtRegionPos(int regionPosX, int regionPosZ)
{
throw new UnsupportedOperationException();
}
/** Sets the terrain data at the given chunk position. */
public static DhApiResult setDataAtRegionPos(int regionPosX, int regionPosZ, TerrainDataPoint newData)
{
throw new UnsupportedOperationException();
}
/**
* Returns the average color for the chunk at the given chunk position.
* May return inaccurate data if the whole region hasn't been generated yet.
* Returns null if the position hasn't been generated.
*/
public static TerrainDataPoint getDataAtDetailLevelAndPos(short detailLevel, int relativePosX, int relativePosY, int relativePosZ)
{
throw new UnsupportedOperationException();
}
/** Sets the terrain data at the given chunk position. */
public static DhApiResult setDataAtRegionPos(short detailLevel, int relativePosX, int relativePosY, int relativePosZ, TerrainDataPoint newData)
{
throw new UnsupportedOperationException();
}
}
@@ -0,0 +1,29 @@
package com.seibel.lod.core.api.external.data.objects;
import java.awt.Color;
/**
* Holds a single datapoint of terrain data.
*
* // TODO what additional data should this hold?
*
* @author James Seibel
* @version 2022-7-11
*/
public class TerrainDataPoint
{
/**
* The average color for the given data point.
* Invisible if the position is air.
* Null if the position is invalid.
*/
public Color color;
/**
* TODO is this data type correct?
* TODO create a enum that contains useful values (block, chunk, region, etc.)
* 0 = block
*/
public short detailLevel;
}
@@ -0,0 +1,23 @@
package com.seibel.lod.core.api.external.sharedObjects;
/**
* Allows for more descriptive non-critical failure states.
*
* @author James Seibel
* @version 2022-7-11
*/
public class DhApiResult
{
/** True if the action succeeded, false otherwise. */
public final boolean success;
/** If the action failed this contains the reason as to why. */
public final String errorMessage;
public DhApiResult(boolean newSuccess, String newErrorMessage)
{
this.success = newSuccess;
this.errorMessage = newErrorMessage;
}
}
@@ -0,0 +1 @@
the sharedObjects package contains objects used by one or more different api packages.