the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at master 106 lines 3.8 kB view raw
1#pragma once 2#include "Biome.h" 3#include "BiomeSource.h" 4#include "BiomeCache.h" 5#include "net.minecraft.world.level.levelgen.synth.h" 6 7class ChunkPos; 8class Level; 9class Layer; 10class TilePos; 11class LevelType; 12 13class BiomeSource 14{ 15private: 16 shared_ptr<Layer> layer; 17 shared_ptr<Layer> zoomedLayer; 18public: 19 static const int CACHE_DIAMETER = 256; 20 21private: 22 BiomeCache *cache; 23 24 vector<Biome *> playerSpawnBiomes; 25 26protected: 27 void _init(); 28 void _init(__int64 seed, LevelType *generator); 29 BiomeSource(); 30 31public: 32 BiomeSource(__int64 seed, LevelType *generator); 33 BiomeSource(Level *level); 34private: 35 static bool getIsMatch(float *frac); // 4J added 36 static void getFracs(intArray indices, float *fracs); // 4J added 37public: 38#ifdef __PSVITA__ 39 static __int64 findSeed(LevelType *generator, bool* pServerRunning); // MGH - added pRunning, so we can early out of this on Vita as it can take up to 60 secs // 4J added 40#else 41 static __int64 findSeed(LevelType *generator); // 4J added 42#endif 43 ~BiomeSource(); 44 45public: 46 vector<Biome *> getPlayerSpawnBiomes() { return playerSpawnBiomes; } 47 virtual Biome *getBiome(ChunkPos *cp); 48 virtual Biome *getBiome(int x, int z); 49 50 // 4J - changed the interface for these methods, mainly for thread safety 51 virtual float getDownfall(int x, int z) const; 52 virtual floatArray getDownfallBlock(int x, int z, int w, int h) const; 53 virtual void getDownfallBlock(floatArray &downfalls, int x, int z, int w, int h) const; 54 55 // 4J - changed the interface for these methods, mainly for thread safety 56 virtual BiomeCache::Block *getBlockAt(int x, int y); 57 virtual float getTemperature(int x, int y, int z) const; 58 float scaleTemp(float temp, int y ) const; // 4J - brought forward from 1.2.3 59 virtual floatArray getTemperatureBlock(int x, int z, int w, int h) const; 60 virtual void getTemperatureBlock(floatArray& temperatures, int x, int z, int w, int h) const; 61 62 virtual BiomeArray getRawBiomeBlock(int x, int z, int w, int h) const; 63 virtual void getRawBiomeBlock(BiomeArray &biomes, int x, int z, int w, int h) const; 64 virtual void getRawBiomeIndices(intArray &biomes, int x, int z, int w, int h) const; // 4J added 65 virtual BiomeArray getBiomeBlock(int x, int z, int w, int h) const; 66 virtual void getBiomeBlock(BiomeArray& biomes, int x, int z, int w, int h, bool useCache) const; 67 68 virtual byteArray getBiomeIndexBlock(int x, int z, int w, int h) const; 69 virtual void getBiomeIndexBlock(byteArray& biomeIndices, int x, int z, int w, int h, bool useCache) const; 70 71 /** 72 * Checks if an area around a block contains only the specified biomes. 73 * Useful for placing elements like towns. 74 * 75 * This is a bit of a rough check, to make it as fast as possible. To ensure 76 * NO other biomes, add a margin of at least four blocks to the radius 77 */ 78 virtual bool containsOnly(int x, int z, int r, vector<Biome *> allowed); 79 80 /** 81 * Checks if an area around a block contains only the specified biome. 82 * Useful for placing elements like towns. 83 * 84 * This is a bit of a rough check, to make it as fast as possible. To ensure 85 * NO other biomes, add a margin of at least four blocks to the radius 86 */ 87 virtual bool containsOnly(int x, int z, int r, Biome *allowed); 88 89 /** 90 * Finds the specified biome within the radius. This will return a random 91 * position if several are found. This test is fairly rough. 92 * 93 * Returns null if the biome wasn't found 94 */ 95 virtual TilePos *findBiome(int x, int z, int r, Biome *toFind, Random *random); 96 97 /** 98 * Finds one of the specified biomes within the radius. This will return a 99 * random position if several are found. This test is fairly rough. 100 * 101 * Returns null if the biome wasn't found 102 */ 103 virtual TilePos *findBiome(int x, int z, int r, vector<Biome *> allowed, Random *random); 104 105 void update(); 106};