- // Whether it can be cooked
- virtual bool isCookable() const {return false;}
- // Result of cooking (can randomize)
- virtual InventoryItem *createCookResult() const {return NULL;}
- // Time of cooking
- virtual float getCookTime() const {return 3.0;}
- // Whether it can be burned (<0 = cannot be burned)
- virtual float getBurnTime() const {return -1;}
-
- // Eat, press, activate, whatever.
- // Called when item is right-clicked when lying on ground.
- // If returns true, item shall be deleted.
- virtual bool use(ServerEnvironment *env,
- ServerActiveObject *user){return false;}
-
-protected:
- IGameDef *m_gamedef;
- u16 m_count;
-};
-
-class MaterialItem : public InventoryItem
-{
-public:
- MaterialItem(IGameDef *gamedef, std::string nodename, u16 count);
- // Legacy constructor
- MaterialItem(IGameDef *gamedef, content_t content, u16 count);
- /*
- Implementation interface
- */
- virtual const char* getName() const
- {
- return "MaterialItem";
- }
- virtual void serialize(std::ostream &os) const
- {
- std::string nodename = m_nodename;
- if(nodename == "")
- nodename = "unknown_block";
-
- os<<"MaterialItem3";
- os<<" \"";
- os<<nodename;
- os<<"\" ";
- os<<m_count;
-
- // Old
- /*os<<"MaterialItem2";
- os<<" ";
- os<<(unsigned int)m_content;
- os<<" ";
- os<<m_count;*/
- }
- virtual InventoryItem* clone()