mirror of
https://github.com/Cubitect/cubiomes.git
synced 2025-09-22 11:04:57 -04:00
Expanded support of the match-any biome filter to the layered biome gen
This commit is contained in:
parent
91ba293616
commit
3ba5347451
59
finders.h
59
finders.h
@ -121,7 +121,10 @@ STRUCT(Pos)
|
|||||||
int x, z;
|
int x, z;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
CFB_APPROX = 0x01, // enabled aggresive filtering, trading accuracy
|
||||||
|
};
|
||||||
STRUCT(BiomeFilter)
|
STRUCT(BiomeFilter)
|
||||||
{
|
{
|
||||||
// bitfields for biomes required at their respecive layers
|
// bitfields for biomes required at their respecive layers
|
||||||
@ -137,10 +140,21 @@ STRUCT(BiomeFilter)
|
|||||||
uint64_t oceanToFind; // all required ocean types
|
uint64_t oceanToFind; // all required ocean types
|
||||||
|
|
||||||
int specialCnt; // number of special temperature categories required
|
int specialCnt; // number of special temperature categories required
|
||||||
int padding[1]; // unused
|
|
||||||
|
|
||||||
// excluded biomes that shall not be present
|
uint32_t flags;
|
||||||
|
|
||||||
|
// the biome exclusion aborts generation when the area contains no biomes
|
||||||
|
// that can generate the excluded biomes
|
||||||
|
uint64_t tempsToExcl;
|
||||||
|
uint64_t majorToExcl;
|
||||||
|
uint64_t edgesToExcl;
|
||||||
|
uint64_t raresToExcl, raresToExclM;
|
||||||
|
uint64_t shoreToExcl, shoreToExclM;
|
||||||
|
uint64_t riverToExcl, riverToExclM;
|
||||||
|
|
||||||
uint64_t biomeToExcl, biomeToExclM;
|
uint64_t biomeToExcl, biomeToExclM;
|
||||||
|
uint64_t biomeToFind, biomeToFindM;
|
||||||
|
uint64_t biomeToPick, biomeToPickM;
|
||||||
};
|
};
|
||||||
|
|
||||||
STRUCT(StrongholdIter)
|
STRUCT(StrongholdIter)
|
||||||
@ -648,22 +662,28 @@ uint64_t getHouseList(uint64_t worldSeed, int chunkX, int chunkZ, int *housesOut
|
|||||||
* excluded biomes. Biomes should not appear in both lists. Lists of length
|
* excluded biomes. Biomes should not appear in both lists. Lists of length
|
||||||
* zero may be passed as null.
|
* zero may be passed as null.
|
||||||
*/
|
*/
|
||||||
BiomeFilter setupBiomeFilter(
|
void setupBiomeFilter(
|
||||||
|
BiomeFilter *bf,
|
||||||
|
int mc, uint32_t flags,
|
||||||
const int *required, int requiredLen,
|
const int *required, int requiredLen,
|
||||||
const int *excluded, int excludedLen
|
const int *excluded, int excludedLen,
|
||||||
);
|
const int *matchany, int matchanyLen);
|
||||||
|
|
||||||
/* Starts to generate the specified range and checks if the biomes meet the
|
/* Starts to generate the specified range and checks if the biomes meet the
|
||||||
* requirements of the biome filter. If so, the area will be fully generated
|
* requirements of the biome filter, returning either:
|
||||||
* inside the cache (if != NULL), and the return value will be > 0.
|
* 0 (failed),
|
||||||
* Otherwise, the contents of 'cache' is undefined and a value <= 0 is returned.
|
* 1 (okay, area is fully generated), or
|
||||||
* More aggressive filtering can be enabled with the flags which may yield some
|
* 2 (okay, incomplete generation).
|
||||||
|
*
|
||||||
|
* The area will be generated inside the cache (if != NULL) but is only
|
||||||
|
* defined if the generation was fully completed (check return value).
|
||||||
|
* More aggressive filtering can be enabled with the flags which may yield
|
||||||
* some false negatives in exchange for speed.
|
* some false negatives in exchange for speed.
|
||||||
*
|
*
|
||||||
* The generator should be set up for the correct version, but the dimension
|
* The generator should be set up for the correct version, however the
|
||||||
* and seed will be applied internally. This will modify the generator into a
|
* dimension and seed will be applied internally. This will modify the
|
||||||
* partially initialized state that is not valid to use outside this function
|
* generator into a partially initialized state that is not valid to use
|
||||||
* without re-applying a seed.
|
* outside this function without re-applying a seed.
|
||||||
*
|
*
|
||||||
* @g : biome generator
|
* @g : biome generator
|
||||||
* @cache : working buffer and output (nullable)
|
* @cache : working buffer and output (nullable)
|
||||||
@ -674,18 +694,13 @@ BiomeFilter setupBiomeFilter(
|
|||||||
* @flags : enables features (see below)
|
* @flags : enables features (see below)
|
||||||
* @stop : occasional check for abort (nullable)
|
* @stop : occasional check for abort (nullable)
|
||||||
*/
|
*/
|
||||||
enum {
|
|
||||||
CFB_APPROX = 0x01, // enabled aggresive filtering, trading accuracy
|
|
||||||
CFB_MATCH_ANY = 0x10, // we need only one of the required biomes (1.18+)
|
|
||||||
};
|
|
||||||
int checkForBiomes(
|
int checkForBiomes(
|
||||||
Generator * g,
|
Generator * g,
|
||||||
int * cache,
|
int * cache,
|
||||||
Range r,
|
Range r,
|
||||||
int dim,
|
int dim,
|
||||||
uint64_t seed,
|
uint64_t seed,
|
||||||
BiomeFilter filter,
|
const BiomeFilter * filter,
|
||||||
uint32_t flags,
|
|
||||||
volatile char * stop // should be atomic, but is fine as stop flag
|
volatile char * stop // should be atomic, but is fine as stop flag
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -698,7 +713,6 @@ int checkForBiomes(
|
|||||||
* @seed : world seed
|
* @seed : world seed
|
||||||
* @x,z,w,h : requested area
|
* @x,z,w,h : requested area
|
||||||
* @filter : biomes to be checked for
|
* @filter : biomes to be checked for
|
||||||
* @protoCheck : enables more aggressive filtering when non-zero (MC >= 1.7)
|
|
||||||
*/
|
*/
|
||||||
int checkForBiomesAtLayer(
|
int checkForBiomesAtLayer(
|
||||||
LayerStack * ls,
|
LayerStack * ls,
|
||||||
@ -709,8 +723,7 @@ int checkForBiomesAtLayer(
|
|||||||
int z,
|
int z,
|
||||||
unsigned int w,
|
unsigned int w,
|
||||||
unsigned int h,
|
unsigned int h,
|
||||||
BiomeFilter filter,
|
const BiomeFilter * filter
|
||||||
int protoCheck
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Checks that the area (x,z,w,h) at layer Special, scale 1:1024 contains the
|
/* Checks that the area (x,z,w,h) at layer Special, scale 1:1024 contains the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user