summaryrefslogtreecommitdiffstats
path: root/World.hpp
blob: 288dc4f9e2af7007e614ec2a6645e6d531afb078 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once

#include <map>
#include "Block.hpp"
#include "Packet.hpp"

const int SECTION_WIDTH=16;
const int SECTION_LENGTH=16;
const int SECTION_HEIGHT=16;

class World {
public:
    Block &GetBlock(PositionI pos);
    void SetBlock(PositionI pos, Block block);
    void ParseChunkData(Packet packet);


    std::map<PositionI,Block> m_blocks;
private:


    size_t ParseSectionData(int chunkX, int chunkZ, bool isGroundContinous, int section, byte *data);

    std::vector<unsigned short>
    ParseBlocks(byte *bytes, int dataLength, std::vector<int> palette, byte bitsPerBlock);

    int m_dimension=0;
};