NoBlock.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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(
  10. Framework::Vec3<int> position, int dimensionId) const override;
  11. virtual Item* createItem() const override;
  12. virtual Block* loadBlock(Framework::Vec3<int> position,
  13. Framework::StreamReader* zReader,
  14. int dimensionId) const override;
  15. virtual void saveBlock(
  16. Block* zBlock, Framework::StreamWriter* zWriter) const override;
  17. virtual Item* getItemFromBlock(Block* zBlock) const override;
  18. virtual Block* createBlockAt(Framework::Vec3<int> position,
  19. int dimensionId,
  20. Item* zUsedItem) const override;
  21. virtual const Block* zDefault() const override;
  22. public:
  23. NoBlockBlockType(const Block* defaultB, Framework::Text name);
  24. virtual ItemType* createItemType() const override;
  25. };
  26. class NoBlock : public Block
  27. {
  28. public:
  29. static const NoBlock INSTANCE;
  30. protected:
  31. NoBlock();
  32. virtual bool onTick(
  33. TickQueue* zQueue, int numTicks, bool& blocked) override;
  34. virtual void onPostTick() override;
  35. };
  36. class AirBlock : public Block
  37. {
  38. public:
  39. static const AirBlock INSTANCE;
  40. protected:
  41. AirBlock();
  42. virtual bool onTick(
  43. TickQueue* zQueue, int numTicks, bool& blocked) override;
  44. virtual void onPostTick() override;
  45. };