123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #pragma once
- #include <Vec3.h>
- #include <Array.h>
- #include <Writer.h>
- #include <Either.h>
- #include "StaticRegistry.h"
- #include "ModelInfo.h"
- class Item;
- class Block;
- class BlockType : public virtual Framework::ReferenceCounter
- {
- private:
- const int id;
- const ModelInfo model;
- int initialMaxHP;
- const bool needsClientInstance;
- bool lightSource;
- protected:
- Block* defaultBlock;
- BlockType(int id, Block* defaultBlock, ModelInfo model, bool needsClientInstance, int initialMaxHP, bool lightSource);
- virtual ~BlockType();
- virtual void loadSuperBlock(Block* zBlock, Framework::StreamReader* zReader) const;
- virtual void saveSuperBlock(Block* zBlock, Framework::StreamWriter* zWriter) const;
- virtual void createSuperBlock(Block* zBlock, Item* zItem) const;
- virtual void createSuperItem(Block* zBlock, Item* zItem) const;
- virtual Block* createBlock(Framework::Vec3<int> position) const = 0;
- virtual Item* createItem() const = 0;
- public:
- virtual Block* loadBlock(Framework::Vec3<int> position, Framework::StreamReader* zReader) const;
- virtual void saveBlock(Block* zBlock, Framework::StreamWriter* zWriter) const;
- virtual Item* getItemFromBlock(Block* zBlock) const;
- virtual Block* createBlockAt(Framework::Vec3<int> position, Item* zUsedItem) const;
- virtual const Block* zDefault() const;
- bool doesNeedClientInstance() const;
- const ModelInfo& getModel() const;
- int getId() const;
- int getInitialMaxHP() const;
- bool isLightSource() const;
- };
- const Block* getDefaultBlock(Framework::Either<Block*, int> b);
|