aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/RiverMixerLayer.cpp
diff options
context:
space:
mode:
authordaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
committerdaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
commitb691c43c44ff180d10e7d4a9afc83b98551ff586 (patch)
tree3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.World/RiverMixerLayer.cpp
parentdef8cb415354ac390b7e89052a50605285f1aca9 (diff)
Initial commit
Diffstat (limited to 'Minecraft.World/RiverMixerLayer.cpp')
-rw-r--r--Minecraft.World/RiverMixerLayer.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/Minecraft.World/RiverMixerLayer.cpp b/Minecraft.World/RiverMixerLayer.cpp
new file mode 100644
index 00000000..62dfdd6c
--- /dev/null
+++ b/Minecraft.World/RiverMixerLayer.cpp
@@ -0,0 +1,47 @@
+#include "stdafx.h"
+#include "net.minecraft.world.level.biome.h"
+#include "net.minecraft.world.level.newbiome.layer.h"
+
+RiverMixerLayer::RiverMixerLayer(__int64 seed, shared_ptr<Layer>biomes, shared_ptr<Layer>rivers) : Layer(seed)
+{
+ this->biomes = biomes;
+ this->rivers = rivers;
+}
+
+void RiverMixerLayer::init(__int64 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)
+ {
+ result[i] = b[i];
+
+ }
+ else
+ {
+ if (r[i] >= 0)
+ {
+ if (b[i] == Biome::iceFlats->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;
+} \ No newline at end of file