From ca8421fe26f8dcd83fb66cdca0cdef5a5503b54a Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Wed, 8 Jan 2014 15:26:43 +0100 Subject: [PATCH 1/5] NetherGen: Now generates SoulSand. --- src/Generating/CompoGen.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Generating/CompoGen.cpp b/src/Generating/CompoGen.cpp index f929ddc2f..9c67170d8 100644 --- a/src/Generating/CompoGen.cpp +++ b/src/Generating/CompoGen.cpp @@ -589,7 +589,17 @@ void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc) for (int y = 0; y < SEGMENT_HEIGHT; y++) { int Val = Lo + (Hi - Lo) * y / SEGMENT_HEIGHT; - a_ChunkDesc.SetBlockType(x, y + Segment, z, (Val < m_Threshold) ? E_BLOCK_NETHERRACK : E_BLOCK_AIR); + NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(BaseX * cChunkDef::Width + x)) / 8; + NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)(BaseZ * cChunkDef::Width + z)) / 8; + NOISE_DATATYPE CompBlock = m_Noise1.CubicNoise3D(NoiseX, (float) y, NoiseY); + if (CompBlock < -0.5) + { + a_ChunkDesc.SetBlockType(x, y + Segment, z, (Val < m_Threshold) ? E_BLOCK_SOULSAND : E_BLOCK_AIR); + } + else + { + a_ChunkDesc.SetBlockType(x, y + Segment, z, (Val < m_Threshold) ? E_BLOCK_NETHERRACK : E_BLOCK_AIR); + } } } From 5aa34cf77d3687442f148ffbb325e61a8f6ed249 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Wed, 8 Jan 2014 15:34:49 +0100 Subject: [PATCH 2/5] WormNestCaves now remove soul sand. --- src/Generating/Caves.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Generating/Caves.cpp b/src/Generating/Caves.cpp index c94113f5c..2571e6b77 100644 --- a/src/Generating/Caves.cpp +++ b/src/Generating/Caves.cpp @@ -509,6 +509,7 @@ void cCaveTunnel::ProcessChunk( case E_BLOCK_GRAVEL: case E_BLOCK_SAND: case E_BLOCK_SANDSTONE: + case E_BLOCK_SOULSAND: case E_BLOCK_NETHERRACK: case E_BLOCK_COAL_ORE: case E_BLOCK_IRON_ORE: From d46208510870039a4e4870781ca88d0c80a00e32 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Wed, 8 Jan 2014 22:23:26 +0100 Subject: [PATCH 3/5] Speed-up. I got about 40 extra ch/s --- src/Generating/CompoGen.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Generating/CompoGen.cpp b/src/Generating/CompoGen.cpp index 9c67170d8..3545863fe 100644 --- a/src/Generating/CompoGen.cpp +++ b/src/Generating/CompoGen.cpp @@ -589,17 +589,22 @@ void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc) for (int y = 0; y < SEGMENT_HEIGHT; y++) { int Val = Lo + (Hi - Lo) * y / SEGMENT_HEIGHT; - NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(BaseX * cChunkDef::Width + x)) / 8; - NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)(BaseZ * cChunkDef::Width + z)) / 8; - NOISE_DATATYPE CompBlock = m_Noise1.CubicNoise3D(NoiseX, (float) y, NoiseY); - if (CompBlock < -0.5) + BLOCKTYPE Block = E_BLOCK_AIR; + if (Val < m_Threshold) // Don't calculate if the block should be Netherrack or Soulsand when it's already decided that it's air. { - a_ChunkDesc.SetBlockType(x, y + Segment, z, (Val < m_Threshold) ? E_BLOCK_SOULSAND : E_BLOCK_AIR); - } - else - { - a_ChunkDesc.SetBlockType(x, y + Segment, z, (Val < m_Threshold) ? E_BLOCK_NETHERRACK : E_BLOCK_AIR); + NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(BaseX * cChunkDef::Width + x)) / 8; + NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)(BaseZ * cChunkDef::Width + z)) / 8; + NOISE_DATATYPE CompBlock = m_Noise1.CubicNoise3D(NoiseX, (float) y, NoiseY); + if (CompBlock < -0.5) + { + Block = E_BLOCK_SOULSAND; + } + else + { + Block = E_BLOCK_NETHERRACK; + } } + a_ChunkDesc.SetBlockType(x, y + Segment, z, Block); } } From 6c75cbc8d75b5a2ba9ee071740edd43efeaac1e9 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Thu, 9 Jan 2014 13:30:04 +0100 Subject: [PATCH 4/5] Fixed chunk borders. --- src/Generating/CompoGen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Generating/CompoGen.cpp b/src/Generating/CompoGen.cpp index 3545863fe..8d6c918ca 100644 --- a/src/Generating/CompoGen.cpp +++ b/src/Generating/CompoGen.cpp @@ -592,9 +592,9 @@ void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc) BLOCKTYPE Block = E_BLOCK_AIR; if (Val < m_Threshold) // Don't calculate if the block should be Netherrack or Soulsand when it's already decided that it's air. { - NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(BaseX * cChunkDef::Width + x)) / 8; - NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)(BaseZ * cChunkDef::Width + z)) / 8; - NOISE_DATATYPE CompBlock = m_Noise1.CubicNoise3D(NoiseX, (float) y, NoiseY); + NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(BaseX + x)) / 8; + NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)(BaseZ + z)) / 8; + NOISE_DATATYPE CompBlock = m_Noise1.CubicNoise3D(NoiseX, (float) y / 2, NoiseY); if (CompBlock < -0.5) { Block = E_BLOCK_SOULSAND; From 36c100a53ed70c38d304c3d2837940e699e9f2a1 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Fri, 10 Jan 2014 16:12:45 +0100 Subject: [PATCH 5/5] Fixed recurring pattern. --- src/Generating/CompoGen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generating/CompoGen.cpp b/src/Generating/CompoGen.cpp index 8d6c918ca..60356fe46 100644 --- a/src/Generating/CompoGen.cpp +++ b/src/Generating/CompoGen.cpp @@ -594,7 +594,7 @@ void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc) { NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(BaseX + x)) / 8; NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)(BaseZ + z)) / 8; - NOISE_DATATYPE CompBlock = m_Noise1.CubicNoise3D(NoiseX, (float) y / 2, NoiseY); + NOISE_DATATYPE CompBlock = m_Noise1.CubicNoise3D(NoiseX, (float) (y + Segment) / 2, NoiseY); if (CompBlock < -0.5) { Block = E_BLOCK_SOULSAND;