diff --git a/Minecraft.World/Biome.cpp b/Minecraft.World/Biome.cpp index f35769db..91dbf3c0 100644 --- a/Minecraft.World/Biome.cpp +++ b/Minecraft.World/Biome.cpp @@ -111,7 +111,7 @@ void Biome::staticCtor() Biome::jungleHills = (new JungleBiome(22, false))->setColor(0x2c4205)->setName(L"Jungle Hills")->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::jungleEdge = (new JungleBiome(23, true))->setColor(0x6458135)->setName(L"Jungle Edge")->setLeafColor(0x5470985)->setTemperatureAndDownfall(0.95F, 0.8F); Biome::deepOcean= (new OceanBiome(24))->setName(L"Deep Ocean")->setDepthAndScale(-1.8,0.1f)->setColor(0x000070)->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_Ocean, eMinecraftColour_Foliage_Ocean, eMinecraftColour_Water_Ocean,eMinecraftColour_Sky_Ocean);; - //public static final BiomeGenBase stoneBeach = (new BiomeGenStoneBeach(25)).setColor(10658436).setBiomeName("Stone Beach").setTemperatureRainfall(0.2F, 0.3F).setHeight(height_RockyWaters); + Biome::stoneBeach = (new StoneBeachBiome(25))->setColor(0xa2a284)->setName(L"Stone Beach")->setTemperatureAndDownfall(0.2f, 0.3f)->setDepthAndScale(-1.0f, 0.1f)->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_ExtremeHills,eMinecraftColour_Foliage_ExtremeHills,eMinecraftColour_Water_ExtremeHills,eMinecraftColour_Sky_ExtremeHills); Biome::coldBeach = (new BeachBiome(26))->setColor(0xFAF0C0)->setName(L"Cold Beach")->setTemperatureAndDownfall(0.05F, 0.3F)->setDepthAndScale(0.0F, 0.025F)->setSnowCovered()->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_IcePlains, eMinecraftColour_Foliage_IcePlains, eMinecraftColour_Water_IcePlains, eMinecraftColour_Sky_IcePlains); Biome::birchForest=(new ForestBiome(27, 2))->setColor(0x307444)->setName(L"Birch Forest")->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_Forest, eMinecraftColour_Foliage_Birch, eMinecraftColour_Water_Forest, eMinecraftColour_Sky_Forest); Biome::birchForestHills=(new ForestBiome(28, 2))->setColor(0x1f5f32)->setName(L"Birch Forest Hills")->setDepthAndScale(0.45f, 0.3f)->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_ForestHills, eMinecraftColour_Foliage_Birch, eMinecraftColour_Water_Forest, eMinecraftColour_Sky_ForestHills); diff --git a/Minecraft.World/IslandLayer.cpp b/Minecraft.World/IslandLayer.cpp index 9a10d639..0b1e882e 100644 --- a/Minecraft.World/IslandLayer.cpp +++ b/Minecraft.World/IslandLayer.cpp @@ -7,19 +7,23 @@ IslandLayer::IslandLayer(int64_t seed, int64_t seedMixup) : Layer(seedMixup) intArray IslandLayer::getArea(int xo, int yo, int w, int h) { - intArray result = IntCache::allocate(w * h); - for (int y = 0; y < h; y++) - { - for (int x = 0; x < w; x++) - { - initRandom(xo + x, yo + y); - result[x + y * w] = (nextRandom(10) == 0) ? 1 : 0; - } - } - // if (0, 0) is located here, place an island - if (xo > -w && xo <= 0 && yo > -h && yo <= 0) - { - result[-xo + -yo * w] = 1; - } - return result; + intArray result = IntCache::allocate(w * h); + static int callCount = 0; + bool doLog = (callCount++ == 0); + + for (int y = 0; y < h; y++) + { + for (int x = 0; x < w; x++) + { + initRandom(xo + x, yo + y); + int r = nextRandom(10); + int val = (r == 0) ? 1 : 0; + result[x + y * w] = val; + + + } + } + if (xo > -w && xo <= 0 && yo > -h && yo <= 0) + result[-xo + -yo * w] = 1; + return result; } \ No newline at end of file diff --git a/Minecraft.World/Layer.cpp b/Minecraft.World/Layer.cpp index f10082d1..4f68d18b 100644 --- a/Minecraft.World/Layer.cpp +++ b/Minecraft.World/Layer.cpp @@ -101,14 +101,10 @@ LayerArray Layer::getDefaultLayers(int64_t seed, LevelType* levelType, void* sup Layer::Layer(int64_t s) { - - int64_t sm = (int64_t)(int32_t)s; - + int64_t sm = (int64_t)(int32_t)s; int64_t a = sm * (0x5851F42D4C957F2DLL * sm + 0x14057B7EF767814FLL) + sm; int64_t b = (0x5851F42D4C957F2DLL * a + 0x14057B7EF767814FLL) * a + sm; this->seedMixup = b * (0x5851F42D4C957F2DLL * b + 0x14057B7EF767814FLL) + sm; - - app.DebugPrintf("Layer ctor: s=%lld, seedMixup=%lld\n", s, this->seedMixup); this->parent = nullptr; this->seed = 0; this->rval = 0; @@ -116,37 +112,35 @@ Layer::Layer(int64_t s) void Layer::initRandom(int64_t x, int64_t y) { + + static bool first = true; + int64_t xi = (int64_t)(int32_t)x; int64_t yi = (int64_t)(int32_t)y; int64_t v4 = (0x5851F42D4C957F2DLL * seed + 0x14057B7EF767814FLL) * seed + xi; - uint32_t v5 = 1284865837u * (uint32_t)(v4 * (1284865837LL * (int32_t)v4 - 144211633LL) + yi) - 144211633u; - int64_t paired = (int64_t)(((uint64_t)v5 << 32) | (uint64_t)v5); int64_t v6 = paired * (v4 * (0x5851F42D4C957F2DLL * v4 + 0x14057B7EF767814FLL) + yi) + xi; - uint32_t lo = 1284865837u * (uint32_t)v6 - 144211633u; int64_t paired2 = (int64_t)(((uint64_t)lo << 32) | (uint64_t)lo); rval = paired2 * v6 + yi; + + } int Layer::nextRandom(int max) { - int32_t hi = (int32_t)(rval >> 32); - int temp = hi >> 24; - int result = temp % max; + int result = (hi >> 24) % max; if (result < 0) result += max; - int64_t v = rval; int64_t lo = (int64_t)(int32_t)( (int32_t)v * (1284865837 * (int32_t)v - 144211633) + (int32_t)seed); int64_t hi64 = v * (0x5851F42D4C957F2DLL * v + 0x14057B7EF767814FLL) + seed; - rval = (hi64 & 0xFFFFFFFF00000000LL) | (uint32_t)lo; return result; @@ -162,7 +156,6 @@ void Layer::init(int64_t seed) uint32_t v12 = lo * (1284865837u * lo - 144211633u); uint32_t sum = v12 + m; - uint32_t step1 = sum * (1284865837u * sum - 144211633u); uint32_t sum2 = step1 + m; @@ -170,8 +163,9 @@ void Layer::init(int64_t seed) * (0x5851F42D4C957F2DLL * (int64_t)(int32_t)sum2 + 0x14057B7EF767814FLL) + (int64_t)(int32_t)m; + static bool first = true; - app.DebugPrintf("init: seed=%lld, m=%u, result=%lld\n", seed, m, step2); + this->seed = step2; } diff --git a/Minecraft.World/Layer.h b/Minecraft.World/Layer.h index 4d798c0f..4896e9fe 100644 --- a/Minecraft.World/Layer.h +++ b/Minecraft.World/Layer.h @@ -6,13 +6,12 @@ class LevelType; #endif class Layer { -private: - int64_t seed; -protected: - shared_ptr parent; - int64_t rval; - int64_t seedMixup; - +public: + int64_t seed; + shared_ptr parent; + int64_t rval; + int64_t seedMixup; + public: static LayerArray getDefaultLayers(int64_t seed, LevelType *levelType, void* superflatConfig = nullptr); Layer(int64_t seedMixup); diff --git a/Minecraft.World/StoneBeachBiome.cpp b/Minecraft.World/StoneBeachBiome.cpp new file mode 100644 index 00000000..de062e19 --- /dev/null +++ b/Minecraft.World/StoneBeachBiome.cpp @@ -0,0 +1,19 @@ +#include "stdafx.h" +#include "net.minecraft.world.level.tile.h" +#include "BiomeDecorator.h" +#include "StoneBeachBiome.h" + +StoneBeachBiome::StoneBeachBiome(int id) : Biome(id) +{ + + topMaterial = static_cast(Tile::stone_Id); + material = static_cast(Tile::stone_Id); + + depth = 1; + scale = 1; + + decorator->treeCount = -999; + decorator->deadBushCount = 0; + decorator->reedsCount = 0; + decorator->cactusCount = 0; +} \ No newline at end of file diff --git a/Minecraft.World/StoneBeachBiome.h b/Minecraft.World/StoneBeachBiome.h new file mode 100644 index 00000000..6d8232b4 --- /dev/null +++ b/Minecraft.World/StoneBeachBiome.h @@ -0,0 +1,10 @@ +#pragma once +#include "Biome.h" +class StoneBeachBiome : public Biome +{ +public: + StoneBeachBiome(int id); + virtual bool isFoggy() { return false; } + virtual bool isNatural() { return true; } + virtual int getBaseClass() { return 15; } +}; \ No newline at end of file diff --git a/Minecraft.World/cmake/sources/Common.cmake b/Minecraft.World/cmake/sources/Common.cmake index 8c201c0b..7a79796c 100644 --- a/Minecraft.World/cmake/sources/Common.cmake +++ b/Minecraft.World/cmake/sources/Common.cmake @@ -1365,6 +1365,8 @@ set(_MINECRAFT_WORLD_COMMON_NET_MINECRAFT_WORLD_LEVEL_BIOME "${CMAKE_CURRENT_SOURCE_DIR}/RiverBiome.h" "${CMAKE_CURRENT_SOURCE_DIR}/SwampBiome.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/SwampBiome.h" + "${CMAKE_CURRENT_SOURCE_DIR}/StoneBeachBiome.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/StoneBeachBiome.h" "${CMAKE_CURRENT_SOURCE_DIR}/TaigaBiome.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/TaigaBiome.h" "${CMAKE_CURRENT_SOURCE_DIR}/TheEndBiome.cpp" diff --git a/Minecraft.World/net.minecraft.world.level.biome.h b/Minecraft.World/net.minecraft.world.level.biome.h index b7e0bc60..6725b1d6 100644 --- a/Minecraft.World/net.minecraft.world.level.biome.h +++ b/Minecraft.World/net.minecraft.world.level.biome.h @@ -34,4 +34,5 @@ //TU31 #include "SavannaBiome.h" -#include "MesaBiome.h" \ No newline at end of file +#include "MesaBiome.h" +#include "StoneBeachBiome.h"