From b608eaf29aa28a8683168471a7a9e358cfae4b01 Mon Sep 17 00:00:00 2001 From: starseed12345 <99209515+starseed12345@users.noreply.github.com> Date: Sat, 14 Mar 2026 01:57:22 +0100 Subject: [PATCH] futureproof stronghold (untested) --- Minecraft.World/StrongholdFeature.cpp | 28 +++++++++++++++++++-------- Minecraft.World/StrongholdFeature.h | 7 +++++-- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/Minecraft.World/StrongholdFeature.cpp b/Minecraft.World/StrongholdFeature.cpp index 83f05cf3f..14571c38f 100644 --- a/Minecraft.World/StrongholdFeature.cpp +++ b/Minecraft.World/StrongholdFeature.cpp @@ -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()); diff --git a/Minecraft.World/StrongholdFeature.h b/Minecraft.World/StrongholdFeature.h index 57dc5e2df..13c7e9083 100644 --- a/Minecraft.World/StrongholdFeature.h +++ b/Minecraft.World/StrongholdFeature.h @@ -29,8 +29,11 @@ private: static vector 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;