From 646f77ec6bc27af231b6ff8974e631b86188beb6 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Sun, 19 May 2019 23:03:48 +0500 Subject: Implemented block-api --- src/Block.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/Block.cpp') 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 + +#include "Plugin.hpp" + std::pair TransformBlockIdToBlockStateName(BlockId blockId) { switch (blockId.id) { case 1: { @@ -523,3 +527,18 @@ std::pair TransformBlockIdToBlockStateName(BlockId blo return std::make_pair("", ""); } + +std::map 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); +} -- cgit v1.2.3