mirror of
https://github.com/Cubitect/cubiomes.git
synced 2025-09-22 11:04:57 -04:00
Added rudimentary check for terrain, which should get slightly more accurate structure positions.
This commit is contained in:
parent
189b7db622
commit
18a16f8000
43
finders.c
43
finders.c
@ -2063,6 +2063,49 @@ L_not_viable:
|
||||
}
|
||||
|
||||
|
||||
int isViableStructureTerrain(int structType, Generator *g, int x, int z)
|
||||
{
|
||||
int id, sx, sz;
|
||||
if (g->mc < MC_1_18)
|
||||
return 1;
|
||||
if (structType == Desert_Pyramid || structType == Jungle_Temple)
|
||||
{
|
||||
sx = (structType == Desert_Pyramid ? 21 : 12);
|
||||
sz = (structType == Desert_Pyramid ? 21 : 15);
|
||||
}
|
||||
else if (structType == Mansion)
|
||||
{
|
||||
int cx = x >> 4, cz = z >> 4;
|
||||
uint64_t rng = chunkGenerateRnd(g->seed, cx, cz);
|
||||
int rot = nextInt(&rng, 4);
|
||||
sx = 5;
|
||||
sz = 5;
|
||||
if (rot == 0) { sx = -5; }
|
||||
if (rot == 1) { sx = -5; sz = -5; }
|
||||
if (rot == 2) { sz = -5; }
|
||||
x = (cx << 4) + 7;
|
||||
z = (cz << 4) + 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
id = getBiomeAt(g, 4, (x+sx)>>2, 15, (z)>>2);
|
||||
if (isOceanic(id) || id == river || id == frozen_river)
|
||||
return 0;
|
||||
id = getBiomeAt(g, 4, (x)>>2, 15, (z+sz)>>2);
|
||||
if (isOceanic(id) || id == river || id == frozen_river)
|
||||
return 0;
|
||||
id = getBiomeAt(g, 4, (x+sx)>>2, 15, (z+sz)>>2);
|
||||
if (isOceanic(id) || id == river || id == frozen_river)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Given bordering noise columns and a fractional position between those,
|
||||
* determine the surface block height (i.e. where the interpolated noise > 0).
|
||||
* Note that the noise columns should be of size: ncolxz[ colheight+1 ]
|
||||
|
12
finders.h
12
finders.h
@ -35,7 +35,7 @@ enum StructureType
|
||||
{
|
||||
Feature, // for locations of temple generation attempts pre 1.13
|
||||
Desert_Pyramid,
|
||||
Jungle_Pyramid,
|
||||
Jungle_Temple, Jungle_Pyramid = Jungle_Temple,
|
||||
Swamp_Hut,
|
||||
Igloo,
|
||||
Village,
|
||||
@ -579,6 +579,16 @@ int isViableStructurePos(int structType, Generator *g, int blockX, int blockZ, u
|
||||
*/
|
||||
int isViableFeatureBiome(int mc, int structureType, int biomeID);
|
||||
|
||||
/* Some structures in 1.18 now only spawn if the surface is sufficiently high
|
||||
* at all four bounding box corners. This affects primarily Desert_Pyramids,
|
||||
* Jungle_Temples and Mansions.
|
||||
* Currently cubiomes does not provide overworld surface height and cannot
|
||||
* check it, but we can rule out some unlikely positions based biomes.
|
||||
*
|
||||
* This function is meant only for the 1.18 Overworld and is subject to change.
|
||||
*/
|
||||
int isViableStructureTerrain(int structType, Generator *g, int blockX, int blockZ);
|
||||
|
||||
/* End Cities require a sufficiently high surface in addition to a biome check.
|
||||
* The world seed should be applied to the EndNoise and SurfaceNoise before
|
||||
* calling this function. (Use initSurfaceNoiseEnd() for initialization.)
|
||||
|
Loading…
x
Reference in New Issue
Block a user