Skip to content

Commit

Permalink
Update end city terrain check for 1.19+
Browse files Browse the repository at this point in the history
  • Loading branch information
Cubitect committed Jun 29, 2023
1 parent d278faf commit 4c8b36e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions finders.c
Original file line number Diff line number Diff line change
Expand Up @@ -1601,9 +1601,10 @@ int getSurfaceHeight(
void sampleNoiseColumnEnd(double column[], const SurfaceNoise *sn,
const EndNoise *en, int x, int z, int colymin, int colymax);

int isViableEndCityTerrain(const EndNoise *en, const SurfaceNoise *sn,
int isViableEndCityTerrain(const Generator *g, const SurfaceNoise *sn,
int blockX, int blockZ)
{
const EndNoise *en = &g->en;
int chunkX = blockX >> 4;
int chunkZ = blockZ >> 4;
blockX = chunkX * 16 + 7;
Expand All @@ -1624,7 +1625,11 @@ int isViableEndCityTerrain(const EndNoise *en, const SurfaceNoise *sn,
y0, y1, 4, (blockX & 7) / 8.0, (blockZ & 7) / 8.0);

uint64_t cs;
setSeed(&cs, chunkX + chunkZ * 10387313ULL);
if (en->mc <= MC_1_18)
setSeed(&cs, chunkX + chunkZ * 10387313ULL);
else
cs = chunkGenerateRnd(g->seed, chunkX, chunkZ);

switch (nextInt(&cs, 4))
{
case 0: // (++) 0
Expand Down
2 changes: 1 addition & 1 deletion finders.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ int isViableStructureTerrain(int structType, Generator *g, int blockX, int block
* The world seed should be applied to the EndNoise and SurfaceNoise before
* calling this function. (Use initSurfaceNoiseEnd() for initialization.)
*/
int isViableEndCityTerrain(const EndNoise *en, const SurfaceNoise *sn,
int isViableEndCityTerrain(const Generator *g, const SurfaceNoise *sn,
int blockX, int blockZ);


Expand Down

0 comments on commit 4c8b36e

Please sign in to comment.