futureproof stronghold (untested)

This commit is contained in:
starseed12345 2026-03-14 01:57:22 +01:00
parent fb37ced5c2
commit b608eaf29a
2 changed files with 25 additions and 10 deletions

View file

@ -33,15 +33,17 @@ void StrongholdFeature::staticCtor()
void StrongholdFeature::_init()
{
distance = 32;
spread = 3;
distance = 32;
spread = 3;
// 4J added initialisers
for (int i = 0; i < strongholdPos_length; i++)
{
strongholdPos[i] = nullptr;
}
isSpotSelected = false;
strongholdPos_length = 1;
for (int i = 0; i < MAX_STRONGHOLDS; i++)
{
strongholdPos[i] = nullptr;
}
isSpotSelected = false;
}
StrongholdFeature::StrongholdFeature() : StructureFeature()
@ -89,6 +91,16 @@ bool StrongholdFeature::isFeatureChunk(int x, int z,bool bIsSuperflat)
{
if (!isSpotSelected)
{
#ifdef _LARGE_WORLDS
if (level->dimension->getXZSize() >= LEVEL_WIDTH_INFINITE)
{
strongholdPos_length = 128;
}
else
{
strongholdPos_length = 1;
}
#endif
Random random;
random.setSeed(level->getSeed());

View file

@ -29,8 +29,11 @@ private:
static vector<Biome *> allowedBiomes;
bool isSpotSelected;
static const int strongholdPos_length = 1;// Java game has 3, but xbox game only has 1 because of the world size; // 4J added
ChunkPos *strongholdPos[strongholdPos_length];
//static const int strongholdPos_length = 1;// Java game has 3, but xbox game only has 1 because of the world size; // 4J added
//ChunkPos *strongholdPos[strongholdPos_length];
static const int MAX_STRONGHOLDS = 128;
ChunkPos *strongholdPos[MAX_STRONGHOLDS];
int strongholdPos_length;
double distance;
int spread;