summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSTRWarrior <niels.breuker@hotmail.nl>2014-01-10 16:31:45 +0100
committerSTRWarrior <niels.breuker@hotmail.nl>2014-01-10 16:31:45 +0100
commit82a06725bddd18e88db59afac65435bf3079a26b (patch)
tree245c189bd92e2bac6198813e5309b3d21465a252 /src
parentFixed recurring pattern. (diff)
downloadcuberite-82a06725bddd18e88db59afac65435bf3079a26b.tar
cuberite-82a06725bddd18e88db59afac65435bf3079a26b.tar.gz
cuberite-82a06725bddd18e88db59afac65435bf3079a26b.tar.bz2
cuberite-82a06725bddd18e88db59afac65435bf3079a26b.tar.lz
cuberite-82a06725bddd18e88db59afac65435bf3079a26b.tar.xz
cuberite-82a06725bddd18e88db59afac65435bf3079a26b.tar.zst
cuberite-82a06725bddd18e88db59afac65435bf3079a26b.zip
Diffstat (limited to 'src')
-rw-r--r--src/Generating/ComposableGenerator.cpp8
-rw-r--r--src/Generating/FinishGen.cpp45
-rw-r--r--src/Generating/FinishGen.h22
3 files changed, 73 insertions, 2 deletions
diff --git a/src/Generating/ComposableGenerator.cpp b/src/Generating/ComposableGenerator.cpp
index c86568c95..0c082bdfe 100644
--- a/src/Generating/ComposableGenerator.cpp
+++ b/src/Generating/ComposableGenerator.cpp
@@ -402,9 +402,9 @@ void cComposableGenerator::InitStructureGens(cIniFile & a_IniFile)
void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
{
int Seed = m_ChunkGenerator.GetSeed();
- AString Structures = a_IniFile.GetValueSet("Generator", "Finishers", "SprinkleFoliage,Ice,Snow,Lilypads,BottomLava,DeadBushes,PreSimulator");
+ AString Finishers = a_IniFile.GetValueSet("Generator", "Finishers", "SprinkleFoliage,Ice,Snow,Lilypads,BottomLava,DeadBushes,PreSimulator");
- AStringVector Str = StringSplitAndTrim(Structures, ",");
+ AStringVector Str = StringSplitAndTrim(Finishers, ",");
for (AStringVector::const_iterator itr = Str.begin(); itr != Str.end(); ++itr)
{
// Finishers, alpha-sorted:
@@ -442,6 +442,10 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
{
m_FinishGens.push_back(new cFinishGenSprinkleFoliage(Seed));
}
+ else if (NoCaseCompare(*itr, "NetherSprinkleFoliage") == 0)
+ {
+ m_FinishGens.push_back(new cFinishGenNetherSprinkleFoliage(Seed));
+ }
else if (NoCaseCompare(*itr, "WaterSprings") == 0)
{
m_FinishGens.push_back(new cFinishGenFluidSprings(Seed, E_BLOCK_WATER, a_IniFile, *m_World));
diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp
index 145fe22e0..8c05b2135 100644
--- a/src/Generating/FinishGen.cpp
+++ b/src/Generating/FinishGen.cpp
@@ -40,6 +40,51 @@ static inline bool IsWater(BLOCKTYPE a_BlockType)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cFinishGenNetherSprinkleFoliage:
+
+void cFinishGenNetherSprinkleFoliage::GenFinish(cChunkDesc & a_ChunkDesc)
+{
+ double ChunkX = a_ChunkDesc.GetChunkX() + 0.5; // We can't devide through 0 so lets add 0.5 to all the chunk coordinates.
+ double ChunkZ = a_ChunkDesc.GetChunkZ() + 0.5;
+
+ for (int z = 0; z < cChunkDef::Width; z++)
+ {
+ for (int x = 0; x < cChunkDef::Width; x++)
+ {
+ for (int y = 1; y < cChunkDef::Height; y++)
+ {
+ if (!g_BlockIsSolid[a_ChunkDesc.GetBlockType(x, y - 1, z)]) // Only place on solid blocks
+ {
+ continue;
+ }
+ if (a_ChunkDesc.GetBlockType(x, y, z) != E_BLOCK_AIR)
+ {
+ continue;
+ }
+
+ NOISE_DATATYPE Val = m_Noise.CubicNoise1D((float) ((ChunkX * x) * (ChunkZ * z) * y));
+ if (Val < -0.98)
+ {
+ a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_BROWN_MUSHROOM);
+ }
+ else if (Val < -0.96)
+ {
+ a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_RED_MUSHROOM);
+ }
+ else if (Val < -0.94)
+ {
+ a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_FIRE);
+ }
+ }
+ }
+ }
+}
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cFinishGenSprinkleFoliage:
bool cFinishGenSprinkleFoliage::TryAddSugarcane(cChunkDesc & a_ChunkDesc, int a_RelX, int a_RelY, int a_RelZ)
diff --git a/src/Generating/FinishGen.h b/src/Generating/FinishGen.h
index ed7df5909..e6007a174 100644
--- a/src/Generating/FinishGen.h
+++ b/src/Generating/FinishGen.h
@@ -47,6 +47,27 @@ protected:
+class cFinishGenNetherSprinkleFoliage :
+ public cFinishGen
+{
+public:
+ cFinishGenNetherSprinkleFoliage(int a_Seed) :
+ m_Noise(a_Seed),
+ m_Seed(a_Seed)
+ {
+ }
+
+protected:
+ cNoise m_Noise;
+ int m_Seed;
+
+ virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
+} ;
+
+
+
+
+
class cFinishGenSprinkleFoliage :
public cFinishGen
{
@@ -117,6 +138,7 @@ public:
{
}
+ int GetLevel(void) const { return m_Level; }
protected:
int m_Level;