summaryrefslogtreecommitdiffstats
path: root/src/Block.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-08-08 04:30:01 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-08-08 04:43:23 +0200
commit55b5e60b189490c33b415e3c956800da21064e3b (patch)
tree6fdb92acbdaeb7ddb08f92b21fa5167242ab7721 /src/Block.cpp
parentMore data saved in Settings (diff)
downloadAltCraft-55b5e60b189490c33b415e3c956800da21064e3b.tar
AltCraft-55b5e60b189490c33b415e3c956800da21064e3b.tar.gz
AltCraft-55b5e60b189490c33b415e3c956800da21064e3b.tar.bz2
AltCraft-55b5e60b189490c33b415e3c956800da21064e3b.tar.lz
AltCraft-55b5e60b189490c33b415e3c956800da21064e3b.tar.xz
AltCraft-55b5e60b189490c33b415e3c956800da21064e3b.tar.zst
AltCraft-55b5e60b189490c33b415e3c956800da21064e3b.zip
Diffstat (limited to 'src/Block.cpp')
-rw-r--r--src/Block.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/Block.cpp b/src/Block.cpp
index 303909b..98f1b0a 100644
--- a/src/Block.cpp
+++ b/src/Block.cpp
@@ -1,5 +1,7 @@
#include "Block.hpp"
+#include <string>
+
Block::~Block() {}
Block::Block(unsigned short id, unsigned char state,
@@ -13,5 +15,34 @@ bool operator==(const BlockId& lhs, const BlockId &rhs) {
}
bool operator<(const BlockId& lhs, const BlockId &rhs) {
- return (lhs.id < rhs.id);
-} \ No newline at end of file
+ if (lhs.id < rhs.id)
+ return true;
+ return lhs.state < rhs.state;
+}
+
+std::pair<std::string, std::string> TransformBlockIdToBlockStateName(BlockId blockId) {
+ switch (blockId.id) {
+ case 1: {
+ if (blockId.state > 6)
+ break;
+ static const std::pair<std::string, std::string> ids[] = {
+ std::pair<std::string,std::string>("stone", "normal"),
+ std::pair<std::string,std::string>("granite", "normal"),
+ std::pair<std::string,std::string>("smooth_granite", "normal"),
+ std::pair<std::string,std::string>("diorite", "normal"),
+ std::pair<std::string,std::string>("smooth_diorite", "normal"),
+ std::pair<std::string,std::string>("andesite", "normal"),
+ std::pair<std::string,std::string>("smooth_andesite", "normal"),
+ };
+ return ids[blockId.state];
+ }
+ case 2: {
+ return std::make_pair("grass", "snowy=false");
+ }
+
+ default:
+ break;
+ }
+
+ return std::make_pair("", "");
+}