FeatherMC/src/world/World.h

44 lines
822 B
C
Raw Normal View History

2020-08-07 05:48:54 +01:00
#pragma once
#include "Common.h"
2020-08-13 04:15:51 +01:00
#include "nbt/NBT.h"
#include "Chunk.h"
2020-08-13 04:10:44 +01:00
#include "Palette.h"
#include "../Lockable.h"
2020-08-13 04:10:44 +01:00
2020-08-07 05:48:54 +01:00
#include <cstdint>
#include <string>
#include <map>
2020-08-07 05:48:54 +01:00
namespace Feather
{
struct LevelData
{
int32_t spawnX, spawnY, spawnZ;
};
2020-08-07 05:48:54 +01:00
class World
{
public:
World(std::string name);
2020-08-14 02:41:05 +01:00
void PrepareSpawn();
2020-08-13 04:10:44 +01:00
// global palette of all block states
static const GlobalPalette<BlockState> GLOBAL_PALETTE;
2020-08-13 04:15:51 +01:00
Chunk* GetChunk(ChunkPos pos);
2020-08-13 04:15:51 +01:00
LevelData GetLevelData() const { return m_levelData; }
2020-08-07 05:48:54 +01:00
private:
std::unique_ptr<Chunk> LoadChunk(ChunkPos pos);
Lockable<std::map<ChunkPos, std::unique_ptr<Chunk>>> m_chunks;
LevelData m_levelData;
// TODO nuke this shit
std::string m_name;
2020-08-07 05:48:54 +01:00
};
}