1.16 and Ruined Portals.

This commit is contained in:
Cubitect 2020-04-22 21:50:44 +02:00
parent 0186b530de
commit a2cec7fbba
6 changed files with 144 additions and 19 deletions

View File

@ -16,17 +16,36 @@ static DWORD WINAPI searchCompactBiomesThread(LPVOID data)
#endif
{
struct compactinfo_t info = *(struct compactinfo_t *)data;
int ax = -info.range, az = -info.range;
int w = 2*info.range, h = 2*info.range;
int64_t s;
LayerStack g = setupGenerator(MC_1_13);
int *cache = allocCache(&g.layers[L_VORONOI_ZOOM_1], info.range, info.range);
LayerStack g = setupGenerator(MC_1_14);
int *cache = allocCache(&g.layers[L_VORONOI_ZOOM_1], w, h);
for (s = info.seedStart; s < info.seedEnd; s++)
{
if(checkForBiomes(&g, cache, s,
-info.range, -info.range, 2*info.range, 2*info.range,
info.filter, 1))
if (checkForBiomes(&g, cache, s, ax, az, w, h, info.filter, 1))
{
int x, z;
int has_hut = 0, has_monument = 0;
for (z = -2; z < 2; z++)
{
for (x = -2; x < 2; x++)
{
Pos p;
p = getStructurePos(SWAMP_HUT_CONFIG, s, x, z);
if (isViableFeaturePos(Swamp_Hut, g, cache, p.x, p.z))
has_hut = 1;
p = getLargeStructurePos(MONUMENT_CONFIG, s, x, z);
if (isViableOceanMonumentPos(g, cache, p.x, p.z))
has_monument = 1;
}
}
if (!has_hut || !has_monument)
continue;
printf("%ld\n", s);
fflush(stdout);
}

View File

@ -73,6 +73,8 @@ int main(int argc, char *argv[])
g = setupGenerator(MC_1_7);
}
//seedFileName = "./seeds/quadbases_Q1b.txt";
if (access(seedFileName, F_OK))
{
printf("Seed base file does not exist: Creating new one.\n"

View File

@ -139,6 +139,68 @@ int isQuadFeatureBase(const StructureConfig sconf, const int64_t seed, const int
}
void checkVec4QuadBases(const StructureConfig sconf, int64_t seeds[256])
{
const int64_t reg00base = sconf.seed;
const int64_t reg01base = 341873128712 + sconf.seed;
const int64_t reg10base = 132897987541 + sconf.seed;
const int64_t reg11base = 341873128712 + 132897987541 + sconf.seed;
int i;
for (i = 0; i < 256; i++)
{
int64_t seed = seeds[i];
int64_t s;
int dx, dz;
s = (reg00base + seed) ^ 0x5deece66dLL;
s = (s * 0x5deece66dLL + 0xbLL) & 0xffffffffffff;
int x00 = (int)(s >> 17) % sconf.chunkRange;
if (x00 <= 16) { seeds[i] = 0; continue; }
s = (s * 0x5deece66dLL + 0xbLL) & 0xffffffffffff;
int z00 = (int)(s >> 17) % sconf.chunkRange;
if (z00 <= 16) { seeds[i] = 0; continue; }
x00 -= 32; z00 -= 32;
s = (reg11base + seed) ^ 0x5deece66dLL;
s = (s * 0x5deece66dLL + 0xbLL) & 0xffffffffffff;
int x11 = (int)(s >> 17) % sconf.chunkRange;
dx = x11 - x00;
if (dx >= 16) { seeds[i] = 0; continue; }
s = (s * 0x5deece66dLL + 0xbLL) & 0xffffffffffff;
int z11 = (int)(s >> 17) % sconf.chunkRange;
dz = z11 - z00;
if (dz >= 16) { seeds[i] = 0; continue; }
if (dx*dx + dz*dz >= 16*16) { seeds[i] = 0; continue; }
s = (reg01base + seed) ^ 0x5deece66dLL;
s = (s * 0x5deece66dLL + 0xbLL) & 0xffffffffffff;
int x01 = (int)(s >> 17) % sconf.chunkRange;
dx = x01 - x00;
if (dx >= 16) { seeds[i] = 0; continue; }
s = (s * 0x5deece66dLL + 0xbLL) & 0xffffffffffff;
int z01 = (int)(s >> 17) % sconf.chunkRange;
z01 -= 32;
dz = z11 - z01;
if (dz >= 16) { seeds[i] = 0; continue; }
s = (reg10base + seed) ^ 0x5deece66dLL;
s = (s * 0x5deece66dLL + 0xbLL) & 0xffffffffffff;
int x10 = (int)(s >> 17) % sconf.chunkRange;
x10 -= 32;
dx = x01 - x10;
if (dx >= 16) { seeds[i] = 0; continue; }
s = (s * 0x5deece66dLL + 0xbLL) & 0xffffffffffff;
int z10 = (int)(s >> 17) % sconf.chunkRange;
dz = z10 - z01;
if (dz >= 16) { seeds[i] = 0; continue; }
dx = (x11 > x01 ? x11 : x01) - (x10 < x00 ? x10 : x00);
dz = (z11 > z10 ? z11 : z10) - (z01 < z00 ? z01 : z00);
if (dx*dx + dz*dz >= 256) { seeds[i] = 0; continue; } // 15.5 chunks
}
}
int isTriFeatureBase(const StructureConfig sconf, const int64_t seed, const int qual)
{
// seed offsets for the regions (0,0) to (1,1)
@ -526,6 +588,11 @@ static DWORD WINAPI search4QuadBasesThread(LPVOID data)
lowerBits[i] = (lowerBaseBitsQ2[i] - stc.seed) & 0xffff;
}
}
else if (stc.properties == 0 && stc.chunkRange == 24 && info.quality == -1)
{
lowerBitsCnt = 0x100;
for (i = 0; i < lowerBitsCnt; i++) lowerBits[i] = i << 8;
}
else
{
printf("WARN search4QuadBasesThread: "
@ -584,11 +651,30 @@ static DWORD WINAPI search4QuadBasesThread(LPVOID data)
while (seed < end)
{
if (isQuadBase(info.sconf, seed, info.quality))
if (info.quality >= 0)
{
fprintf(fp, "%" PRId64"\n", seed);
fflush(fp);
//printf("Thread %d: %" PRId64"\n", info.threadID, seed);
if (isQuadBase(info.sconf, seed, info.quality))
{
fprintf(fp, "%" PRId64"\n", seed);
fflush(fp);
}
}
else
{
int64_t st[0x100];
int i;
for (i = 0; i < 0x100; i++)
st[i] = seed + i;
checkVec4QuadBases(info.sconf, st);
for (i = 0; i < 0x100; i++)
{
int64_t base = st[i];
if (base)
{
fprintf(fp, "%" PRId64"\n", base);
fflush(fp);
}
}
}
lowerBitsIdx++;
@ -1321,6 +1407,8 @@ int isViableFeaturePos(const int structureType, const LayerStack g, int *cache,
case Ocean_Ruin:
case Shipwreck:
return isOceanic(biomeID);
case Ruined_Portal:
return 1;
default:
fprintf(stderr, "Structure type is not valid for the scattered feature biome check.\n");
exit(1);

View File

@ -29,10 +29,11 @@ typedef pthread_t thread_id_t;
enum
{
Desert_Pyramid, Igloo, Jungle_Pyramid, Swamp_Hut,
Village, Ocean_Ruin, Shipwreck, Monument, Mansion, Outpost
Village, Ocean_Ruin, Shipwreck, Monument, Mansion, Outpost,
Ruined_Portal
};
enum
enum // village house types prior to 1.14
{
HouseSmall, Church, Library, WoodHut, Butcher, FarmLarge, FarmSmall,
Blacksmith, HouseLarge, HOUSE_NUM
@ -45,9 +46,13 @@ STRUCT(StructureConfig)
int properties;
};
/* For desert temples, igloos, jungle temples and witch huts prior to 1.13. */
/* for desert temples, igloos, jungle temples and witch huts prior to 1.13 */
static const StructureConfig FEATURE_CONFIG = { 14357617, 32, 24, 0};
/* ocean features before 1.16 */
static const StructureConfig OCEAN_RUIN_CONFIG_113 = { 14357621, 16, 8, 0};
static const StructureConfig SHIPWRECK_CONFIG_113 = {165745295, 15, 7, 0};
/* 1.13 separated feature seeds by type */
static const StructureConfig DESERT_PYRAMID_CONFIG = { 14357617, 32, 24, 0};
static const StructureConfig IGLOO_CONFIG = { 14357618, 32, 24, 0};
@ -56,10 +61,11 @@ static const StructureConfig SWAMP_HUT_CONFIG = { 14357620, 32, 24, 0};
static const StructureConfig OUTPOST_CONFIG = {165745296, 32, 24, 0};
static const StructureConfig VILLAGE_CONFIG = { 10387312, 32, 24, 0};
static const StructureConfig OCEAN_RUIN_CONFIG = { 14357621, 16, 8, 0};
static const StructureConfig SHIPWRECK_CONFIG = {165745295, 15, 7, 0};
static const StructureConfig OCEAN_RUIN_CONFIG = { 14357621, 20, 12, 0};
static const StructureConfig SHIPWRECK_CONFIG = {165745295, 24, 20, 0};
static const StructureConfig MONUMENT_CONFIG = { 10387313, 32, 27, LARGE_STRUCT};
static const StructureConfig MANSION_CONFIG = { 10387319, 80, 60, LARGE_STRUCT};
static const StructureConfig RUINED_PORTAL_CONFIG = { 34222645, 40, 25, 0}; // overworld variant
// structures that check each chunk individually
static const StructureConfig TREASURE_CONFIG = { 10387320, 1, 0, CHUNK_STRUCT};
@ -233,7 +239,7 @@ int isTriBase(const StructureConfig sconf, const int64_t seed, const int64_t qua
void search4QuadBases(const char *fnam, int threads,
const StructureConfig structureConfig, int quality);
void checkVec4QuadBases(const StructureConfig sconf, int64_t seeds[256]);
//==============================================================================
// Finding Structure Positions

View File

@ -41,7 +41,7 @@ void initBiomes()
initAddBiome(taiga, Lush, Taiga, 0.25, hMidPlains);
initAddBiome(swamp, Lush, Swamp, 0.8, hPartiallySubmerged);
initAddBiome(river, Lush, River, 0.5, hShallowWaters);
initAddBiome(nether, Warm, Hell, 2.0, hDefault);
initAddBiome(nether_wastes, Warm, Nether, 2.0, hDefault);
initAddBiome(the_end, Lush, Sky, 0.5, hDefault);
initAddBiome(frozen_ocean, Oceanic, Ocean, 0.0, hOceans);
initAddBiome(frozen_river, Cold, River, 0.0, hShallowWaters);
@ -112,6 +112,11 @@ void initBiomes()
initAddBiome(bamboo_jungle, Lush, Jungle, 0.95, hDefault);
initAddBiome(bamboo_jungle_hills, Lush, Jungle, 0.95, hLowHills);
initAddBiome(soul_sand_valley, Warm, Nether, 2.0, hDefault);
initAddBiome(crimson_forest, Warm, Nether, 2.0, hDefault);
initAddBiome(warped_forest, Warm, Nether, 2.0, hDefault);
initAddBiome(basalt_deltas, Warm, Nether, 2.0, hDefault);
}

View File

@ -49,7 +49,7 @@ enum BiomeID
taiga,
swamp, swampland = swamp,
river,
nether, hell = nether,
nether_wastes, hell = nether_wastes,
the_end, sky = the_end,
// 10
frozen_ocean, frozenOcean = frozen_ocean,
@ -125,13 +125,18 @@ enum BiomeID
modified_badlands_plateau = badlands_plateau+128,
// 1.14
bamboo_jungle = 168,
bamboo_jungle_hills = 169
bamboo_jungle_hills = 169,
// 1.16
soul_sand_valley = 170,
crimson_forest = 171,
warped_forest = 172,
basalt_deltas = 173,
};
enum BiomeType
{
Void = -1,
Ocean, Plains, Desert, Hills, Forest, Taiga, Swamp, River, Hell, Sky, Snow, MushroomIsland, Beach, Jungle, StoneBeach, Savanna, Mesa,
Ocean, Plains, Desert, Hills, Forest, Taiga, Swamp, River, Nether, Sky, Snow, MushroomIsland, Beach, Jungle, StoneBeach, Savanna, Mesa,
BTYPE_NUM
};