diff --git a/Minecraft.World/Biome.cpp b/Minecraft.World/Biome.cpp index f1593dd3..3684f3d8 100644 --- a/Minecraft.World/Biome.cpp +++ b/Minecraft.World/Biome.cpp @@ -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); } diff --git a/Minecraft.World/BiomeDecorator.h b/Minecraft.World/BiomeDecorator.h index 93742780..4e6e00dd 100644 --- a/Minecraft.World/BiomeDecorator.h +++ b/Minecraft.World/BiomeDecorator.h @@ -16,6 +16,7 @@ class BiomeDecorator friend class BeachBiome; friend class SavannaBiome; friend class JungleBiome; + friend class RoofedForestBiome; protected: Level *level; Random *random; diff --git a/Minecraft.World/BiomeInitLayer.cpp b/Minecraft.World/BiomeInitLayer.cpp index 0e409e7f..d2ea3d66 100644 --- a/Minecraft.World/BiomeInitLayer.cpp +++ b/Minecraft.World/BiomeInitLayer.cpp @@ -21,7 +21,7 @@ BiomeInitLayer::BiomeInitLayer(int64_t seed, shared_ptrparent, 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_ptrparent, LevelType startBiomes[5] = Biome::taiga; startBiomes[6] = Biome::jungle; startBiomes[7] = Biome::savanna; + startBiomes[8] = Biome::roofedForest; } } diff --git a/Minecraft.World/BiomeSource.cpp b/Minecraft.World/BiomeSource.cpp index 76495708..c001b146 100644 --- a/Minecraft.World/BiomeSource.cpp +++ b/Minecraft.World/BiomeSource.cpp @@ -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) diff --git a/Minecraft.World/DarkOakFeature.cpp b/Minecraft.World/DarkOakFeature.cpp index d9ceded6..ff93f90e 100644 --- a/Minecraft.World/DarkOakFeature.cpp +++ b/Minecraft.World/DarkOakFeature.cpp @@ -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; } } diff --git a/Minecraft.World/HugeMushroomFeature.cpp b/Minecraft.World/HugeMushroomFeature.cpp index cc8696ae..3ab565f4 100644 --- a/Minecraft.World/HugeMushroomFeature.cpp +++ b/Minecraft.World/HugeMushroomFeature.cpp @@ -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 { diff --git a/Minecraft.World/JungleBiome.cpp b/Minecraft.World/JungleBiome.cpp index 1388e97f..9864eb82 100644 --- a/Minecraft.World/JungleBiome.cpp +++ b/Minecraft.World/JungleBiome.cpp @@ -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(); -} \ No newline at end of file + + 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(); + } \ No newline at end of file diff --git a/Minecraft.World/Minecraft.World.vcxproj b/Minecraft.World/Minecraft.World.vcxproj index e1791fd0..76ca113e 100644 --- a/Minecraft.World/Minecraft.World.vcxproj +++ b/Minecraft.World/Minecraft.World.vcxproj @@ -2715,6 +2715,7 @@ + @@ -3654,6 +3655,7 @@ + diff --git a/Minecraft.World/Minecraft.World.vcxproj.filters b/Minecraft.World/Minecraft.World.vcxproj.filters index 1340b672..b7d97d80 100644 --- a/Minecraft.World/Minecraft.World.vcxproj.filters +++ b/Minecraft.World/Minecraft.World.vcxproj.filters @@ -825,6 +825,7 @@ + @@ -1819,6 +1820,7 @@ + diff --git a/Minecraft.World/RoofedForestBiome.cpp b/Minecraft.World/RoofedForestBiome.cpp new file mode 100644 index 00000000..fcb53b67 --- /dev/null +++ b/Minecraft.World/RoofedForestBiome.cpp @@ -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(Tile::grass_Id); + material = static_cast(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; +} \ No newline at end of file diff --git a/Minecraft.World/RoofedForestBiome.h b/Minecraft.World/RoofedForestBiome.h new file mode 100644 index 00000000..9b133b9c --- /dev/null +++ b/Minecraft.World/RoofedForestBiome.h @@ -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; +}; \ No newline at end of file diff --git a/Minecraft.World/SavannaBiome.cpp b/Minecraft.World/SavannaBiome.cpp index 8c259087..9d6479eb 100644 --- a/Minecraft.World/SavannaBiome.cpp +++ b/Minecraft.World/SavannaBiome.cpp @@ -27,4 +27,14 @@ Feature *SavannaBiome::getTreeFeature(Random *random) return new TreeFeature(false); -} \ No newline at end of file +} + +int SavannaBiome::getGrassColor() +{ + return 0xBFB755; +} + +int SavannaBiome::getFolageColor() +{ + return 0xAEA42A; +} diff --git a/Minecraft.World/SavannaBiome.h b/Minecraft.World/SavannaBiome.h index 0a07d202..e1e99369 100644 --- a/Minecraft.World/SavannaBiome.h +++ b/Minecraft.World/SavannaBiome.h @@ -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; }; \ No newline at end of file diff --git a/Minecraft.World/TreeTile.cpp b/Minecraft.World/TreeTile.cpp index e87ddebe..6cf8da8b 100644 --- a/Minecraft.World/TreeTile.cpp +++ b/Minecraft.World/TreeTile.cpp @@ -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) diff --git a/Minecraft.World/net.minecraft.world.level.biome.h b/Minecraft.World/net.minecraft.world.level.biome.h index 8339e462..fb99fc1a 100644 --- a/Minecraft.World/net.minecraft.world.level.biome.h +++ b/Minecraft.World/net.minecraft.world.level.biome.h @@ -32,4 +32,5 @@ #include "JungleBiome.h" //TU31 -#include "SavannaBiome.h" \ No newline at end of file +#include "SavannaBiome.h" +#include "RoofedForestBiome.h" \ No newline at end of file