1
0

Merge pull request #1301 from mc-server/Ores

Ore Tweaks
This commit is contained in:
Mattes D 2014-08-11 12:10:20 +02:00
commit 54cf69a634
3 changed files with 120 additions and 53 deletions

View File

@ -387,6 +387,28 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
m_FinishGens.push_back(new cFinishGenSingleTopBlock(Seed, E_BLOCK_LILY_PAD, AllowedBiomes, 4, AllowedBlocks));
}
else if (NoCaseCompare(*itr, "NaturalPatches") == 0)
{
cStructGenOreNests::OreList Ores;
// Dirt vein
cStructGenOreNests::OreInfo DirtVein;
DirtVein.BlockType = E_BLOCK_DIRT;
DirtVein.MaxHeight = 127;
DirtVein.NumNests = 20;
DirtVein.NestSize = 32;
Ores.push_back(DirtVein);
// Gravel vein
cStructGenOreNests::OreInfo GravelVein;
GravelVein.BlockType = E_BLOCK_DIRT;
GravelVein.MaxHeight = 127;
GravelVein.NumNests = 20;
GravelVein.NestSize = 32;
Ores.push_back(GravelVein);
m_FinishGens.push_back(new cStructGenOreNests(Seed, Ores, E_BLOCK_STONE));
}
else if (NoCaseCompare(*itr, "NetherClumpFoliage") == 0)
{
m_FinishGens.push_back(new cFinishGenNetherClumpFoliage(Seed));
@ -398,9 +420,74 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
int MaxDepth = a_IniFile.GetValueSetI("Generator", "NetherFortsMaxDepth", 12);
m_FinishGens.push_back(new cNetherFortGen(Seed, GridSize, MaxOffset, MaxDepth));
}
else if (NoCaseCompare(*itr, "NetherOreNests") == 0)
{
cStructGenOreNests::OreList Ores;
// Quartz vein
cStructGenOreNests::OreInfo QuartzVein;
QuartzVein.BlockType = E_BLOCK_NETHER_QUARTZ_ORE;
QuartzVein.MaxHeight = 255;
QuartzVein.NumNests = 80;
QuartzVein.NestSize = 8;
Ores.push_back(QuartzVein);
m_FinishGens.push_back(new cStructGenOreNests(Seed, Ores, E_BLOCK_NETHERRACK));
}
else if (NoCaseCompare(*itr, "OreNests") == 0)
{
m_FinishGens.push_back(new cStructGenOreNests(Seed));
cStructGenOreNests::OreList Ores;
// Coal vein
cStructGenOreNests::OreInfo CoalVein;
CoalVein.BlockType = E_BLOCK_COAL_ORE;
CoalVein.MaxHeight = 127;
CoalVein.NumNests = 50;
CoalVein.NestSize = 10;
Ores.push_back(CoalVein);
// Iron vein
cStructGenOreNests::OreInfo IronVein;
IronVein.BlockType = E_BLOCK_IRON_ORE;
IronVein.MaxHeight = 64;
IronVein.NumNests = 14;
IronVein.NestSize = 6;
Ores.push_back(IronVein);
// Gold vein
cStructGenOreNests::OreInfo GoldVein;
GoldVein.BlockType = E_BLOCK_GOLD_ORE;
GoldVein.MaxHeight = 32;
GoldVein.NumNests = 2;
GoldVein.NestSize = 6;
Ores.push_back(GoldVein);
// Redstone vein
cStructGenOreNests::OreInfo RedstoneVein;
RedstoneVein.BlockType = E_BLOCK_REDSTONE_ORE;
RedstoneVein.MaxHeight = 16;
RedstoneVein.NumNests = 4;
RedstoneVein.NestSize = 6;
Ores.push_back(RedstoneVein);
// Lapis vein
cStructGenOreNests::OreInfo LapisVein;
LapisVein.BlockType = E_BLOCK_LAPIS_ORE;
LapisVein.MaxHeight = 30;
LapisVein.NumNests = 2;
LapisVein.NestSize = 5;
Ores.push_back(LapisVein);
// Diamond vein
cStructGenOreNests::OreInfo DiamondVein;
DiamondVein.BlockType = E_BLOCK_DIAMOND_ORE;
DiamondVein.MaxHeight = 15;
DiamondVein.NumNests = 1;
DiamondVein.NestSize = 4;
Ores.push_back(DiamondVein);
m_FinishGens.push_back(new cStructGenOreNests(Seed, Ores, E_BLOCK_STONE));
}
else if (NoCaseCompare(*itr, "POCPieces") == 0)
{

View File

@ -12,45 +12,6 @@
////////////////////////////////////////////////////////////////////////////////
// cStructGenOreNests configuration:
const int MAX_HEIGHT_COAL = 127;
const int NUM_NESTS_COAL = 50;
const int NEST_SIZE_COAL = 10;
const int MAX_HEIGHT_IRON = 64;
const int NUM_NESTS_IRON = 14;
const int NEST_SIZE_IRON = 6;
const int MAX_HEIGHT_REDSTONE = 16;
const int NUM_NESTS_REDSTONE = 4;
const int NEST_SIZE_REDSTONE = 6;
const int MAX_HEIGHT_GOLD = 32;
const int NUM_NESTS_GOLD = 2;
const int NEST_SIZE_GOLD = 6;
const int MAX_HEIGHT_DIAMOND = 15;
const int NUM_NESTS_DIAMOND = 1;
const int NEST_SIZE_DIAMOND = 4;
const int MAX_HEIGHT_LAPIS = 30;
const int NUM_NESTS_LAPIS = 2;
const int NEST_SIZE_LAPIS = 5;
const int MAX_HEIGHT_DIRT = 127;
const int NUM_NESTS_DIRT = 20;
const int NEST_SIZE_DIRT = 32;
const int MAX_HEIGHT_GRAVEL = 70;
const int NUM_NESTS_GRAVEL = 15;
const int NEST_SIZE_GRAVEL = 32;
////////////////////////////////////////////////////////////////////////////////
// cStructGenTrees:
@ -311,14 +272,15 @@ void cStructGenOreNests::GenFinish(cChunkDesc & a_ChunkDesc)
int ChunkX = a_ChunkDesc.GetChunkX();
int ChunkZ = a_ChunkDesc.GetChunkZ();
cChunkDef::BlockTypes & BlockTypes = a_ChunkDesc.GetBlockTypes();
GenerateOre(ChunkX, ChunkZ, E_BLOCK_COAL_ORE, MAX_HEIGHT_COAL, NUM_NESTS_COAL, NEST_SIZE_COAL, BlockTypes, 1);
GenerateOre(ChunkX, ChunkZ, E_BLOCK_IRON_ORE, MAX_HEIGHT_IRON, NUM_NESTS_IRON, NEST_SIZE_IRON, BlockTypes, 2);
GenerateOre(ChunkX, ChunkZ, E_BLOCK_REDSTONE_ORE, MAX_HEIGHT_REDSTONE, NUM_NESTS_REDSTONE, NEST_SIZE_REDSTONE, BlockTypes, 3);
GenerateOre(ChunkX, ChunkZ, E_BLOCK_GOLD_ORE, MAX_HEIGHT_GOLD, NUM_NESTS_GOLD, NEST_SIZE_GOLD, BlockTypes, 4);
GenerateOre(ChunkX, ChunkZ, E_BLOCK_DIAMOND_ORE, MAX_HEIGHT_DIAMOND, NUM_NESTS_DIAMOND, NEST_SIZE_DIAMOND, BlockTypes, 5);
GenerateOre(ChunkX, ChunkZ, E_BLOCK_LAPIS_ORE, MAX_HEIGHT_LAPIS, NUM_NESTS_LAPIS, NEST_SIZE_LAPIS, BlockTypes, 6);
GenerateOre(ChunkX, ChunkZ, E_BLOCK_DIRT, MAX_HEIGHT_DIRT, NUM_NESTS_DIRT, NEST_SIZE_DIRT, BlockTypes, 10);
GenerateOre(ChunkX, ChunkZ, E_BLOCK_GRAVEL, MAX_HEIGHT_GRAVEL, NUM_NESTS_GRAVEL, NEST_SIZE_GRAVEL, BlockTypes, 11);
int seq = 1;
// Generate the ores from the ore list.
for (OreList::const_iterator itr = m_OreList.begin(); itr != m_OreList.end(); ++itr)
{
GenerateOre(ChunkX, ChunkZ, itr->BlockType, itr->MaxHeight, itr->NumNests, itr->NestSize, BlockTypes, seq);
seq++;
}
}
@ -376,7 +338,7 @@ void cStructGenOreNests::GenerateOre(int a_ChunkX, int a_ChunkZ, BLOCKTYPE a_Ore
}
int Index = cChunkDef::MakeIndexNoCheck(BlockX, BlockY, BlockZ);
if (a_BlockTypes[Index] == E_BLOCK_STONE)
if (a_BlockTypes[Index] == m_ToReplace)
{
a_BlockTypes[Index] = a_OreType;
}

View File

@ -76,11 +76,29 @@ class cStructGenOreNests :
public cFinishGen
{
public:
cStructGenOreNests(int a_Seed) : m_Noise(a_Seed), m_Seed(a_Seed) {}
struct OreInfo
{
BLOCKTYPE BlockType; // The type of the nest.
int MaxHeight; // The highest possible a nest can occur
int NumNests; // How many nests per chunk
int NestSize; // The amount of blocks a nest can have.
};
typedef std::vector<OreInfo> OreList;
cStructGenOreNests(int a_Seed, OreList a_OreList, BLOCKTYPE a_ToReplace) :
m_Noise(a_Seed),
m_Seed(a_Seed),
m_OreList(a_OreList),
m_ToReplace(a_ToReplace)
{}
protected:
cNoise m_Noise;
int m_Seed;
cNoise m_Noise;
int m_Seed;
OreList m_OreList; // A list of possible ores.
BLOCKTYPE m_ToReplace;
// cFinishGen override:
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;