the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 72 lines 1.6 kB view raw
1#include "stdafx.h" 2#include "System.h" 3#include "net.minecraft.world.level.newbiome.layer.h" 4 5FuzzyZoomLayer::FuzzyZoomLayer(__int64 seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup) 6{ 7 this->parent = parent; 8} 9 10intArray FuzzyZoomLayer::getArea(int xo, int yo, int w, int h) 11{ 12 int px = xo >> 1; 13 int py = yo >> 1; 14 int pw = (w >> 1) + 3; 15 int ph = (h >> 1) + 3; 16 intArray p = parent->getArea(px, py, pw, ph); 17 18 intArray tmp = IntCache::allocate((pw * 2) * (ph * 2)); 19 int ww = (pw << 1); 20 for (int y = 0; y < ph - 1; y++) 21 { 22 int ry = y << 1; 23 int pp = ry * ww; 24 int ul = p[(0 + 0) + (y + 0) * pw]; 25 int dl = p[(0 + 0) + (y + 1) * pw]; 26 for (int x = 0; x < pw - 1; x++) 27 { 28 initRandom((x + px) << 1, (y + py) << 1); 29 int ur = p[(x + 1) + (y + 0) * pw]; 30 int dr = p[(x + 1) + (y + 1) * pw]; 31 32 tmp[pp] = ul; 33 tmp[pp++ + ww] = random(ul, dl); 34 tmp[pp] = random(ul, ur); 35 tmp[pp++ + ww] = random(ul, ur, dl, dr); 36 37 ul = ur; 38 dl = dr; 39 } 40 } 41 intArray result = IntCache::allocate(w * h); 42 for (int y = 0; y < h; y++) 43 { 44 System::arraycopy(tmp, (y + (yo & 1)) * (pw << 1) + (xo & 1), &result, y * w, w); 45 } 46 47 return result; 48} 49 50int FuzzyZoomLayer::random(int a, int b) 51{ 52 return nextRandom(2) == 0 ? a : b; 53} 54 55int FuzzyZoomLayer::random(int a, int b, int c, int d) 56{ 57 int s = nextRandom(4); 58 if (s == 0) return a; 59 if (s == 1) return b; 60 if (s == 2) return c; 61 return d; 62} 63 64shared_ptr<Layer>FuzzyZoomLayer::zoom(__int64 seed, shared_ptr<Layer>sup, int count) 65{ 66 shared_ptr<Layer> result = sup; 67 for (int i = 0; i < count; i++) 68 { 69 result = shared_ptr<Layer>(new FuzzyZoomLayer(seed + i, result)); 70 } 71 return result; 72}