summaryrefslogtreecommitdiffstats
path: root/src/Generating/ChunkDesc.h
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-11-29 12:05:35 +0100
committerHowaner <franzi.moos@googlemail.com>2014-11-29 12:05:35 +0100
commit648fee1a087cb97da9a4646d72ffc590e7837a67 (patch)
treeeb55b68428a303089bc1120e9c3593542059f18e /src/Generating/ChunkDesc.h
parentFinished mob spawner implementation. (diff)
parentMerge pull request #1619 from mc-server/WarningFixes (diff)
downloadcuberite-648fee1a087cb97da9a4646d72ffc590e7837a67.tar
cuberite-648fee1a087cb97da9a4646d72ffc590e7837a67.tar.gz
cuberite-648fee1a087cb97da9a4646d72ffc590e7837a67.tar.bz2
cuberite-648fee1a087cb97da9a4646d72ffc590e7837a67.tar.lz
cuberite-648fee1a087cb97da9a4646d72ffc590e7837a67.tar.xz
cuberite-648fee1a087cb97da9a4646d72ffc590e7837a67.tar.zst
cuberite-648fee1a087cb97da9a4646d72ffc590e7837a67.zip
Diffstat (limited to 'src/Generating/ChunkDesc.h')
-rw-r--r--src/Generating/ChunkDesc.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/Generating/ChunkDesc.h b/src/Generating/ChunkDesc.h
index 570132790..480106fb5 100644
--- a/src/Generating/ChunkDesc.h
+++ b/src/Generating/ChunkDesc.h
@@ -29,10 +29,17 @@ class cChunkDesc
{
public:
// tolua_end
+
+ /** The datatype used to represent the entire chunk worth of shape.
+ 0 = air
+ 1 = solid
+ Indexed as [y + 256 * x + 256 * 16 * z]. */
+ typedef Byte Shape[256 * 16 * 16];
/** Uncompressed block metas, 1 meta per byte */
typedef NIBBLETYPE BlockNibbleBytes[cChunkDef::NumBlocks];
+
cChunkDesc(int a_ChunkX, int a_ChunkZ);
~cChunkDesc();
@@ -57,10 +64,21 @@ public:
EMCSBiome GetBiome(int a_RelX, int a_RelZ);
// These operate on the heightmap, so they could get out of sync with the data
- // Use UpdateHeightmap() to re-sync
+ // Use UpdateHeightmap() to re-calculate heightmap from the block data
void SetHeight(int a_RelX, int a_RelZ, int a_Height);
int GetHeight(int a_RelX, int a_RelZ);
+ // tolua_end
+
+ /** Sets the heightmap to match the given shape data.
+ Note that this ignores overhangs; the method is mostly used by old composition generators. */
+ void SetHeightFromShape(const Shape & a_Shape);
+
+ /** Sets the shape in a_Shape to match the heightmap stored currently in m_HeightMap. */
+ void GetShapeFromHeight(Shape & a_Shape) const;
+
+ // tolua_begin
+
// Default generation:
void SetUseDefaultBiomes(bool a_bUseDefaultBiomes);
bool IsUsingDefaultBiomes(void) const;
@@ -77,8 +95,11 @@ public:
/** Reads an area from the chunk into a cBlockArea, blocktypes and blockmetas */
void ReadBlockArea(cBlockArea & a_Dest, int a_MinRelX, int a_MaxRelX, int a_MinRelY, int a_MaxRelY, int a_MinRelZ, int a_MaxRelZ);
- /** Returns the maximum height value in the heightmap */
+ /** Returns the maximum height value in the heightmap. */
HEIGHTTYPE GetMaxHeight(void) const;
+
+ /** Returns the minimum height value in the heightmap. */
+ HEIGHTTYPE GetMinHeight(void) const;
/** Fills the relative cuboid with specified block; allows cuboid out of range of this chunk */
void FillRelCuboid(