mirror of
https://github.com/Cubitect/cubiomes.git
synced 2025-09-22 11:04:57 -04:00
Added available biome checker
This commit is contained in:
parent
95723f90bb
commit
136e645ce9
36
finders.c
36
finders.c
@ -2676,8 +2676,7 @@ BiomeFilter setupBiomeFilter(
|
||||
}
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
Generator *g;
|
||||
int *ids;
|
||||
Range r;
|
||||
@ -2812,7 +2811,7 @@ int checkForBiomes(
|
||||
//if (err) break;
|
||||
}
|
||||
while (0);
|
||||
if (err || (stop && *stop) || (flags & CFB_APPROX))
|
||||
if (err || (stop && *stop) || (flags & CFB_APPROX))
|
||||
goto L_end;
|
||||
}
|
||||
|
||||
@ -2879,12 +2878,12 @@ int checkForBiomes(
|
||||
}
|
||||
else
|
||||
{ // no excluded: do the current biomes satisfy the condition?
|
||||
if (((info.b & info.breq) ^ info.breq) == 0 &&
|
||||
if (((info.b & info.breq) ^ info.breq) == 0 &&
|
||||
((info.m & info.mreq) ^ info.mreq) == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
L_end:
|
||||
if (stop && *stop)
|
||||
{
|
||||
@ -2896,7 +2895,7 @@ L_end:
|
||||
if (flags & CFB_MATCH_ANY)
|
||||
ret &= (info.b & info.breq) || (info.m & info.mreq);
|
||||
else
|
||||
ret &= (((info.b & info.breq) ^ info.breq) == 0 &&
|
||||
ret &= (((info.b & info.breq) ^ info.breq) == 0 &&
|
||||
((info.m & info.mreq) ^ info.mreq) == 0);
|
||||
}
|
||||
|
||||
@ -3510,6 +3509,31 @@ int canBiomeGenerate(int layerId, int mc, int id)
|
||||
return isOverworld(mc, id);
|
||||
}
|
||||
|
||||
void getAvailableBiomes(uint64_t *mL, uint64_t *mM, int layerId, int mc)
|
||||
{
|
||||
*mL = *mM = 0;
|
||||
int i;
|
||||
if (mc >= MC_1_18)
|
||||
{
|
||||
for (i = 0; i < 64; i++)
|
||||
{
|
||||
if (isOverworld(mc, i))
|
||||
*mL |= (1ULL << i);
|
||||
if (isOverworld(mc, i+128))
|
||||
*mM |= (1ULL << i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 64; i++)
|
||||
{
|
||||
if (canBiomeGenerate(layerId, mc, i))
|
||||
*mL |= (1ULL << i);
|
||||
if (canBiomeGenerate(layerId, mc, i+128))
|
||||
*mM |= (1ULL << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: This function requires testing across versions
|
||||
void genPotential(uint64_t *mL, uint64_t *mM, int layer, int mc, int id)
|
||||
|
12
finders.h
12
finders.h
@ -134,6 +134,7 @@ STRUCT(BiomeFilter)
|
||||
uint64_t oceanToFind; // all required ocean types
|
||||
|
||||
int specialCnt; // number of special temperature categories required
|
||||
int padding[1]; // unused
|
||||
|
||||
// excluded biomes that shall not be present
|
||||
uint64_t biomeToExcl, biomeToExclM;
|
||||
@ -726,13 +727,20 @@ int checkForTemps(LayerStack *g, uint64_t seed, int x, int z, int w, int h, cons
|
||||
*/
|
||||
int canBiomeGenerate(int layerId, int mc, int biomeID);
|
||||
|
||||
/* Given a biome 'id' at a generation 'layer', this functions finds which
|
||||
/* Given a biome 'id' at a generation 'layerId', this functions finds which
|
||||
* biomes may generate from it. The result is stored in the bitfields:
|
||||
* mL : for ids 0-63
|
||||
* mM : for ids 128-191
|
||||
*/
|
||||
void genPotential(uint64_t *mL, uint64_t *mM, int layer, int mc, int id);
|
||||
void genPotential(uint64_t *mL, uint64_t *mM, int layerId, int mc, int id);
|
||||
|
||||
/* Gets the biomes that can generate in the given version and layer ID.
|
||||
* In contrast to canBiomeGenerate() and genPotential() it also supports 1.18+,
|
||||
* where the layerId is ignored.
|
||||
* mL : for ids 0-63
|
||||
* mM : for ids 128-191
|
||||
*/
|
||||
void getAvailableBiomes(uint64_t *mL, uint64_t *mM, int layerId, int mc);
|
||||
|
||||
//==============================================================================
|
||||
// Biome Noise Finders (for 1.18+)
|
||||
|
Loading…
x
Reference in New Issue
Block a user