NoBlock.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. public:
  27. virtual const Block* zDefault() const override;
  28. };
  29. REGISTER(NoBlockBlockType, BlockType)
  30. class AirBlock : public Block
  31. {
  32. public:
  33. static const AirBlock INSTANCE;
  34. protected:
  35. AirBlock();
  36. virtual bool onTick(TickQueue* zQueue, int numTicks, bool& blocked) override;
  37. virtual void onPostTick() override;
  38. };
  39. class AirBlockBlockType : public NoBlockBlockType
  40. {
  41. REGISTRABLE(AirBlockBlockType)
  42. protected:
  43. AirBlockBlockType();
  44. virtual const Block* zDefault() const override;
  45. };
  46. REGISTER(AirBlockBlockType, BlockType)