BasicBlocks.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #include "Block.h"
  3. #include "BlockType.h"
  4. #include "Item.h"
  5. class BlockType;
  6. class ItemType;
  7. class DirtBlockType;
  8. class DirtBlockItemType;
  9. class BasicBlock : public Block
  10. {
  11. public:
  12. BasicBlock( const BlockType* zType, ItemType* zTool, Framework::Vec3<int> pos );
  13. virtual bool onTick( TickQueue* zQueue, int numTicks, bool& blocked ) override;
  14. virtual void onPostTick() override;
  15. friend DirtBlockType;
  16. };
  17. class DirtBlockType : public BlockType
  18. {
  19. REGISTRABLE( DirtBlockType )
  20. protected:
  21. virtual void loadSuperBlock( Block* zBlock, Framework::StreamReader* zReader ) const override;
  22. virtual void saveSuperBlock( Block* zBlock, Framework::StreamWriter* zWriter ) const override;
  23. virtual void createSuperBlock( Block* zBlock, Item* zItem ) const override;
  24. virtual void createSuperItem( Block* zBlock, Item* zItem ) const override;
  25. virtual Block* createBlock( Framework::Vec3<int> position, Game* zTarget ) const override;
  26. virtual Item* createItem( Game* zTarget ) const override;
  27. DirtBlockType();
  28. };
  29. REGISTER( DirtBlockType, BlockType )
  30. class DirtBlockItemType : public BasicBlockItemType
  31. {
  32. REGISTRABLE( DirtBlockItemType )
  33. protected:
  34. DirtBlockItemType();
  35. public:
  36. virtual Item* createItem() const override;
  37. };
  38. REGISTER( DirtBlockItemType, ItemType )