feat: stone beach

not implemented yet
This commit is contained in:
Lord_Cambion 2026-05-16 12:45:17 +02:00
parent 7404403a8f
commit 2ed917481d
8 changed files with 68 additions and 39 deletions

View file

@ -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);

View file

@ -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;
}

View file

@ -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;
}

View file

@ -6,13 +6,12 @@ class LevelType;
#endif
class Layer
{
private:
int64_t seed;
protected:
shared_ptr<Layer> parent;
int64_t rval;
int64_t seedMixup;
public:
int64_t seed;
shared_ptr<Layer> parent;
int64_t rval;
int64_t seedMixup;
public:
static LayerArray getDefaultLayers(int64_t seed, LevelType *levelType, void* superflatConfig = nullptr);
Layer(int64_t seedMixup);

View file

@ -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<byte>(Tile::stone_Id);
material = static_cast<byte>(Tile::stone_Id);
depth = 1;
scale = 1;
decorator->treeCount = -999;
decorator->deadBushCount = 0;
decorator->reedsCount = 0;
decorator->cactusCount = 0;
}

View file

@ -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; }
};

View file

@ -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"

View file

@ -34,4 +34,5 @@
//TU31
#include "SavannaBiome.h"
#include "MesaBiome.h"
#include "MesaBiome.h"
#include "StoneBeachBiome.h"