NoBlock.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #include "BlockType.h"
  3. #include "Block.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, Framework::StreamReader* zReader, int dimensionId) const override;
  12. virtual void saveBlock(Block* zBlock, Framework::StreamWriter* zWriter) const override;
  13. virtual Item* getItemFromBlock(Block* zBlock) const override;
  14. virtual Block* createBlockAt(Framework::Vec3<int> position, Item* zUsedItem) const override;
  15. virtual const Block* zDefault() const override;
  16. public:
  17. NoBlockBlockType(int id, const Block* defaultB);
  18. };
  19. class NoBlock : public Block
  20. {
  21. public:
  22. static const NoBlock INSTANCE;
  23. protected:
  24. NoBlock();
  25. virtual bool onTick(TickQueue* zQueue, int numTicks, bool& blocked) override;
  26. virtual void onPostTick() override;
  27. };
  28. class AirBlock : public Block
  29. {
  30. public:
  31. static const AirBlock INSTANCE;
  32. protected:
  33. AirBlock();
  34. virtual bool onTick(TickQueue* zQueue, int numTicks, bool& blocked) override;
  35. virtual void onPostTick() override;
  36. };