the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 64 lines 1.6 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.world.level.newbiome.layer.h" 3#include "net.minecraft.world.level.biome.h" 4 5AddIslandLayer::AddIslandLayer(__int64 seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup) 6{ 7 this->parent = parent; 8} 9 10intArray AddIslandLayer::getArea(int xo, int yo, int w, int h) 11{ 12 int px = xo - 1; 13 int py = yo - 1; 14 int pw = w + 2; 15 int ph = h + 2; 16 intArray p = parent->getArea(px, py, pw, ph); 17 18 intArray result = IntCache::allocate(w * h); 19 for (int y = 0; y < h; y++) 20 { 21 for (int x = 0; x < w; x++) 22 { 23 int n1 = p[(x + 0) + (y + 0) * pw]; 24 int n2 = p[(x + 2) + (y + 0) * pw]; 25 int n3 = p[(x + 0) + (y + 2) * pw]; 26 int n4 = p[(x + 2) + (y + 2) * pw]; 27 int c = p[(x + 1) + (y + 1) * pw]; 28 initRandom(x + xo, y + yo); 29 if (c == 0 && (n1 != 0 || n2 != 0 || n3 != 0 || n4 != 0)) 30 { 31 int odds = 1; 32 int swap = 1; 33 if (n1 != 0 && nextRandom(odds++) == 0) swap = n1; 34 if (n2 != 0 && nextRandom(odds++) == 0) swap = n2; 35 if (n3 != 0 && nextRandom(odds++) == 0) swap = n3; 36 if (n4 != 0 && nextRandom(odds++) == 0) swap = n4; 37 if (nextRandom(3) == 0) 38 { 39 result[x + y * w] = swap; 40 } 41 else 42 { 43 if (swap == Biome::iceFlats->id) result[x + y * w] = Biome::frozenOcean->id; 44 else result[x + y * w] = 0; 45 } 46 } 47 else if (c > 0 && (n1 == 0 || n2 == 0 || n3 == 0 || n4 == 0)) 48 { 49 if (nextRandom(5) == 0) 50 { 51 if (c == Biome::iceFlats->id) result[x + y * w] = Biome::frozenOcean->id; 52 else result[x + y * w] = 0; 53 } 54 else result[x + y * w] = c; 55 } 56 else 57 { 58 result[x + y * w] = c; 59 } 60 } 61 } 62 63 return result; 64}