diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-03-31 18:22:35 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-03-31 18:22:35 +0200 |
commit | 394933fc47c834632a66b89fdc0548af43337771 (patch) | |
tree | 77dcf7f7a54291f148f3ecc003c97bb27ccab39c /source/Generating | |
parent | MineShafts: Set the default GridSize to 256 (diff) | |
download | cuberite-394933fc47c834632a66b89fdc0548af43337771.tar cuberite-394933fc47c834632a66b89fdc0548af43337771.tar.gz cuberite-394933fc47c834632a66b89fdc0548af43337771.tar.bz2 cuberite-394933fc47c834632a66b89fdc0548af43337771.tar.lz cuberite-394933fc47c834632a66b89fdc0548af43337771.tar.xz cuberite-394933fc47c834632a66b89fdc0548af43337771.tar.zst cuberite-394933fc47c834632a66b89fdc0548af43337771.zip |
Diffstat (limited to '')
-rw-r--r-- | source/Generating/ChunkDesc.cpp | 39 | ||||
-rw-r--r-- | source/Generating/ChunkDesc.h | 22 |
2 files changed, 61 insertions, 0 deletions
diff --git a/source/Generating/ChunkDesc.cpp b/source/Generating/ChunkDesc.cpp index bd1abdeaa..81e6851a4 100644 --- a/source/Generating/ChunkDesc.cpp +++ b/source/Generating/ChunkDesc.cpp @@ -450,6 +450,45 @@ void cChunkDesc::ReplaceRelCuboid( +void cChunkDesc::FloorRelCuboid(
+ int a_MinX, int a_MaxX,
+ int a_MinY, int a_MaxY,
+ int a_MinZ, int a_MaxZ,
+ BLOCKTYPE a_DstType, NIBBLETYPE a_DstMeta
+)
+{
+ int MinX = std::max(a_MinX, 0);
+ int MinY = std::max(a_MinY, 0);
+ int MinZ = std::max(a_MinZ, 0);
+ int MaxX = std::min(a_MaxX, cChunkDef::Width - 1);
+ int MaxY = std::min(a_MaxY, cChunkDef::Height - 1);
+ int MaxZ = std::min(a_MaxZ, cChunkDef::Width - 1);
+
+ for (int y = MinY; y <= MaxY; y++)
+ {
+ for (int z = MinZ; z <= MaxZ; z++)
+ {
+ for (int x = MinX; x <= MaxX; x++)
+ {
+ switch (GetBlockType(x, y, z))
+ {
+ case E_BLOCK_AIR:
+ case E_BLOCK_WATER:
+ case E_BLOCK_STATIONARY_WATER:
+ {
+ SetBlockTypeMeta(x, y, z, a_DstType, a_DstMeta);
+ break;
+ }
+ } // switch (GetBlockType)
+ } // for x
+ } // for z
+ } // for y
+}
+
+
+
+
+
void cChunkDesc::CompressBlockMetas(cChunkDef::BlockNibbles & a_DestMetas)
{
const NIBBLETYPE * AreaMetas = m_BlockArea.GetBlockMetas();
diff --git a/source/Generating/ChunkDesc.h b/source/Generating/ChunkDesc.h index a73a175a3..a18b26142 100644 --- a/source/Generating/ChunkDesc.h +++ b/source/Generating/ChunkDesc.h @@ -121,6 +121,28 @@ public: ); } + /// Replaces the blocks in the cuboid by the dst blocks if they are considered non-floor (air, water); allows cuboid out of range of this chunk + void FloorRelCuboid( + int a_MinX, int a_MaxX, + int a_MinY, int a_MaxY, + int a_MinZ, int a_MaxZ, + BLOCKTYPE a_DstType, NIBBLETYPE a_DstMeta + ); + + /// Replaces the blocks in the cuboid by the dst blocks if they are considered non-floor (air, water); allows cuboid out of range of this chunk + void FloorRelCuboid( + const cCuboid & a_RelCuboid, + BLOCKTYPE a_DstType, NIBBLETYPE a_DstMeta + ) + { + FloorRelCuboid( + a_RelCuboid.p1.x, a_RelCuboid.p2.x, + a_RelCuboid.p1.y, a_RelCuboid.p2.y, + a_RelCuboid.p1.z, a_RelCuboid.p2.z, + a_DstType, a_DstMeta + ); + } + // tolua_end |