2012-09-23 18:09:57 -04:00
|
|
|
|
2012-07-15 16:36:34 -04:00
|
|
|
#pragma once
|
2012-09-23 18:09:57 -04:00
|
|
|
|
|
|
|
#include "ItemHandler.h"
|
|
|
|
#include "../World.h"
|
|
|
|
#include "../Player.h"
|
2012-07-15 16:36:34 -04:00
|
|
|
|
2012-10-03 04:52:11 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cItemDyeHandler :
|
|
|
|
public cItemHandler
|
2012-07-15 16:36:34 -04:00
|
|
|
{
|
|
|
|
public:
|
2012-10-18 15:41:29 -04:00
|
|
|
cItemDyeHandler(int a_ItemType)
|
|
|
|
: cItemHandler(a_ItemType)
|
2012-07-15 16:36:34 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-05-19 14:22:37 -04:00
|
|
|
virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override
|
2012-07-15 16:36:34 -04:00
|
|
|
{
|
|
|
|
// TODO: Handle coloring the sheep, too (OnItemUseOnEntity maybe)
|
2013-05-24 03:30:39 -04:00
|
|
|
|
2012-07-15 16:36:34 -04:00
|
|
|
// Handle growing the plants:
|
2013-05-19 14:22:37 -04:00
|
|
|
if (a_Item.m_ItemDamage == E_META_DYE_WHITE)
|
2012-07-15 16:36:34 -04:00
|
|
|
{
|
2012-10-18 15:41:29 -04:00
|
|
|
if (a_World->GrowRipePlant(a_BlockX, a_BlockY, a_BlockZ, true))
|
2012-07-15 16:36:34 -04:00
|
|
|
{
|
2013-05-24 03:30:39 -04:00
|
|
|
if (a_Player->GetGameMode() != gmCreative)
|
2012-07-15 16:36:34 -04:00
|
|
|
{
|
2013-05-24 03:30:39 -04:00
|
|
|
a_Player->GetInventory().RemoveOneEquippedItem();
|
2012-07-15 16:36:34 -04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2012-10-03 04:52:11 -04:00
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|