Grass.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #include "Block.h"
  3. class GrassBlockType;
  4. class GrassBlock : public Block
  5. {
  6. public:
  7. GrassBlock(int typeId,
  8. const ItemType* zTool,
  9. Framework::Vec3<int> pos,
  10. int dimensionId);
  11. virtual bool onTick(
  12. TickQueue* zQueue, int numTicks, bool& blocked) override;
  13. virtual void onPostTick() override;
  14. virtual void onDestroy() override;
  15. void filterPassingLight(unsigned char rgb[3]) const override;
  16. friend GrassBlockType;
  17. };
  18. class GrassBlockType : public BlockType
  19. {
  20. private:
  21. int itemType;
  22. bool transparent;
  23. bool passable;
  24. float hardness;
  25. const ItemType* zTool;
  26. float speedModifier;
  27. bool interactable;
  28. protected:
  29. virtual void createSuperBlock(Block* zBlock, Item* zItem) const override;
  30. virtual void loadSuperBlock(Block* zBlock,
  31. Framework::StreamReader* zReader,
  32. int dimensionId) const override;
  33. virtual void saveSuperBlock(
  34. Block* zBlock, Framework::StreamWriter* zWriter) const override;
  35. virtual Item* createItem() const override;
  36. virtual Block* createBlock(
  37. Framework::Vec3<int> position, int dimensionId) const override;
  38. public:
  39. GrassBlockType(int typeId,
  40. int itemTypeId,
  41. ModelInfo model,
  42. const char* name,
  43. int mapColor);
  44. };