diff options
| author | daoge <3523206925@qq.com> | 2026-03-03 03:04:10 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-03 03:04:10 +0800 |
| commit | b3feddfef372618c8a9d7a0abcaf18cfad866c18 (patch) | |
| tree | 267761c3bb39241ba5c347bfbe2254d06686e287 /Minecraft.World/StrongholdPieces.h | |
| parent | 84c31a2331f7a0ec85b9d438992e244f60e5020f (diff) | |
feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict
* feat: TU19 (Dec 2014) Features & Content (#32)
* December 2014 files
* Working release build
* Fix compilation issues
* Add sound to Windows64Media
* Add DLC content and force Tutorial DLC
* Revert "Add DLC content and force Tutorial DLC"
This reverts commit 97a43994725008e35fceb984d5549df9c8cea470.
* Disable broken light packing
* Disable breakpoint during DLC texture map load
Allows DLC loading but the DLC textures are still broken
* Fix post build not working
* ...
* fix vs2022 build
* fix cmake build
---------
Co-authored-by: Loki <lokirautio@gmail.com>
Diffstat (limited to 'Minecraft.World/StrongholdPieces.h')
| -rw-r--r-- | Minecraft.World/StrongholdPieces.h | 381 |
1 files changed, 246 insertions, 135 deletions
diff --git a/Minecraft.World/StrongholdPieces.h b/Minecraft.World/StrongholdPieces.h index c9751bae..2b15f3c2 100644 --- a/Minecraft.World/StrongholdPieces.h +++ b/Minecraft.World/StrongholdPieces.h @@ -6,11 +6,11 @@ class StrongholdPieces private: static const int SMALL_DOOR_WIDTH = 3; - static const int SMALL_DOOR_HEIGHT = 3; + static const int SMALL_DOOR_HEIGHT = 3; - static const int MAX_DEPTH = 50; - // the dungeon starts at 64 and traverses downwards to this point - static const int LOWEST_Y_POSITION = 10; + static const int MAX_DEPTH = 50; + // the dungeon starts at 64 and traverses downwards to this point + static const int LOWEST_Y_POSITION = 10; static const bool CHECK_AIR; // 4J - added to replace use of Class<? extends StrongholdPiece> within this class @@ -30,6 +30,11 @@ private: EPieceClass_PortalRoom }; +public: + static void loadStatic(); + + +private: class PieceWeight { public: @@ -37,11 +42,11 @@ private: const int weight; int placeCount; int maxPlaceCount; - + PieceWeight(EPieceClass pieceClass, int weight, int maxPlaceCount); virtual bool doPlace(int depth); bool isValid(); - }; + }; // 4J - added, java uses a local specialisation of these classes when instancing to achieve the same thing class PieceWeight_Library : public PieceWeight @@ -58,9 +63,9 @@ private: virtual bool doPlace(int depth) { return PieceWeight::doPlace(depth) && depth > 5; } }; - static list<PieceWeight *> currentPieces; + static list<PieceWeight *> currentPieces; static EPieceClass imposedPiece; - static int totalWeight; + static int totalWeight; public: static void resetPieces(); @@ -73,71 +78,98 @@ private: static StructurePiece *generateAndAddPiece(StartPiece *startPiece, list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction, int depth); - /** - * - * - */ + /** + * + * + */ private: class StrongholdPiece : public StructurePiece { + protected: + enum SmallDoorType + { + OPENING, WOOD_DOOR, GRATES, IRON_DOOR, + }; + + SmallDoorType entryDoor; + + public: + StrongholdPiece(); protected: StrongholdPiece(int genDepth); - enum SmallDoorType - { - OPENING, WOOD_DOOR, GRATES, IRON_DOOR, - }; + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); void generateSmallDoor(Level *level, Random *random, BoundingBox *chunkBB, SmallDoorType doorType, int footX, int footY, int footZ); SmallDoorType randomSmallDoor(Random *random); StructurePiece *generateSmallDoorChildForward(StartPiece *startPiece, list<StructurePiece *> *pieces, Random *random, int xOff, int yOff); StructurePiece *generateSmallDoorChildLeft(StartPiece *startPiece, list<StructurePiece *> *pieces, Random *random, int yOff, int zOff); StructurePiece *generateSmallDoorChildRight(StartPiece *startPiece, list<StructurePiece *> *pieces, Random *random, int yOff, int zOff); - + static bool isOkBox(BoundingBox *box, StartPiece *startRoom); // 4J added startRoom param - }; + }; - /** - * Corridor pieces that connects unconnected ends. - * - */ + /** + * Corridor pieces that connects unconnected ends. + * + */ public: class FillerCorridor : public StrongholdPiece { + public: + static StructurePiece *Create() { return new FillerCorridor(); } + virtual EStructurePiece GetType() { return eStructurePiece_FillerCorridor; } + private: - const int steps; + int steps; public: + FillerCorridor(); FillerCorridor(int genDepth, Random *random, BoundingBox *corridorBox, int direction); - static BoundingBox *findPieceBox(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction); + protected: + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); + + public: + static BoundingBox *findPieceBox(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction); virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); - }; + }; - /** - * - * - */ + /** + * + * + */ public: class StairsDown : public StrongholdPiece { + public: + static StructurePiece *Create() { return new StairsDown(); } + virtual EStructurePiece GetType() { return eStructurePiece_StairsDown; } + private: static const int width = 5; static const int height = 11; static const int depth = 5; - - const bool isSource; - const SmallDoorType entryDoor; + + bool isSource; public: + StairsDown(); StairsDown(int genDepth, Random *random, int west, int north); StairsDown(int genDepth, Random *random, BoundingBox *stairsBox, int direction); - virtual void addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random); - static StairsDown *createPiece(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); - virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); - }; + protected: + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); + + public: + virtual void addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random); + static StairsDown *createPiece(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); + virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); + }; public: class PortalRoom; @@ -145,130 +177,169 @@ public: class StartPiece : public StairsDown { public: + virtual EStructurePiece GetType() { return eStructurePiece_StrongholdStartPiece; } + + public: bool isLibraryAdded; - PieceWeight *previousPiece; + PieceWeight *previousPiece; PortalRoom *portalRoomPiece; Level *m_level; // 4J added - // this queue is used so that the addChildren calls are - // called in a random order - vector<StructurePiece *> pendingChildren; + // this queue is used so that the addChildren calls are + // called in a random order + vector<StructurePiece *> pendingChildren; - StartPiece(int genDepth, Random *random, int west, int north, Level *level); // 4J Added level param + StartPiece(); + StartPiece(int genDepth, Random *random, int west, int north, Level *level); // 4J Added level param virtual TilePos *getLocatorPosition(); - }; + }; - /** - * - * - */ + /** + * + * + */ public: class Straight : public StrongholdPiece { + public: + static StructurePiece *Create() { return new Straight(); } + virtual EStructurePiece GetType() { return eStructurePiece_Straight; } + private: static const int width = 5; static const int height = 5; static const int depth = 7; - const SmallDoorType entryDoor; - const bool leftChild; - const bool rightChild; + bool leftChild; + bool rightChild; public: + Straight(); Straight(int genDepth, Random *random, BoundingBox *stairsBox, int direction); + + protected: + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); + + public: virtual void addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random); static Straight *createPiece(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); - }; + }; - /** - * - * - */ + /** + * + * + */ - class ChestCorridor : public StrongholdPiece + class ChestCorridor : public StrongholdPiece { + public: + static StructurePiece *Create() { return new ChestCorridor(); } + virtual EStructurePiece GetType() { return eStructurePiece_ChestCorridor; } + private: static const int width = 5; - static const int height = 5; - static const int depth = 7; - static const int TREASURE_ITEMS_COUNT = 14; + static const int height = 5; + static const int depth = 7; + static const int TREASURE_ITEMS_COUNT = 18; static WeighedTreasure *treasureItems[TREASURE_ITEMS_COUNT]; - const SmallDoorType entryDoor; - boolean hasPlacedChest; + bool hasPlacedChest; public: + ChestCorridor(); ChestCorridor(int genDepth, Random *random, BoundingBox *stairsBox, int direction); - virtual void addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random); - static ChestCorridor *createPiece(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); - virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); - }; - - /** - * - * - */ + + protected: + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); + + public: + virtual void addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random); + static ChestCorridor *createPiece(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); + virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); + }; + + /** + * + * + */ public: class StraightStairsDown : public StrongholdPiece { + public: + static StructurePiece *Create() { return new StraightStairsDown(); } + virtual EStructurePiece GetType() { return eStructurePiece_StraightStairsDown; } + private: static const int width = 5; static const int height = 11; static const int depth = 8; - const SmallDoorType entryDoor; - public: + StraightStairsDown(); StraightStairsDown(int genDepth, Random *random, BoundingBox *stairsBox, int direction); virtual void addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random); static StraightStairsDown *createPiece(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); - }; + }; - /** - * - * - */ + /** + * + * + */ public: class LeftTurn : public StrongholdPiece { + public: + static StructurePiece *Create() { return new LeftTurn(); } + virtual EStructurePiece GetType() { return eStructurePiece_LeftTurn; } + protected: static const int width = 5; static const int height = 5; static const int depth = 5; - const SmallDoorType entryDoor; - public: + LeftTurn(); LeftTurn(int genDepth, Random *random, BoundingBox *stairsBox, int direction); virtual void addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random); static LeftTurn *createPiece(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); - }; + }; - /** - * - * - */ + /** + * + * + */ public: class RightTurn : public LeftTurn { public: + static StructurePiece *Create() { return new RightTurn(); } + virtual EStructurePiece GetType() { return eStructurePiece_RightTurn; } + + public: + RightTurn(); RightTurn(int genDepth, Random *random, BoundingBox *stairsBox, int direction); virtual void addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random); - virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); + virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); }; - /** - * - * - */ + /** + * + * + */ public: class RoomCrossing : public StrongholdPiece { + public: + static StructurePiece *Create() { return new RoomCrossing(); } + virtual EStructurePiece GetType() { return eStructurePiece_StrongholdRoomCrossing; } + private: static const int SMALL_TREASURE_ITEMS_COUNT = 7; // 4J added static WeighedTreasure *smallTreasureItems[SMALL_TREASURE_ITEMS_COUNT]; @@ -279,43 +350,57 @@ public: static const int depth = 11; protected: - const SmallDoorType entryDoor; - const int type; + int type; + public: + RoomCrossing(); RoomCrossing(int genDepth, Random *random, BoundingBox *stairsBox, int direction); - virtual void addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random); - static RoomCrossing *createPiece(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); - virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); - }; - - /** - * - * - */ + + protected: + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); + + public: + virtual void addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random); + static RoomCrossing *createPiece(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); + virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); + }; + + /** + * + * + */ public: class PrisonHall : public StrongholdPiece { + public: + static StructurePiece *Create() { return new PrisonHall(); } + virtual EStructurePiece GetType() { return eStructurePiece_PrisonHall; } + protected: static const int width = 9; static const int height = 5; static const int depth = 11; - const SmallDoorType entryDoor; - public: + PrisonHall(); PrisonHall(int genDepth, Random *random, BoundingBox *stairsBox, int direction); - virtual void addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random); + virtual void addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random); static PrisonHall *createPiece(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); - virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); - }; + virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); + }; - /** - * - * - */ + /** + * + * + */ public: class Library : public StrongholdPiece { + public: + static StructurePiece *Create() { return new Library(); } + virtual EStructurePiece GetType() { return eStructurePiece_Library; } + private: static const int LIBRARY_TREASURE_ITEMS_COUNT = 4; // 4J added static WeighedTreasure *libraryTreasureItems[LIBRARY_TREASURE_ITEMS_COUNT]; @@ -326,62 +411,88 @@ public: static const int tallHeight = 11; static const int depth = 15; - const SmallDoorType entryDoor; private: - const bool isTall; + bool isTall; public: + Library(); Library(int genDepth, Random *random, BoundingBox *roomBox, int direction); - static Library *createPiece(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); - virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); - }; + protected: + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); + + public: + static Library *createPiece(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); + virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); + + }; - /** - * - * - */ + /** + * + * + */ public: class FiveCrossing : public StrongholdPiece { + public: + static StructurePiece *Create() { return new FiveCrossing(); } + virtual EStructurePiece GetType() { return eStructurePiece_FiveCrossing; } + protected: static const int width = 10; - static const int height = 9; - static const int depth = 11; - - const SmallDoorType entryDoor; + static const int height = 9; + static const int depth = 11; private: bool leftLow, leftHigh, rightLow, rightHigh; public: + FiveCrossing(); FiveCrossing(int genDepth, Random *random, BoundingBox *stairsBox, int direction); - virtual void addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random); - static FiveCrossing *createPiece(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); - virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); - }; - /** - * - * - */ + protected: + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); + + public: + virtual void addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random); + static FiveCrossing *createPiece(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); + virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); + }; - class PortalRoom : public StrongholdPiece + /** + * + * + */ + + class PortalRoom : public StrongholdPiece { + public: + static StructurePiece *Create() { return new PortalRoom(); } + virtual EStructurePiece GetType() { return eStructurePiece_PortalRoom; } + protected: static const int width = 11; - static const int height = 8; - static const int depth = 16; + static const int height = 8; + static const int depth = 16; private: bool hasPlacedMobSpawner; public: + PortalRoom(); PortalRoom(int genDepth, Random *random, BoundingBox *stairsBox, int direction); + + protected: + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); + + public: void addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random); static PortalRoom *createPiece(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); - }; + }; private: @@ -389,7 +500,7 @@ private: { public: virtual void next(Random *random, int worldX, int worldY, int worldZ, bool isEdge); - }; + }; - static const SmoothStoneSelector *smoothStoneSelector; + static const SmoothStoneSelector *smoothStoneSelector; }; |
