mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-17 20:10:23 +03:00
* More improvements to the world generator!!
This commit is contained in:
@@ -24,7 +24,7 @@ Biome
|
||||
|
||||
Biome* Biome::map[4096];
|
||||
|
||||
Biome* Biome::_getBiome(float hum, float temp)
|
||||
Biome* Biome::_getBiome(float temp, float hum)
|
||||
{
|
||||
if (temp < 0.1)
|
||||
return tundra;
|
||||
|
||||
@@ -86,3 +86,9 @@ private:
|
||||
int m_count;
|
||||
};
|
||||
|
||||
class ReedsFeature : public Feature
|
||||
{
|
||||
public:
|
||||
bool place(Level*, Random*, int x, int y, int z) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -486,6 +486,14 @@ void RandomLevelSource::postProcess(ChunkSource* src, int x, int z)
|
||||
FlowerFeature(Tile::mushroom2->m_ID).place(m_pLevel, &m_random, x16 + 8 + xo, yo, z16 + 8 + zo);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
int xo = m_random.nextInt(16);
|
||||
int yo = m_random.nextInt(128);
|
||||
int zo = m_random.nextInt(16);
|
||||
ReedsFeature().place(m_pLevel, &m_random, x16 + 8 + xo, yo, z16 + 8 + zo);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 50; i++)
|
||||
{
|
||||
int xo = m_random.nextInt(16);
|
||||
|
||||
39
source/World/Generator/ReedsFeature.cpp
Normal file
39
source/World/Generator/ReedsFeature.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
/********************************************************************
|
||||
Minecraft: Pocket Edition - Decompilation Project
|
||||
Copyright (C) 2023 iProgramInCpp
|
||||
|
||||
The following code is licensed under the BSD 1 clause license.
|
||||
SPDX-License-Identifier: BSD-1-Clause
|
||||
********************************************************************/
|
||||
|
||||
#include "Feature.hpp"
|
||||
#include "Level.hpp"
|
||||
|
||||
bool ReedsFeature::place(Level* level, Random* random, int x, int y, int z)
|
||||
{
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
int newX = (x + random->nextInt(4)) - random->nextInt(4);
|
||||
int newZ = (z + random->nextInt(4)) - random->nextInt(4);
|
||||
|
||||
if (!level->isEmptyTile(newX, y, newZ))
|
||||
continue;
|
||||
|
||||
if (level->getMaterial(newX - 1, y - 1, newZ) == Material::water ||
|
||||
level->getMaterial(newX + 1, y - 1, newZ) == Material::water ||
|
||||
level->getMaterial(newX, y - 1, newZ - 1) == Material::water ||
|
||||
level->getMaterial(newX, y - 1, newZ + 1) == Material::water)
|
||||
{
|
||||
int height = random->nextInt(random->nextInt(3) + 1) + 2;
|
||||
for (int y1 = 0; y1 < height; y1++)
|
||||
{
|
||||
if (Tile::reeds->canSurvive(level, newX, y + y1, newZ))
|
||||
{
|
||||
level->setTileNoUpdate(newX, y + y1, newZ, Tile::reeds->m_ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -437,6 +437,7 @@
|
||||
<ClCompile Include="..\source\World\Generator\PerformanceTestChunkSource.cpp" />
|
||||
<ClCompile Include="..\source\World\Generator\PineFeature.cpp" />
|
||||
<ClCompile Include="..\source\World\Generator\RandomLevelSource.cpp" />
|
||||
<ClCompile Include="..\source\World\Generator\ReedsFeature.cpp" />
|
||||
<ClCompile Include="..\source\World\Generator\SpringFeature.cpp" />
|
||||
<ClCompile Include="..\source\World\Generator\SpruceFeature.cpp" />
|
||||
<ClCompile Include="..\source\World\Generator\TestChunkSource.cpp" />
|
||||
|
||||
@@ -1089,6 +1089,9 @@
|
||||
<ClCompile Include="..\source\GameMode\SurvivalMode.cpp">
|
||||
<Filter>Source Files\Game Modes</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\World\Generator\ReedsFeature.cpp">
|
||||
<Filter>Source Files\World\Generator\Features</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\source\Options.hpp">
|
||||
|
||||
Reference in New Issue
Block a user