Grass.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. friend GrassBlockType;
  16. };
  17. class GrassBlockType : public BlockType
  18. {
  19. private:
  20. int itemType;
  21. bool transparent;
  22. bool passable;
  23. float hardness;
  24. const ItemType* zTool;
  25. float speedModifier;
  26. bool interactable;
  27. protected:
  28. virtual void createSuperBlock(Block* zBlock, Item* zItem) const override;
  29. virtual void loadSuperBlock(Block* zBlock,
  30. Framework::StreamReader* zReader,
  31. int dimensionId) const override;
  32. virtual void saveSuperBlock(
  33. Block* zBlock, Framework::StreamWriter* zWriter) const override;
  34. virtual Item* createItem() const override;
  35. virtual Block* createBlock(
  36. Framework::Vec3<int> position, int dimensionId) const override;
  37. public:
  38. GrassBlockType(int typeId,
  39. int itemTypeId,
  40. ModelInfo model,
  41. const char* name,
  42. int mapColor);
  43. };