#ifndef SHARED_ITEM_BLOCK_HH_ #define SHARED_ITEM_BLOCK_HH_ #include "shared/item/item.hh" #include "shared/world/block.hh" namespace shared { namespace item { class block : virtual public shared::item::item { public: // Blocks are offset by 256 in their type so they do not collide with tools // I'd prefer it was the other way around so TODO static constexpr auto type_offset{std::numeric_limits::max()}; public: enum shared::world::block::type type; public: static type_t get_type(const enum shared::world::block::type&) noexcept; public: virtual type_t get_type() const noexcept; public: template block(const enum shared::world::block::type& type, Args&&... args) noexcept : item(get_type(type), std::forward(args)...), type(type) {} template block(const shared::item::item::type_t& type, Args&&... args) noexcept : item(type, std::forward(args)...), type(static_cast(type - type_offset)) {} virtual ~block() noexcept {} }; } // namespace item } // namespace shared #endif