44 lines
775 B
C++
44 lines
775 B
C++
#pragma once
|
|
|
|
#include "Types.h"
|
|
|
|
#include "nbt/NBT.h"
|
|
#include "PalettedContainer.h"
|
|
#include "block/state/BlockState.h"
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
namespace Feather
|
|
{
|
|
// 16x16x16 sections of a chunk
|
|
class ChunkSection
|
|
{
|
|
public:
|
|
// 4 bits per block
|
|
// 16^3 = 4096 blocks total
|
|
// 4096 * 4 = 16384 bits = 256x int64
|
|
// 16 blocks per int64
|
|
static constexpr int NUM_LONGS = 256;
|
|
|
|
int64_t blockStates[NUM_LONGS];
|
|
};
|
|
|
|
// Chunk: 16x256x16 world chunk
|
|
class Chunk
|
|
{
|
|
static constexpr int NUM_SECTIONS = 16;
|
|
|
|
// Each chunk is made of up 16 ChunkSections
|
|
ChunkSection Sections[NUM_SECTIONS];
|
|
|
|
ChunkPos pos;
|
|
|
|
// TODO: save heightmaps here
|
|
// UNSERIALIZED
|
|
//const NBT::CompoundTag* heightmaps;
|
|
|
|
public:
|
|
Chunk(ChunkPos& pos, NBT::CompoundTag& tag);
|
|
};
|
|
}; |