From 761b876b2fb6883fdc2c4308b810a2c2a626c2d7 Mon Sep 17 00:00:00 2001 From: Cubitect Date: Wed, 1 Jun 2022 20:30:02 +0200 Subject: [PATCH] Fixed for strange historical village generation 1) false positives for zero-sized villages in pre 1.10 2) unique village biome check for 1.15 exclusively --- finders.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/finders.c b/finders.c index bc9bb62..d6e0e0c 100644 --- a/finders.c +++ b/finders.c @@ -1958,14 +1958,34 @@ L_feature: case Village: if (g->mc <= MC_1_17) { - g->entry = &g->ls.layers[L_RIVER_MIX_4]; - sampleX = (chunkX << 2) + 2; - sampleZ = (chunkZ << 2) + 2; + if (g->mc == MC_1_15) + { // exclusively in MC_1_15, villages used the same biome check + // as other structures + g->entry = &g->ls.layers[L_VORONOI_1]; + sampleX = (chunkX << 4) + 9; + sampleZ = (chunkZ << 4) + 9; + } + else + { + g->entry = &g->ls.layers[L_RIVER_MIX_4]; + sampleX = (chunkX << 2) + 2; + sampleZ = (chunkZ << 2) + 2; + } id = getBiomeAt(g, 0, sampleX, 0, sampleZ); if (id < 0 || !isViableFeatureBiome(g->mc, structureType, id)) goto L_not_viable; if (flags && (uint32_t) id != flags) goto L_not_viable; + if (g->mc <= MC_1_9) + { // before MC_1_10 villages did not spread into invalid biomes, + // which could cause them to fail to generate on the first + // check at block (2, 2) in the starting chunk + sampleX = (chunkX << 4) + 2; + sampleZ = (chunkZ << 4) + 2; + id = getBiomeAt(g, 1, sampleX, 0, sampleZ); + if (id < 0 || !isViableFeatureBiome(g->mc, structureType, id)) + goto L_not_viable; + } viable = id; // biome for viablility, useful for further analysis goto L_viable; }