the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#pragma once
2using namespace std;
3#include <unordered_map>
4#include <string>
5
6#include "..\..\..\Minecraft.World\ItemInstance.h"
7#include "ConsoleGameRulesConstants.h"
8
9#include "GameRulesInstance.h"
10
11class GameRule;
12class LevelRuleset;
13class Player;
14class WstringLookup;
15
16class GameRuleDefinition
17{
18private:
19 // Owner type defines who this rule applies to
20 GameRulesInstance::EGameRulesInstanceType m_ownerType;
21
22protected:
23 // These attributes should map to those in the XSD GameRuleType
24 wstring m_descriptionId;
25 wstring m_promptId;
26 int m_4JDataValue;
27
28public:
29 GameRuleDefinition();
30
31 virtual ConsoleGameRules::EGameRuleType getActionType() = 0;
32
33 void setOwnerType(GameRulesInstance::EGameRulesInstanceType ownerType) { m_ownerType = ownerType;}
34
35 virtual void write(DataOutputStream *);
36
37 virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes);
38 virtual void getChildren(vector<GameRuleDefinition *> *);
39
40 virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
41 virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
42
43 virtual void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule);
44
45 bool getComplete(GameRule *rule);
46 void setComplete(GameRule *rule, bool val);
47
48 virtual int getGoal() { return 0; }
49 virtual int getProgress(GameRule *rule) { return 0; }
50
51 virtual int getIcon() { return -1; }
52 virtual int getAuxValue() { return 0; }
53
54 // Here we should have functions for all the hooks, with a GameRule* as the first parameter
55 virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z) { return false; }
56 virtual bool onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item) { return false; }
57 virtual void postProcessPlayer(shared_ptr<Player> player) { }
58
59 vector<GameRuleDefinition *> *enumerate();
60 unordered_map<GameRuleDefinition *, int> *enumerateMap();
61
62 // Static functions
63 static GameRulesInstance *generateNewGameRulesInstance(GameRulesInstance::EGameRulesInstanceType type, LevelRuleset *rules, Connection *connection);
64 static wstring generateDescriptionString(ConsoleGameRules::EGameRuleType defType, const wstring &description, void *data = NULL, int dataLength = 0);
65
66};