#pragma once #include "Block.h" class GrowingPlantBlockType; struct GrowthState { GrowthState(); GrowthState(float percentage, ModelInfo model); GrowthState(const GrowthState& right); GrowthState& operator=(const GrowthState& right); float percentage; ModelInfo model; }; class GrowingPlantBlock : public Block { private: float seblingTicks; int seblingTicksMax; const char* name; Framework::Array states; int blockTypeAfterGrowth; bool plantSpawned; public: GrowingPlantBlock(int typeId, const ItemType* zTool, Framework::Vec3 pos, int dimensionId, int maxTicks, const char* name, int blockTypeAfterGrowth); virtual bool onTick( TickQueue* zQueue, int numTicks, bool& blocked) override; virtual void onPostTick() override; virtual void sendModelInfo(NetworkMessage* zMessage) override; virtual Framework::Text getTargetUIML(); GrowingPlantBlock* addGrowthState(GrowthState state); friend GrowingPlantBlockType; }; class GrowingPlantBlockType : public BlockType { private: bool transparent; bool passable; float hardness; const ItemType* zTool; float speedModifier; bool interactable; Framework::Array states; int blockTypeAfterGrowth; const char* readableName; int ticksNeeded; protected: virtual void loadSuperBlock(Block* zBlock, Framework::StreamReader* zReader, int dimensionId) const override; void createSuperBlock(Block* zBlock, Item* zItem) const override; virtual void saveSuperBlock( Block* zBlock, Framework::StreamWriter* zWriter) const override; virtual Item* createItem() const override; virtual Block* createBlock( Framework::Vec3 position, int dimensionId) const override; public: GrowingPlantBlockType(int typeId, ModelInfo model, const char* name, int blockTypeAfterGrowth, const char* readableName, int ticksNeeded, int mapColor); GrowingPlantBlockType* setHardness(float hardness); GrowingPlantBlockType* addGrowthState( float growthPercentage, ModelInfo model); };