Grass.h 1.1 KB

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