summary refs log tree commit diff
path: root/src/World/BlockType.hpp
blob: 472523f99b890b2f65516beadf961564b8a735d3 (plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once

#include <cstdint>
#include <vector>

namespace MC::World {

class BlockType {
public:
    enum Value : uint8_t {
        Air,
        Dirt,
        Grass,
        Stone,
        Sand,
        Snow,
        Wood,
        Leaves,
        Water,
    };

    static constexpr uint8_t Size = Water + 1;

    BlockType() : m_block(Air) {}
    BlockType(Value block) : m_block(block) {}

    operator Value() const { return m_block; }

    static std::vector<BlockType> all() {
        return {
            Air,
            Dirt,
            Grass,
            Stone,
            Sand,
            Snow,
            Water,
        };
    }
private:
    Value m_block;
};

}