123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #pragma once
- #include <Model3D.h>
- #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<int> position, bool hasInventory );
- virtual ~Block();
- 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;
- };
|