diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2019-05-19 20:03:48 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2019-05-19 20:03:48 +0200 |
commit | 646f77ec6bc27af231b6ff8974e631b86188beb6 (patch) | |
tree | ea48447a4bdc947e67bbd900fd5716d48755619c /src/Block.cpp | |
parent | Implemented lua's "require" for AM (diff) | |
download | AltCraft-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.cpp | 19 |
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); +} |