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