aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/GameRules/ApplySchematicRuleDefinition.h
blob: e5dffb3ccc77d4ec232ea5933f90c7e362e9ce95 (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
#pragma once
#include "GameRuleDefinition.h"
#include "ConsoleSchematicFile.h"

class AABB;
class Vec3;
class LevelChunk;
class LevelGenerationOptions;
class GRFObject;

class ApplySchematicRuleDefinition : public GameRuleDefinition
{
private:
	LevelGenerationOptions *m_levelGenOptions;
	wstring m_schematicName;
	ConsoleSchematicFile *m_schematic;
	Vec3 *m_location;
	AABB *m_locationBox;
	ConsoleSchematicFile::ESchematicRotation m_rotation;
	int m_dimension;

	int64_t m_totalBlocksChanged;
	int64_t m_totalBlocksChangedLighting;
	bool m_completed;

	void updateLocationBox();
public:
	ApplySchematicRuleDefinition(LevelGenerationOptions *levelGenOptions);
	~ApplySchematicRuleDefinition();

	virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_ApplySchematic; }

	virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs);
	virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);

	void processSchematic(AABB *chunkBox, LevelChunk *chunk);
	void processSchematicLighting(AABB *chunkBox, LevelChunk *chunk);

	bool checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1);
	int getMinY();

	bool isComplete() { return m_completed; }

	wstring getSchematicName() { return m_schematicName; }

	/** 4J-JEV:
	 *  This GameRuleDefinition contains limited game state.
	 *	Reset any state to how it should be before a new game.
	 */
	void reset();
};