NoBlock.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #pragma once
  2. #include "BlockType.h"
  3. #include "Block.h"
  4. class NoBlockBlockType;
  5. class NoBlock : public Block
  6. {
  7. public:
  8. static const NoBlock INSTANCE;
  9. protected:
  10. NoBlock();
  11. virtual bool onTick( TickQueue* zQueue, int numTicks, bool& blocked ) override;
  12. virtual void onPostTick() override;
  13. };
  14. class NoBlockBlockType : public BlockType
  15. {
  16. REGISTRABLE( NoBlockBlockType )
  17. protected:
  18. NoBlockBlockType();
  19. NoBlockBlockType( int id );
  20. virtual Block* createBlock( Framework::Vec3<int> position ) const override;
  21. virtual Item* createItem() const override;
  22. virtual Block* loadBlock( Framework::Vec3<int> position, Framework::StreamReader* zReader ) const override;
  23. virtual void saveBlock( Block* zBlock, Framework::StreamWriter* zWriter ) const override;
  24. virtual Item* getItemFromBlock( Block* zBlock ) const override;
  25. virtual Block* createBlockAt( Framework::Vec3<int> position, Item* zUsedItem ) const override;
  26. virtual const Block* zDefault() const override;
  27. };
  28. REGISTER( NoBlockBlockType, BlockType )
  29. class AirBlock : public Block
  30. {
  31. public:
  32. static const AirBlock INSTANCE;
  33. protected:
  34. AirBlock();
  35. virtual bool onTick( TickQueue* zQueue, int numTicks, bool& blocked ) override;
  36. virtual void onPostTick() override;
  37. };
  38. class AirBlockBlockType : public NoBlockBlockType
  39. {
  40. REGISTRABLE( AirBlockBlockType )
  41. protected:
  42. AirBlockBlockType();
  43. virtual const Block* zDefault() const override;
  44. };
  45. REGISTER( AirBlockBlockType, BlockType )