the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "net.minecraft.world.level.newbiome.layer.h"
3#include "System.h"
4
5ZoomLayer::ZoomLayer(__int64 seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup)
6{
7 this->parent = parent;
8}
9
10intArray ZoomLayer::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 return result;
47}
48
49int ZoomLayer::random(int a, int b)
50{
51 return nextRandom(2) == 0 ? a : b;
52}
53
54int ZoomLayer::random(int a, int b, int c, int d)
55{
56 if (b == c && c == d) return b;
57 if (a == b && a == c) return a;
58 if (a == b && a == d) return a;
59 if (a == c && a == d) return a;
60
61 if (a == b && c != d) return a;
62 if (a == c && b != d) return a;
63 if (a == d && b != c) return a;
64
65 if (b == a && c != d) return b;
66 if (b == c && a != d) return b;
67 if (b == d && a != c) return b;
68
69 if (c == a && b != d) return c;
70 if (c == b && a != d) return c;
71 if (c == d && a != b) return c;
72
73 if (d == a && b != c) return c;
74 if (d == b && a != c) return c;
75 if (d == c && a != b) return c;
76
77 int s = nextRandom(4);
78 if (s == 0) return a;
79 if (s == 1) return b;
80 if (s == 2) return c;
81 return d;
82}
83
84shared_ptr<Layer>ZoomLayer::zoom(__int64 seed, shared_ptr<Layer> sup, int count)
85{
86 shared_ptr<Layer>result = sup;
87 for (int i = 0; i < count; i++)
88 {
89 result = shared_ptr<Layer>(new ZoomLayer(seed + i, result));
90 }
91 return result;
92}