123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- #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 GRASS = 22;
- static const int FARMLAND = 23;
- static const int WHEAT_SEED = 24;
- static const int WHEAT = 25;
- static const int WATER = 26;
- static const int CRAFTING_TABLE = 27;
- static const int MAX_VALUE = 27;
- };
- class BlockType : public virtual Framework::ReferenceCounter
- {
- private:
- const int id;
- const ModelInfo model;
- int initialMaxHP;
- const bool needsClientInstance;
- bool lightSource;
- const char* name;
- const bool needModelSubscription;
- protected:
- Block* defaultBlock;
- BlockType(int id,
- Block* defaultBlock,
- ModelInfo model,
- bool needsClientInstance,
- int initialMaxHP,
- bool lightSource,
- const char* name,
- bool needModelSubscription);
- 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 Framework::Text getTargetUIML() const;
- 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 char* getName() const;
- const bool doesNeedModelSubscription() const;
- void writeTypeInfo(Framework::StreamWriter* zWriter) const;
- };
- const Block* getDefaultBlock(Framework::Either<Block*, int> b);
|