Roofed Forest

This commit is contained in:
Lord Cambion 2026-03-18 16:26:32 +01:00
parent 364c2039a5
commit 1822ffd3b0
15 changed files with 154 additions and 65 deletions

View file

@ -83,7 +83,7 @@ void Biome::staticCtor()
Biome::jungleHills = (new JungleBiome(22))->setColor(0x2c4205)->setName(L"JungleHills")->setLeafColor(0x537b09)->setTemperatureAndDownfall(1.2f, 0.9f)->setDepthAndScale(1.8f, 0.5f)->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_JungleHills, eMinecraftColour_Foliage_JungleHills, eMinecraftColour_Water_JungleHills,eMinecraftColour_Sky_JungleHills);
Biome::savanna = (new SavannaBiome(35))->setColor(0xbda235)->setName(L"Savanna")->setNoRain()->setTemperatureAndDownfall(1.2f, 0.0f) ->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_Savanna, eMinecraftColour_Foliage_Savanna, eMinecraftColour_Sky_Desert, eMinecraftColour_Sky_Desert);
Biome::roofedForest = (new Biome(29))->setName(L"Roofed Forest")->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_RoofedForest, eMinecraftColour_Foliage_RoofedForest, eMinecraftColour_Water_Forest, eMinecraftColour_Sky_Forest);
Biome::roofedForest = (new RoofedForestBiome(29))->setName(L"RoofedForest")->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_RoofedForest, eMinecraftColour_Foliage_RoofedForest, eMinecraftColour_Water_Forest, eMinecraftColour_Sky_Forest);
}

View file

@ -16,6 +16,7 @@ class BiomeDecorator
friend class BeachBiome;
friend class SavannaBiome;
friend class JungleBiome;
friend class RoofedForestBiome;
protected:
Level *level;
Random *random;

View file

@ -21,7 +21,7 @@ BiomeInitLayer::BiomeInitLayer(int64_t seed, shared_ptr<Layer>parent, LevelType
}
else
{
startBiomes = BiomeArray(8);
startBiomes = BiomeArray(9);
startBiomes[0] = Biome::desert;
startBiomes[1] = Biome::forest;
startBiomes[2] = Biome::extremeHills;
@ -30,6 +30,7 @@ BiomeInitLayer::BiomeInitLayer(int64_t seed, shared_ptr<Layer>parent, LevelType
startBiomes[5] = Biome::taiga;
startBiomes[6] = Biome::jungle;
startBiomes[7] = Biome::savanna;
startBiomes[8] = Biome::roofedForest;
}
}

View file

@ -25,6 +25,7 @@ void BiomeSource::_init()
playerSpawnBiomes.push_back(Biome::jungle);
playerSpawnBiomes.push_back(Biome::jungleHills);
playerSpawnBiomes.push_back(Biome::savanna);
playerSpawnBiomes.push_back(Biome::roofedForest);
}
void BiomeSource::_init(int64_t seed, LevelType *generator)

View file

@ -131,8 +131,12 @@ bool DarkOakFeature::checkSpace(Level *worldIn, int x, int y, int z, int height)
for (int k1 = -i1; k1 <= i1; ++k1) {
int tile = worldIn->getTile(x + j1, y + l, z + k1);
if (tile != 0 && tile != Tile::leaves_Id && tile != Tile::leaves2_Id &&
tile != Tile::tallgrass_Id && tile != Tile::sapling_Id) {
// ignores grass, dirt e trunks.
if (tile != 0 &&
tile != Tile::leaves_Id && tile != Tile::leaves2_Id &&
tile != Tile::tallgrass_Id && tile != Tile::sapling_Id &&
tile != Tile::grass_Id && tile != Tile::dirt_Id &&
tile != Tile::treeTrunk_Id && tile != Tile::tree2Trunk_Id) {
return false;
}
}

View file

@ -34,10 +34,8 @@ bool HugeMushroomFeature::place(Level *level, Random *random, int x, int y, int
if (yy >= 0 && yy < Level::maxBuildHeight)
{
int tt = level->getTile(xx, yy, zz);
if (tt != 0 && tt != Tile::leaves_Id)
{
if (tt != 0 && tt != Tile::leaves_Id && tt != Tile::leaves2_Id && tt != Tile::tallgrass_Id && tt != Tile::mushroom_brown_Id && tt != Tile::mushroom_red_Id &&tt != Tile::sapling_Id && tt != Tile::sapling2_Id)
free = false;
}
}
else
{

View file

@ -1,63 +1,63 @@
#include "stdafx.h"
#include "net.minecraft.world.level.biome.h"
#include "net.minecraft.world.level.levelgen.feature.h"
#include "net.minecraft.world.level.tile.h"
#include "net.minecraft.world.level.h"
#include "net.minecraft.world.entity.animal.h"
#include "JungleBiome.h"
#include "stdafx.h"
#include "net.minecraft.world.level.biome.h"
#include "net.minecraft.world.level.levelgen.feature.h"
#include "net.minecraft.world.level.tile.h"
#include "net.minecraft.world.level.h"
#include "net.minecraft.world.entity.animal.h"
#include "JungleBiome.h"
JungleBiome::JungleBiome(int id) : Biome(id)
{
decorator->treeCount = 50;
decorator->grassCount = 25;
decorator->flowerCount = 4;
enemies.push_back(new MobSpawnerData(eTYPE_OCELOT, 2, 1, 1));
// make chicken a lot more common in the jungle
friendlies.push_back(new MobSpawnerData(eTYPE_CHICKEN, 10, 4, 4));
}
Feature *JungleBiome::getTreeFeature(Random *random)
{
if (random->nextInt(10) == 0)
JungleBiome::JungleBiome(int id) : Biome(id)
{
return new BasicTree(false); // 4J used to return member fancyTree, now returning newly created object so that caller can be consistently resposible for cleanup
}
if (random->nextInt(2) == 0)
{
return new GroundBushFeature(TreeTile::JUNGLE_TRUNK, LeafTile::NORMAL_LEAF);
}
if (random->nextInt(3) == 0)
{
return new MegaTreeFeature(false, 10 + random->nextInt(20), TreeTile::JUNGLE_TRUNK, LeafTile::JUNGLE_LEAF);
}
return new TreeFeature(false, 4 + random->nextInt(7), TreeTile::JUNGLE_TRUNK, LeafTile::JUNGLE_LEAF, true);
}
decorator->treeCount = 50;
decorator->grassCount = 25;
decorator->flowerCount = 4;
Feature *JungleBiome::getGrassFeature(Random *random)
{
if (random->nextInt(4) == 0)
{
return new TallGrassFeature(Tile::tallgrass_Id, TallGrass::FERN);
enemies.push_back(new MobSpawnerData(eTYPE_OCELOT, 2, 1, 1));
// make chicken a lot more common in the jungle
friendlies.push_back(new MobSpawnerData(eTYPE_CHICKEN, 10, 4, 4));
}
return new TallGrassFeature(Tile::tallgrass_Id, TallGrass::TALL_GRASS);
}
void JungleBiome::decorate(Level *level, Random *random, int xo, int zo)
{
Biome::decorate(level, random, xo, zo);
PIXBeginNamedEvent(0, "Adding vines");
VinesFeature *vines = new VinesFeature();
for (int i = 0; i < 50; i++)
Feature *JungleBiome::getTreeFeature(Random *random)
{
int x = xo + random->nextInt(16) + 8;
int y = Level::genDepth / 2;
int z = zo + random->nextInt(16) + 8;
vines->place(level, random, x, y, z);
if (random->nextInt(10) == 0)
{
return new BasicTree(false); // 4J used to return member fancyTree, now returning newly created object so that caller can be consistently resposible for cleanup
}
if (random->nextInt(2) == 0)
{
return new GroundBushFeature(TreeTile::JUNGLE_TRUNK, LeafTile::NORMAL_LEAF);
}
if (random->nextInt(3) == 0)
{
return new MegaTreeFeature(false, 10 + random->nextInt(20), TreeTile::JUNGLE_TRUNK, LeafTile::JUNGLE_LEAF);
}
return new TreeFeature(false, 4 + random->nextInt(7), TreeTile::JUNGLE_TRUNK, LeafTile::JUNGLE_LEAF, true);
}
PIXEndNamedEvent();
}
Feature *JungleBiome::getGrassFeature(Random *random)
{
if (random->nextInt(4) == 0)
{
return new TallGrassFeature(Tile::tallgrass_Id, TallGrass::FERN);
}
return new TallGrassFeature(Tile::tallgrass_Id, TallGrass::TALL_GRASS);
}
void JungleBiome::decorate(Level *level, Random *random, int xo, int zo)
{
Biome::decorate(level, random, xo, zo);
PIXBeginNamedEvent(0, "Adding vines");
VinesFeature *vines = new VinesFeature();
for (int i = 0; i < 50; i++)
{
int x = xo + random->nextInt(16) + 8;
int y = Level::genDepth / 2;
int z = zo + random->nextInt(16) + 8;
vines->place(level, random, x, y, z);
}
PIXEndNamedEvent();
}

View file

@ -2715,6 +2715,7 @@
<ClInclude Include="RedSandStoneTile.h" />
<ClInclude Include="Redstone.h" />
<ClInclude Include="RepeaterTile.h" />
<ClInclude Include="RoofedForestBiome.h" />
<ClInclude Include="RotatedPillarTile.h" />
<ClInclude Include="SandTile.h" />
<ClInclude Include="Sapling2.h" />
@ -3654,6 +3655,7 @@
<ClCompile Include="RedSandStoneTile.cpp" />
<ClCompile Include="Redstone.cpp" />
<ClCompile Include="RepeaterTile.cpp" />
<ClCompile Include="RoofedForestBiome.cpp" />
<ClCompile Include="Rose.cpp" />
<ClInclude Include="Rose.h" />
<ClCompile Include="RotatedPillarTile.cpp" />

View file

@ -825,6 +825,7 @@
<ClCompile Include="SavannaTreeFeature.cpp" />
<ClCompile Include="DarkOakFeature.cpp" />
<ClCompile Include="SavannaBiome.cpp" />
<ClCompile Include="RoofedForestBiome.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="AABB.h" />
@ -1819,6 +1820,7 @@
<ClInclude Include="SavannaTreeFeature.h" />
<ClInclude Include="DarkOakFeature.h" />
<ClInclude Include="SavannaBiome.h" />
<ClInclude Include="RoofedForestBiome.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\Minecraft.Client\Xbox\res\audio\Minecraft.xgs" />

View file

@ -0,0 +1,54 @@
#include "stdafx.h"
#include "RoofedForestBiome.h"
#include "BiomeDecorator.h"
#include "DarkOakFeature.h"
#include "HugeMushroomFeature.h"
#include "net.minecraft.world.level.tile.h"
#include "..\Level.h"
RoofedForestBiome::RoofedForestBiome(int id) : Biome(id)
{
decorator->treeCount = 35;
decorator->grassCount = 2;
decorator->flowerCount = 1;
decorator->mushroomCount = 1;
decorator->hugeMushrooms = 1;
temperature = 0.7f;
downfall = 0.8f;
topMaterial = static_cast<byte>(Tile::grass_Id);
material = static_cast<byte>(Tile::dirt_Id);
setColor(0x28340A);
setLeafColor(0x2D5A27);
}
Feature* RoofedForestBiome::getTreeFeature(Random* random)
{
;
if (random->nextInt(5) == 0)
{
return new HugeMushroomFeature();
}
return new DarkOakFeature(true);
}
int RoofedForestBiome::getGrassColor()
{
return 0x28340A;
}
int RoofedForestBiome::getFolageColor()
{
return 0x2D5A27;
}

View file

@ -0,0 +1,12 @@
#pragma once
#include "Biome.h"
class RoofedForestBiome : public Biome
{
public:
RoofedForestBiome(int id);
virtual Feature* getTreeFeature(Random* random) override;
// virtual void decorate(Level* level, Random* random, int xo, int zo) override;
virtual int getGrassColor() override;
virtual int getFolageColor() override;
};

View file

@ -27,4 +27,14 @@ Feature *SavannaBiome::getTreeFeature(Random *random)
return new TreeFeature(false);
}
}
int SavannaBiome::getGrassColor()
{
return 0xBFB755;
}
int SavannaBiome::getFolageColor()
{
return 0xAEA42A;
}

View file

@ -7,4 +7,7 @@ public:
SavannaBiome(int id);
virtual Feature *getTreeFeature(Random *random);
virtual int getFolageColor() override;
virtual int getGrassColor() override;
//virtual int getWaterColor() override;
};

View file

@ -43,7 +43,7 @@ void TreeTile::onRemove(Level *level, int x, int y, int z, int id, int data)
for (int zo = -r; zo <= r; zo++)
{
int t = level->getTile(x + xo, y + yo, z + zo);
if (t == Tile::leaves_Id)
if (t == Tile::leaves_Id|| t == Tile::leaves2_Id)
{
int currentData = level->getData(x + xo, y + yo, z + zo);
if ((currentData & LeafTile::UPDATE_LEAF_BIT) == 0)

View file

@ -32,4 +32,5 @@
#include "JungleBiome.h"
//TU31
#include "SavannaBiome.h"
#include "SavannaBiome.h"
#include "RoofedForestBiome.h"