forked from mrkite/minutor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblockidentifier.h
91 lines (76 loc) · 2 KB
/
blockidentifier.h
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
/** Copyright (c) 2013, Sean Kasun */
#ifndef BLOCKIDENTIFIER_H_
#define BLOCKIDENTIFIER_H_
#include <QString>
#include <QMap>
#include <QHash>
#include <QList>
#include <QColor>
class JSONArray;
class JSONObject;
class BlockInfo {
public:
BlockInfo();
// special block attribute used during mob spawning detection
bool isOpaque();
bool isLiquid();
bool doesBlockHaveSolidTopSurface(int data);
bool doesBlockHaveSolidTopSurface();
bool isBlockNormalCube();
bool renderAsNormalBlock();
bool canProvidePower();
// special block type used during mob spawning detection
bool isBedrock();
bool isHopper();
bool isStairs();
bool isHalfSlab();
bool isSnow();
// special blocks with Biome based Grass, Foliage and Water colors
bool biomeWater();
bool biomeGrass();
bool biomeFoliage();
void setName(const QString &newname);
void setBiomeGrass(bool value);
void setBiomeFoliage(bool value);
const QString &getName();
// int id;
double alpha;
quint8 mask;
bool enabled;
bool transparent;
bool liquid;
bool rendernormal;
bool providepower;
bool spawninside;
QColor colors[16];
private:
QString name;
// cache special blocks used during mob spawning detection
bool bedrock;
bool hopper;
bool stairs;
bool halfslab;
bool snow;
bool water;
bool grass;
bool foliage;
};
class BlockIdentifier {
public:
// singleton: access to global usable instance
static BlockIdentifier &Instance();
int addDefinitions(JSONArray *, int pack = -1);
void enableDefinitions(int id);
void disableDefinitions(int id);
BlockInfo &getBlockInfo(uint hid);
private:
// singleton: prevent access to constructor and copyconstructor
BlockIdentifier();
~BlockIdentifier();
BlockIdentifier(const BlockIdentifier &);
BlockIdentifier &operator=(const BlockIdentifier &);
void parseDefinition(JSONObject *block, BlockInfo *parent, int pack);
QMap<uint, BlockInfo*> blocks;
QList<QList<BlockInfo*> > packs;
};
#endif // BLOCKIDENTIFIER_H_