the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 78 lines 1.6 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.world.level.biome.h" 3#include "IntCache.h" 4#include "RegionHillsLayer.h" 5 6RegionHillsLayer::RegionHillsLayer(__int64 seed, shared_ptr<Layer> parent) : Layer(seed) 7{ 8 this->parent = parent; 9} 10 11intArray RegionHillsLayer::getArea(int xo, int yo, int w, int h) 12{ 13 intArray b = parent->getArea(xo - 1, yo - 1, w + 2, h + 2); 14 15 intArray result = IntCache::allocate(w * h); 16 for (int y = 0; y < h; y++) 17 { 18 for (int x = 0; x < w; x++) 19 { 20 initRandom(x + xo, y + yo); 21 int old = b[(x + 1) + (y + 1) * (w + 2)]; 22 if (nextRandom(3) == 0) 23 { 24 int next = old; 25 if (old == Biome::desert->id) 26 { 27 next = Biome::desertHills->id; 28 } 29 else if (old == Biome::forest->id) 30 { 31 next = Biome::forestHills->id; 32 } 33 else if (old == Biome::taiga->id) 34 { 35 next = Biome::taigaHills->id; 36 } 37 else if (old == Biome::plains->id) 38 { 39 next = Biome::forest->id; 40 } 41 else if (old == Biome::iceFlats->id) 42 { 43 next = Biome::iceMountains->id; 44 } 45 else if (old == Biome::jungle->id) 46 { 47 next = Biome::jungleHills->id; 48 49 } 50 if (next == old) 51 { 52 result[x + y * w] = old; 53 } 54 else 55 { 56 int _n = b[(x + 1) + (y + 1 - 1) * (w + 2)]; 57 int _e = b[(x + 1 + 1) + (y + 1) * (w + 2)]; 58 int _w = b[(x + 1 - 1) + (y + 1) * (w + 2)]; 59 int _s = b[(x + 1) + (y + 1 + 1) * (w + 2)]; 60 if (_n == old && _e == old && _w == old && _s == old) 61 { 62 result[x + y * w] = next; 63 } 64 else 65 { 66 result[x + y * w] = old; 67 } 68 } 69 } 70 else 71 { 72 result[x + y * w] = old; 73 } 74 } 75 } 76 77 return result; 78}