1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- #pragma once
- #include <Array.h>
- #include <Either.h>
- #include <Vec3.h>
- #include <Writer.h>
- #include "ModelInfo.h"
- #include "StaticRegistry.h"
- class Item;
- class Block;
- class BlockTypeEnum
- {
- public:
- static const int NO_BLOCK = 0;
- static const int AIR = 1;
- static const int DIRT = 2;
- static const int SAND = 3;
- static const int GRAVEL = 4;
- static const int STONE = 5;
- static const int STONE_GRANITE = 6;
- static const int STONE_COBBLE = 7;
- static const int STONE_BASALT = 8;
- static const int WOOD_OAK = 9;
- static const int WOOD_BIRCH = 10;
- static const int WOOD_BEECH = 11;
- static const int WOOD_PINE = 12;
- static const int LEAVES_WOOD_OAK = 13;
- static const int LEAVES_WOOD_BIRCH = 14;
- static const int LEAVES_WOOD_BEECH = 15;
- static const int LEAVES_WOOD_PINE = 16;
- static const int SEBLING_WOOD_OAK = 17;
- static const int SEBLING_WOOD_BIRCH = 18;
- static const int SEBLING_WOOD_BEECH = 19;
- static const int SEBLING_WOOD_PINE = 20;
- static const int TORCH = 21;
- static const int MAX_VALUE = 21;
- };
- 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, int dimensionId) 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,
- int dimensionId) 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;
- BlockType* initializeDefault();
- };
- const Block* getDefaultBlock(Framework::Either<Block*, int> b);
|