mirror of
https://github.com/Cubitect/cubiomes.git
synced 2025-09-23 03:33:50 -04:00
Added 1.19 deep_dark and mangrove_swamp biomes + ancient_city structures
This commit is contained in:
parent
136e645ce9
commit
0933804f15
2231
biome_tree.c
2231
biome_tree.c
File diff suppressed because it is too large
Load Diff
91
finders.c
91
finders.c
@ -154,6 +154,9 @@ int getStructureConfig(int structureType, int mc, StructureConfig *sconf)
|
||||
case Outpost:
|
||||
*sconf = OUTPOST_CONFIG;
|
||||
return mc >= MC_1_14;
|
||||
case Ancient_City:
|
||||
*sconf = ANCIENT_CITY_CONFIG;
|
||||
return mc >= MC_1_19;
|
||||
case Treasure:
|
||||
*sconf = TREASURE_CONFIG;
|
||||
return mc >= MC_1_13;
|
||||
@ -209,6 +212,7 @@ int getStructurePos(int structureType, int mc, uint64_t seed, int regX, int regZ
|
||||
case Shipwreck:
|
||||
case Ruined_Portal:
|
||||
case Ruined_Portal_N:
|
||||
case Ancient_City:
|
||||
*pos = getFeaturePos(sconf, seed, regX, regZ);
|
||||
return 1;
|
||||
|
||||
@ -1606,6 +1610,10 @@ int isViableFeatureBiome(int mc, int structureType, int biomeID)
|
||||
case Ruined_Portal_N:
|
||||
return mc >= MC_1_16;
|
||||
|
||||
case Ancient_City:
|
||||
if (mc < MC_1_19) return 0;
|
||||
return biomeID == deep_dark;
|
||||
|
||||
case Treasure:
|
||||
if (mc < MC_1_13) return 0;
|
||||
return biomeID == beach || biomeID == snowy_beach;
|
||||
@ -2108,6 +2116,26 @@ L_feature:
|
||||
goto L_viable;
|
||||
goto L_not_viable;
|
||||
|
||||
case Ancient_City:
|
||||
if (g->mc < MC_1_19)
|
||||
goto L_not_viable;
|
||||
{
|
||||
StructureVariant vt = getAncientCityType(g->mc, g->seed, x, z);
|
||||
switch (vt.rotation) {
|
||||
case 0: sampleX = -1+vt.sx; sampleZ = -1+vt.sz; break;
|
||||
case 1: sampleX = +1-vt.sz; sampleZ = -1+vt.sx; break;
|
||||
case 2: sampleX = +1-vt.sx; sampleZ = +1-vt.sz; break;
|
||||
case 3: sampleX = -1+vt.sz; sampleZ = +1-vt.sx; break;
|
||||
default: return 0; // unreachable
|
||||
}
|
||||
}
|
||||
sampleX = ((chunkX << 5) + sampleX) / 2 >> 2;
|
||||
sampleZ = ((chunkZ << 5) + sampleZ) / 2 >> 2;
|
||||
id = getBiomeAt(g, 4, sampleX, (-51 >> 2), sampleZ);
|
||||
if (id < 0 || !isViableFeatureBiome(g->mc, structureType, id))
|
||||
goto L_not_viable;
|
||||
goto L_viable;
|
||||
|
||||
case Mineshaft:
|
||||
goto L_viable;
|
||||
|
||||
@ -2371,6 +2399,23 @@ StructureVariant getBastionType(int mc, uint64_t seed, int blockX, int blockZ)
|
||||
return r;
|
||||
}
|
||||
|
||||
StructureVariant getAncientCityType(int mc, uint64_t seed, int blockX, int blockZ)
|
||||
{
|
||||
(void) mc;
|
||||
StructureVariant r = { 0, 0, 0, 0, 0, 0, 0 };
|
||||
uint64_t rng = chunkGenerateRnd(seed, blockX >> 4, blockZ >> 4);
|
||||
r.biome = -1;
|
||||
r.rotation = nextInt(&rng, 4);
|
||||
r.variant = nextInt(&rng, 3);
|
||||
switch (r.variant)
|
||||
{
|
||||
case 0: r.sx = 18; r.sy = 31; r.sz = 41; break; // city_center_1
|
||||
case 1: r.sx = 18; r.sy = 31; r.sz = 41; break; // city_center_2
|
||||
case 2: r.sx = 18; r.sy = 30; r.sz = 41; break; // city_center_3
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
uint64_t getHouseList(uint64_t worldSeed, int chunkX, int chunkZ,
|
||||
int *out)
|
||||
{
|
||||
@ -4188,6 +4233,15 @@ static const int g_biome_para_range_18[][13] = {
|
||||
{stony_peaks , 2000, 5500, IMIN, IMAX, -1899, IMAX, IMIN,-3750, IMIN, IMAX, -9333, 9333},
|
||||
};
|
||||
|
||||
static const int g_biome_para_range_19_diff[][13] = {
|
||||
{eroded_badlands , 5500, IMAX, IMIN,-1000, -1899, IMAX, IMIN, 500, IMIN, IMAX, -500, IMAX},
|
||||
{grove , IMIN, 2000, -1000, IMAX, -1899, IMAX, IMIN,-3750, IMIN,10499, IMIN, IMAX},
|
||||
{snowy_slopes , IMIN, 2000, IMIN,-1000, -1899, IMAX, IMIN,-3750, IMIN,10499, IMIN, IMAX},
|
||||
{jagged_peaks , IMIN, 2000, IMIN, IMAX, -1899, IMAX, IMIN,-3750, IMIN,10499, -9333,-4001},
|
||||
{deep_dark , IMIN, IMAX, IMIN, IMAX, IMIN, IMAX, IMIN, 1818, 10500, IMAX, IMIN, IMAX},
|
||||
{mangrove_swamp , 2000, IMAX, IMIN, IMAX, -1100, IMAX, 5500, IMAX, IMIN, IMAX, IMIN, IMAX},
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the min/max possible noise parameter values at which the given biome
|
||||
* can generate. The values are in min/max pairs in order:
|
||||
@ -4197,7 +4251,18 @@ const int *getBiomeParaLimits(int mc, int id)
|
||||
{
|
||||
if (mc < MC_1_18)
|
||||
return NULL;
|
||||
int i, n = sizeof(g_biome_para_range_18) / sizeof(g_biome_para_range_18[0]);
|
||||
int i, n;
|
||||
if (mc >= MC_1_19)
|
||||
{
|
||||
n = sizeof(g_biome_para_range_19_diff) / sizeof(g_biome_para_range_19_diff[0]);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
if (g_biome_para_range_19_diff[i][0] == id)
|
||||
return &g_biome_para_range_19_diff[i][1];
|
||||
}
|
||||
}
|
||||
|
||||
n = sizeof(g_biome_para_range_18) / sizeof(g_biome_para_range_18[0]);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
if (g_biome_para_range_18[i][0] == id)
|
||||
@ -4212,24 +4277,24 @@ const int *getBiomeParaLimits(int mc, int id)
|
||||
*/
|
||||
void getPossibleBiomesForLimits(char ids[256], int mc, int limits[6][2])
|
||||
{
|
||||
int i, j, n;
|
||||
int i, j;
|
||||
memset(ids, 0, 256*sizeof(char));
|
||||
|
||||
if (mc >= MC_1_18)
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
n = sizeof(g_biome_para_range_18) / sizeof(g_biome_para_range_18[0]);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
const int *bp = &g_biome_para_range_18[i][1];
|
||||
int id = bp[-1];
|
||||
if (!isOverworld(mc, i))
|
||||
continue;
|
||||
const int *bp = getBiomeParaLimits(mc, i);
|
||||
if (!bp)
|
||||
continue;
|
||||
|
||||
for (j = 0; j < 6; j++)
|
||||
{
|
||||
if (limits[j][0] <= bp[2*j+1] && limits[j][1] >= bp[2*j+0])
|
||||
ids[id]++;
|
||||
if (limits[j][0] > bp[2*j+1] || limits[j][1] < bp[2*j+0])
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 256; i++)
|
||||
ids[i] = ids[i] >= 6;
|
||||
if (j >= 6)
|
||||
ids[bp[-1]] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,7 @@ enum StructureType
|
||||
Outpost,
|
||||
Ruined_Portal,
|
||||
Ruined_Portal_N,
|
||||
Ancient_City,
|
||||
Treasure,
|
||||
Mineshaft,
|
||||
Fortress,
|
||||
@ -98,6 +99,7 @@ _sc MONUMENT_CONFIG = { 10387313, 32, 27, Monument, LARGE_STRUCT};
|
||||
_sc MANSION_CONFIG = { 10387319, 80, 60, Mansion, LARGE_STRUCT};
|
||||
_sc RUINED_PORTAL_CONFIG = { 34222645, 40, 25, Ruined_Portal, 0}; // overworld
|
||||
_sc RUINED_PORTAL_N_CONFIG = { 34222645, 25, 15, Ruined_Portal_N, 0}; // nether
|
||||
_sc ANCIENT_CITY_CONFIG = { 20083232, 24, 16, Ancient_City, 0};
|
||||
|
||||
_sc TREASURE_CONFIG = { 10387320, 1, 1, Treasure, CHUNK_STRUCT};
|
||||
_sc MINESHAFT_CONFIG = { 0, 1, 1, Mineshaft, CHUNK_STRUCT};
|
||||
@ -616,10 +618,8 @@ uint64_t chunkGenerateRnd(uint64_t worldSeed, int chunkX, int chunkZ)
|
||||
}
|
||||
|
||||
StructureVariant getVillageType(int mc, uint64_t seed, int blockX, int blockZ, int biomeID);
|
||||
|
||||
// For 1.18
|
||||
StructureVariant getBastionType(int mc, uint64_t seed, int blockX, int blockZ);
|
||||
|
||||
StructureVariant getBastionType(int mc, uint64_t seed, int blockX, int blockZ); // 1.18
|
||||
StructureVariant getAncientCityType(int mc, uint64_t seed, int blockX, int blockZ);
|
||||
|
||||
/* Finds the number of each type of house that generate in a village
|
||||
* (mc < MC_1_14)
|
||||
|
9
layers.c
9
layers.c
@ -18,6 +18,9 @@ int biomeExists(int mc, int id)
|
||||
if (id >= small_end_islands && id <= end_barrens)
|
||||
return 1;
|
||||
|
||||
if (id == deep_dark || id == mangrove_swamp)
|
||||
return mc >= MC_1_19;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case ocean:
|
||||
@ -1317,7 +1320,6 @@ float getSpline(const Spline *sp, const float *vals)
|
||||
|
||||
void initBiomeNoise(BiomeNoise *bn, int mc)
|
||||
{
|
||||
(void)mc;
|
||||
SplineStack *ss = &bn->ss;
|
||||
memset(ss, 0, sizeof(*ss));
|
||||
Spline *sp = &ss->stack[ss->len++];
|
||||
@ -1340,6 +1342,7 @@ void initBiomeNoise(BiomeNoise *bn, int mc)
|
||||
addSplineVal(sp, 1.00F, sp4, 0.0F);
|
||||
|
||||
bn->sp = sp;
|
||||
bn->mc = mc;
|
||||
}
|
||||
|
||||
#if __cplusplus
|
||||
@ -1347,7 +1350,7 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
int p2overworld(const uint64_t np[6], uint64_t *dat);
|
||||
int p2overworld(int mc, const uint64_t np[6], uint64_t *dat);
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
@ -1394,7 +1397,7 @@ int sampleBiomeNoise(const BiomeNoise *bn, int64_t *np, int x, int y, int z,
|
||||
|
||||
int id = none;
|
||||
if (!(flags & SAMPLE_NO_BIOME))
|
||||
id = p2overworld((const uint64_t*)p_np, dat);
|
||||
id = p2overworld(bn->mc, (const uint64_t*)p_np, dat);
|
||||
return id;
|
||||
}
|
||||
|
||||
|
8
layers.h
8
layers.h
@ -8,13 +8,13 @@
|
||||
|
||||
|
||||
/* Minecraft versions */
|
||||
enum MCversion
|
||||
enum MCVersion
|
||||
{
|
||||
MC_1_0, // <=1.0 Experimental!
|
||||
MC_1_1, MC_1_2, MC_1_3, MC_1_4, MC_1_5, MC_1_6,
|
||||
MC_1_7, MC_1_8, MC_1_9, MC_1_10, MC_1_11, MC_1_12,
|
||||
MC_1_13, MC_1_14, MC_1_15, MC_1_16, MC_1_17, MC_1_18,
|
||||
MC_NEWEST = MC_1_18,
|
||||
MC_1_19, MC_NEWEST = MC_1_19,
|
||||
};
|
||||
|
||||
enum BiomeID
|
||||
@ -132,6 +132,9 @@ enum BiomeID
|
||||
windswept_gravelly_hills = gravelly_mountains,
|
||||
windswept_savanna = shattered_savanna,
|
||||
wooded_badlands = wooded_badlands_plateau,
|
||||
// 1.19
|
||||
deep_dark = 183,
|
||||
mangrove_swamp = 184,
|
||||
};
|
||||
|
||||
|
||||
@ -345,6 +348,7 @@ STRUCT(BiomeNoise)
|
||||
Spline *sp;
|
||||
SplineStack ss;
|
||||
int previdx;
|
||||
int mc;
|
||||
};
|
||||
|
||||
|
||||
|
8
util.c
8
util.c
@ -29,12 +29,14 @@ const char* mc2str(int mc)
|
||||
case MC_1_16: return "1.16"; break;
|
||||
case MC_1_17: return "1.17"; break;
|
||||
case MC_1_18: return "1.18"; break;
|
||||
case MC_1_19: return "1.19"; break;
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int str2mc(const char *s)
|
||||
{
|
||||
if (!strcmp(s, "1.19")) return MC_1_19;
|
||||
if (!strcmp(s, "1.18")) return MC_1_18;
|
||||
if (!strcmp(s, "1.17")) return MC_1_17;
|
||||
if (!strcmp(s, "1.16")) return MC_1_16;
|
||||
@ -181,6 +183,9 @@ const char *biome2str(int mc, int id)
|
||||
case stony_peaks: return "stony_peaks";
|
||||
case jagged_peaks: return "jagged_peaks";
|
||||
case frozen_peaks: return "frozen_peaks";
|
||||
// 1.19
|
||||
case deep_dark: return "deep_dark";
|
||||
case mangrove_swamp: return "mangrove_swamp";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -304,6 +309,9 @@ void initBiomeColors(unsigned char biomeColors[256][3])
|
||||
setBiomeColor(biomeColors, stony_peaks, 123, 143, 116); // TBD
|
||||
setBiomeColor(biomeColors, jagged_peaks, 220, 220, 200); // TBD
|
||||
setBiomeColor(biomeColors, frozen_peaks, 176, 179, 206); // TBD
|
||||
|
||||
setBiomeColor(biomeColors, deep_dark, 3, 31, 41); // TBD
|
||||
setBiomeColor(biomeColors, mangrove_swamp, 44, 204, 142); // TBD
|
||||
}
|
||||
|
||||
void initBiomeTypeColors(unsigned char biomeColors[256][3])
|
||||
|
Loading…
x
Reference in New Issue
Block a user