summaryrefslogtreecommitdiffstats
path: root/source/Generating/ChunkDesc.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-31 21:05:41 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-31 21:05:41 +0200
commit41e0927843a8060fc381e7695faf4cf8d3c875e6 (patch)
tree4eaf4693230410109dc89cefc14c7dc580137c2c /source/Generating/ChunkDesc.cpp
parentMineShafts: Limited the mineshafts generation into a settable-size cuboid (diff)
downloadcuberite-41e0927843a8060fc381e7695faf4cf8d3c875e6.tar
cuberite-41e0927843a8060fc381e7695faf4cf8d3c875e6.tar.gz
cuberite-41e0927843a8060fc381e7695faf4cf8d3c875e6.tar.bz2
cuberite-41e0927843a8060fc381e7695faf4cf8d3c875e6.tar.lz
cuberite-41e0927843a8060fc381e7695faf4cf8d3c875e6.tar.xz
cuberite-41e0927843a8060fc381e7695faf4cf8d3c875e6.tar.zst
cuberite-41e0927843a8060fc381e7695faf4cf8d3c875e6.zip
Diffstat (limited to '')
-rw-r--r--source/Generating/ChunkDesc.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/source/Generating/ChunkDesc.cpp b/source/Generating/ChunkDesc.cpp
index 81e6851a4..f0927f294 100644
--- a/source/Generating/ChunkDesc.cpp
+++ b/source/Generating/ChunkDesc.cpp
@@ -7,6 +7,7 @@
#include "ChunkDesc.h"
#include "../BlockArea.h"
#include "../Cuboid.h"
+#include "../Noise.h"
@@ -489,6 +490,42 @@ void cChunkDesc::FloorRelCuboid(
+void cChunkDesc::RandomFillRelCuboid(
+ int a_MinX, int a_MaxX,
+ int a_MinY, int a_MaxY,
+ int a_MinZ, int a_MaxZ,
+ BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta,
+ int a_RandomSeed, int a_ChanceOutOf10k
+)
+{
+ cNoise Noise(a_RandomSeed);
+ 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++)
+ {
+ int rnd = (Noise.IntNoise3DInt(x, y, z) / 7) % 10000;
+ if (rnd <= a_ChanceOutOf10k)
+ {
+ SetBlockTypeMeta(x, y, z, a_BlockType, a_BlockMeta);
+ }
+ }
+ } // for z
+ } // for y
+}
+
+
+
+
+
void cChunkDesc::CompressBlockMetas(cChunkDef::BlockNibbles & a_DestMetas)
{
const NIBBLETYPE * AreaMetas = m_BlockArea.GetBlockMetas();