NoBlock.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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(int id, const Block* defaultB, const char* name);
  24. };
  25. class NoBlock : public Block
  26. {
  27. public:
  28. static const NoBlock INSTANCE;
  29. protected:
  30. NoBlock();
  31. virtual bool onTick(
  32. TickQueue* zQueue, int numTicks, bool& blocked) override;
  33. virtual void onPostTick() override;
  34. };
  35. class AirBlock : public Block
  36. {
  37. public:
  38. static const AirBlock INSTANCE;
  39. protected:
  40. AirBlock();
  41. virtual bool onTick(
  42. TickQueue* zQueue, int numTicks, bool& blocked) override;
  43. virtual void onPostTick() override;
  44. };