Files
neoStudiosLCE-neoLegacy/Minecraft.World/ExtremeHillsBiome.cpp
Lord_Cambion 4303b4966a fix: biome generation
biomes like extreme hills now have correct blocks sky and water, also correct grass. another thing is that now in the world spawns mutated biomes and it is acceptable as a world generation.
i dont thjink it is the same because seeds are not giving me the ones from youtube videos but we will work on it later.

For now it works and it is acceptable. spawns a variety of biomes that before was spawned in a random way, now depending on next biomes and temperature
2026-04-22 12:26:18 +02:00

116 lines
3.1 KiB
C++

#include "stdafx.h"
#include "net.minecraft.world.level.h"
#include "net.minecraft.world.level.tile.h"
#include "net.minecraft.world.level.levelgen.feature.h"
#include "ExtremeHillsBiome.h"
#include "BiomeDecorator.h"
#include "SpruceFeature.h"
#include "TreeFeature.h"
ExtremeHillsBiome::ExtremeHillsBiome(int id) : ExtremeHillsBiome(id, false)
{
}
ExtremeHillsBiome::ExtremeHillsBiome(int id, bool extraTrees) : Biome(id)
{
silverfishFeature = new OreFeature(Tile::monsterStoneEgg_Id, 9);
taigaFeature = new SpruceFeature(false);
friendlies.clear();
type = TYPE_NORMAL;
if (extraTrees)
{
decorator->treeCount = 3;
type = TYPE_TREES;
}
}
ExtremeHillsBiome::~ExtremeHillsBiome()
{
delete silverfishFeature;
delete taigaFeature;
}
Feature* ExtremeHillsBiome::getTreeFeature(Random* random)
{
if (random->nextInt(3) > 0)
{
return new SpruceFeature(false);
}
return Biome::getTreeFeature(random);
}
void ExtremeHillsBiome::decorate(Level* level, Random* random, int xo, int zo)
{
Biome::decorate(level, random, xo, zo);
if (GENERATE_EMERALD_ORE)
{
int emeraldCount = 3 + random->nextInt(6);
for (int d = 0; d < emeraldCount; d++)
{
int x = xo + random->nextInt(16);
int y = random->nextInt(28) + 4;
int z = zo + random->nextInt(16);
int tile = level->getTile(x, y, z);
if (tile == Tile::stone_Id)
{
level->setTileAndData(x, y, z, Tile::emeraldOre_Id, 0, Tile::UPDATE_CLIENTS);
}
}
}
for (int i = 0; i < 7; i++)
{
int x = xo + random->nextInt(16);
int y = random->nextInt(64);
int z = zo + random->nextInt(16);
silverfishFeature->place(level, random, x, y, z);
}
}
void ExtremeHillsBiome::buildSurfaceAtDefault(Level* level, Random* random, byte* chunkBlocks, int x, int z, double noiseVal)
{
topMaterial = static_cast<byte>(Tile::grass_Id);
topMaterialData = 0;
material = static_cast<byte>(Tile::dirt_Id);
materialData = 0;
if ((noiseVal < -1.0 || noiseVal > 2.0) && type == TYPE_MUTATED)
{
topMaterial = static_cast<byte>(Tile::gravel_Id);
material = static_cast<byte>(Tile::gravel_Id);
}
else if (noiseVal > 1.0 && type != TYPE_TREES)
{
topMaterial = static_cast<byte>(Tile::stone_Id);
topMaterialData = 0;
material = static_cast<byte>(Tile::stone_Id);
materialData = 0;
}
Biome::buildSurfaceAtDefault(level, random, chunkBlocks, x, z, noiseVal);
}
Biome* ExtremeHillsBiome::mutateHills(Biome* baseBiome)
{
this->type = TYPE_MUTATED;
this->setColor(baseBiome->color, true);
this->setName(baseBiome->m_name + L" M");
this->setDepthAndScale(baseBiome->depth, baseBiome->scale);
this->setTemperatureAndDownfall(baseBiome->temperature, baseBiome->downfall);
this->setWaterSkyColor(baseBiome->getWaterColor(), baseBiome->getSkyColor());
return this;
}
Biome* ExtremeHillsBiome::createMutatedBiome(int id)
{
return (new ExtremeHillsBiome(id, false))->mutateHills(this);
}