neoLegacy/Minecraft.World/RiverMixerLayer.cpp
Lord_Cambion 0e4c5ef463 fix: matching constructors to wii u
i noticed constructor are different. still nothing changed :(
2026-05-19 17:07:26 +02:00

50 lines
1.4 KiB
C++

#include "stdafx.h"
#include "net.minecraft.world.level.biome.h"
#include "net.minecraft.world.level.newbiome.layer.h"
RiverMixerLayer::RiverMixerLayer(int32_t seed, int64_t seedMixup, std::shared_ptr<Layer> biomes, std::shared_ptr<Layer> rivers)
: Layer(seed, seedMixup)
{
this->biomes = biomes;
this->rivers = rivers;
}
void RiverMixerLayer::init(int64_t seed)
{
biomes->init(seed);
rivers->init(seed);
Layer::init(seed);
}
intArray RiverMixerLayer::getArea(int xo, int yo, int w, int h)
{
intArray b = biomes->getArea(xo, yo, w, h);
intArray r = rivers->getArea(xo, yo, w, h);
intArray result = IntCache::allocate(w * h);
for (int i = 0; i < w * h; i++)
{
if (b[i] == Biome::ocean->id || b[i] == Biome::deepOcean->id || b[i] == Biome::frozenOcean->id)
{
result[i] = b[i];
}
else
{
if (r[i] >= 0)
{
if (b[i] == Biome::iceFlats->id || b[i] == Biome::iceSpikes->id || b[i] == Biome::coldTaiga->id || b[i] == Biome::coldTaigaHills->id)
result[i] = Biome::frozenRiver->id;
else if (b[i] == Biome::mushroomIsland->id || b[i] == Biome::mushroomIslandShore->id)
result[i] = Biome::mushroomIsland->id; // 4J - don't make mushroom island shores as we don't have any island left once we do this as our islands are small (this used to change to mushroomIslandShore)
else
result[i] = r[i];
}
else
{
result[i] = b[i];
}
}
}
return result;
}