2020-05-08 22:10:49 +02:00
|
|
|
#pragma once
|
2018-03-25 15:19:48 +02:00
|
|
|
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
|
|
|
class BlockDecoder {
|
|
|
|
public:
|
|
|
|
BlockDecoder();
|
|
|
|
|
|
|
|
void reset();
|
|
|
|
void decode(const ustring &data);
|
|
|
|
bool isEmpty() const;
|
2020-05-08 22:10:49 +02:00
|
|
|
// returns "" for air, ignore and invalid nodes
|
|
|
|
const std::string &getNode(u8 x, u8 y, u8 z) const;
|
2018-03-25 15:19:48 +02:00
|
|
|
|
|
|
|
private:
|
2020-05-08 22:10:49 +02:00
|
|
|
typedef std::unordered_map<uint16_t, std::string> NameMap;
|
2018-03-25 15:19:48 +02:00
|
|
|
NameMap m_nameMap;
|
|
|
|
int m_blockAirId;
|
|
|
|
int m_blockIgnoreId;
|
|
|
|
|
2020-05-06 22:31:50 +02:00
|
|
|
u8 m_version, m_contentWidth;
|
2018-03-25 15:19:48 +02:00
|
|
|
ustring m_mapData;
|
|
|
|
};
|