1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- #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<GrowthState> states;
- int blockTypeAfterGrowth;
- bool plantSpawned;
- public:
- GrowingPlantBlock(
- int typeId,
- const ItemType* zTool,
- Framework::Vec3<int> pos,
- 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<GrowthState> 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<int> position) const override;
- public:
- GrowingPlantBlockType(int typeId,
- ModelInfo model,
- const char* name,
- int blockTypeAfterGrowth,
- const char* readableName,
- int ticksNeeded);
- GrowingPlantBlockType* setHardness(float hardness);
- GrowingPlantBlockType* addGrowthState(
- float growthPercentage, ModelInfo model);
- };
|