summaryrefslogtreecommitdiffstats
path: root/src/Block.cpp
blob: 48c099d39a7cd7d5f700d6ec27d75c4af1095c05 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "Block.hpp"

#include <map>

#include "Plugin.hpp"

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);
}