* Improvements in accuracy of the world generator

* Fix a crash.
This commit is contained in:
iProgramInCpp 2023-08-04 18:35:06 +03:00
parent 06e26862c8
commit 79ec0e6994
3 changed files with 17 additions and 3 deletions

View file

@ -854,6 +854,14 @@ ItemInstance* Minecraft::getSelectedItem()
{
ItemInstance* pInst = m_pLocalPlayer->m_pInventory->getSelectedItem();
if (!pInst)
{
m_CurrItemInstance.m_itemID = -1;
m_CurrItemInstance.m_amount = 999;
m_CurrItemInstance.m_auxValue = 0;
return &m_CurrItemInstance;
}
if (m_pGameMode->isSurvivalType())
return pInst;

View file

@ -114,7 +114,7 @@ Biome::~Biome()
Feature* Biome::getTreeFeature(Random* pRandom)
{
pRandom->genrand_int32(); //! unused result
pRandom->nextInt(10); // unused result
return new TreeFeature;
}
@ -202,7 +202,7 @@ void Biome::initBiomes()
Feature* RainforestBiome::getTreeFeature(Random* pRandom)
{
pRandom->genrand_int32(); //! unused result
pRandom->nextInt(3); // unused result
return new TreeFeature;
}
@ -210,11 +210,15 @@ Feature* RainforestBiome::getTreeFeature(Random* pRandom)
Feature* ForestBiome::getTreeFeature(Random* pRandom)
{
if (pRandom->nextInt(5) == 0)
{
return new BirchFeature;
}
// @NOTE: Here would be code for a big tree with random->nextInt(3).
// But PE doesn't have big trees
pRandom->nextInt(3);
return new TreeFeature;
}

View file

@ -394,7 +394,7 @@ void RandomLevelSource::postProcess(ChunkSource* src, int x, int z)
xo = m_random.nextInt(16);
yo = m_random.nextInt(16);
zo = m_random.nextInt(16);
OreFeature(Tile::redStoneOre->m_ID, 8).place(m_pLevel, &m_random, x16 + xo, yo, z16 + zo);
OreFeature(Tile::redStoneOre->m_ID, 7).place(m_pLevel, &m_random, x16 + xo, yo, z16 + zo);
}
xo = m_random.nextInt(16);
@ -469,6 +469,7 @@ void RandomLevelSource::postProcess(ChunkSource* src, int x, int z)
int zo = m_random.nextInt(16);
FlowerFeature(Tile::rose->m_ID).place(m_pLevel, &m_random, x16 + 8 + xo, yo, z16 + 8 + zo);
}
if (m_random.nextInt(4) == 0)
{
int xo = m_random.nextInt(16);
@ -476,6 +477,7 @@ void RandomLevelSource::postProcess(ChunkSource* src, int x, int z)
int zo = m_random.nextInt(16);
FlowerFeature(Tile::mushroom1->m_ID).place(m_pLevel, &m_random, x16 + 8 + xo, yo, z16 + 8 + zo);
}
if (m_random.nextInt(8) == 0)
{
int xo = m_random.nextInt(16);