#pragma once #include #include "Inventory.h" #include "BlockType.h" #include "Registries.h" using namespace Framework; #define CONST_BLOCK(maybeBlock, type) (maybeBlock ? maybeBlock : STATIC_REGISTRY( BlockType ).zElement((int)type)->zDefault()) class BasicBlockItemType; class Chunk; class Block : public Model3D, public Inventory { protected: bool transparent; bool passable; float hp; float maxHP; float hardness; float speedModifier; const BlockType* zType; ItemType* zTool; bool sideVisible[6]; public: Block(const BlockType* zType, ItemType* zTool, Vec3 position, bool hasInventory); virtual ~Block(); void api(char* message); bool isTransparent() const; bool isPassable() const; void setSideVisible(Direction dir, bool visible); const BlockType* zBlockType() const; friend Chunk; friend BlockType; }; class BasicBlockItem : public Item { protected: bool transparent; bool passable; float hp; float maxHP; float hardness; int toolId; float speedModifier; bool interactable; public: BasicBlockItem(const ItemType* zType, const char* name); friend BasicBlockItemType; friend BlockType; }; class BasicBlockItemType : public ItemType { private: const char* name; const char* texturPath; protected: BasicBlockItemType(int id, const char* name, const char* texturPath); virtual void loadSuperItem(Item* zItem, Framework::StreamReader* zReader) const override; public: virtual Framework::Model3DData* getItemModel() const override; virtual Framework::Model3DTextur* getItemTextur() const override; virtual Item* createItem() const override; };