NoBlock.h 1.3 KB

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