#ifndef SHARED_WORLD_BLOCK_BLOCK_HH_ #define SHARED_WORLD_BLOCK_BLOCK_HH_ #include namespace shared { namespace world { class block { public: enum class type : std::uint8_t { air, // zero means air which means don't render dirt, // atlas should start from here grass, sand, sandstone, stone, cobblestone, wood, leaves, water, shrub, snow, cactus, dead_shrub, snowy_wood, snowy_leaves, snowy_shrub, }; enum class visibility { solid, partial, translucent, invisible }; public: type type; public: // We prefer a static switch statement over constructing an object for // speed. static enum visibility get_visibility(const enum type type) noexcept; static bool is_tangible(const enum type type) noexcept; static bool is_collidable(const enum type type) noexcept; static bool is_liquid(const enum type type) noexcept; static bool is_replaceable(const enum type type) noexcept; static bool is_removable(const enum type type) noexcept; public: block(const enum type t = type::air) noexcept : type(t) {} operator enum block::type() const noexcept { return this->type; } }; } // namespace world } // namespace shared #endif