aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/MineShaftPieces.h
blob: c2278467a96f736771da9c2846a3f37bc6f11bcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#pragma once

#include "StructurePiece.h"

class MineShaftPieces
{
private:
	static const int DEFAULT_SHAFT_WIDTH = 3;
	static const int DEFAULT_SHAFT_HEIGHT = 3;
	static const int DEFAULT_SHAFT_LENGTH = 5;

	static const int MAX_DEPTH = 8; // 1.2.3 change

public:
	static void loadStatic();

private:
	static StructurePiece *createRandomShaftPiece(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth);
	static StructurePiece *generateAndAddPiece(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction, int depth);

	/**
	* 
	*
	*/
public:
	class MineShaftRoom : public StructurePiece
	{
	public:
		static StructurePiece *Create() { return new MineShaftRoom(); }
		virtual EStructurePiece GetType() { return eStructurePiece_MineShaftRoom; }

	private:
		list<BoundingBox *> childEntranceBoxes;

	public:
		MineShaftRoom();
		MineShaftRoom(int genDepth, Random *random, int west, int north);
		~MineShaftRoom();

		virtual void addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random);
		virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB);

	protected:
		void addAdditonalSaveData(CompoundTag *tag);
		void readAdditonalSaveData(CompoundTag *tag);
	};

	/**
	* 
	*
	*/
	class MineShaftCorridor : public StructurePiece
	{
	public:
		static StructurePiece *Create() { return new MineShaftCorridor(); }
		virtual EStructurePiece GetType() { return eStructurePiece_MineShaftCorridor; }

	private:
		bool hasRails; // was final
		bool spiderCorridor; // was final
		bool hasPlacedSpider;
		int numSections;

	public:
		MineShaftCorridor();

	protected:
		void addAdditonalSaveData(CompoundTag *tag);
		void readAdditonalSaveData(CompoundTag *tag);

	public:
		MineShaftCorridor(int genDepth, Random *random, BoundingBox *corridorBox, int direction);

		static BoundingBox *findCorridorSize(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction);
		virtual void addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random);

	protected:
		virtual bool createChest(Level *level, BoundingBox *chunkBB, Random *random, int x, int y, int z, WeighedTreasureArray treasure, int numRolls);

	public:
		virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB);
	};

	/**
	* 
	*
	*/
	class MineShaftCrossing : public StructurePiece
	{
	public:
		static StructurePiece *Create() { return new MineShaftCrossing(); }
		virtual EStructurePiece GetType() { return eStructurePiece_MineShaftCrossing; }

	private:
		int direction;
		bool isTwoFloored;

	public:
		MineShaftCrossing();

	protected:
		void addAdditonalSaveData(CompoundTag *tag);
		void readAdditonalSaveData(CompoundTag *tag);

	public:
		MineShaftCrossing(int genDepth, Random *random, BoundingBox *crossingBox, int direction);

		static BoundingBox *findCrossing(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction);
		virtual void addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random);
		virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB);
	};

	/**
	* 
	*
	*/
	class MineShaftStairs : public StructurePiece
	{
	public:
		static StructurePiece *Create() { return new MineShaftStairs(); }
		virtual EStructurePiece GetType() { return eStructurePiece_MineShaftStairs; }

	public:
		MineShaftStairs();
		MineShaftStairs(int genDepth, Random *random, BoundingBox *stairsBox, int direction);

	protected:
		void addAdditonalSaveData(CompoundTag *tag);
		void readAdditonalSaveData(CompoundTag *tag);

	public:
		static BoundingBox *findStairs(list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction);
		virtual void addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random);
		virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB);

	};

	/* @formatter:off */
private:
	static WeighedTreasureArray smallTreasureItems;
	/* @formatter:on */

public:
	static void staticCtor();

};