summaryrefslogtreecommitdiffstats
path: root/src/Block.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2019-05-19 20:03:48 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2019-05-19 20:03:48 +0200
commit646f77ec6bc27af231b6ff8974e631b86188beb6 (patch)
treeea48447a4bdc947e67bbd900fd5716d48755619c /src/Block.cpp
parentImplemented lua's "require" for AM (diff)
downloadAltCraft-646f77ec6bc27af231b6ff8974e631b86188beb6.tar
AltCraft-646f77ec6bc27af231b6ff8974e631b86188beb6.tar.gz
AltCraft-646f77ec6bc27af231b6ff8974e631b86188beb6.tar.bz2
AltCraft-646f77ec6bc27af231b6ff8974e631b86188beb6.tar.lz
AltCraft-646f77ec6bc27af231b6ff8974e631b86188beb6.tar.xz
AltCraft-646f77ec6bc27af231b6ff8974e631b86188beb6.tar.zst
AltCraft-646f77ec6bc27af231b6ff8974e631b86188beb6.zip
Diffstat (limited to 'src/Block.cpp')
-rw-r--r--src/Block.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Block.cpp b/src/Block.cpp
index a12db9d..421cb5d 100644
--- a/src/Block.cpp
+++ b/src/Block.cpp
@@ -1,5 +1,9 @@
#include "Block.hpp"
+#include <map>
+
+#include "Plugin.hpp"
+
std::pair<std::string, std::string> TransformBlockIdToBlockStateName(BlockId blockId) {
switch (blockId.id) {
case 1: {
@@ -523,3 +527,18 @@ std::pair<std::string, std::string> TransformBlockIdToBlockStateName(BlockId blo
return std::make_pair("", "");
}
+
+std::map<BlockId, BlockInfo> staticBlockInfo;
+
+void RegisterStaticBlockInfo(BlockId blockId, BlockInfo blockInfo) {
+ staticBlockInfo[blockId] = blockInfo;
+}
+
+BlockInfo GetBlockInfo(BlockId blockId, Vector blockPos) {
+ auto it = staticBlockInfo.find(blockId);
+ if (it != staticBlockInfo.end())
+ return it->second;
+ if (blockPos == Vector())
+ return BlockInfo{ true, "", "" };
+ return PluginSystem::RequestBlockInfo(blockPos);
+}