diff options
Diffstat (limited to 'source/Mobs/Sheep.cpp')
-rw-r--r-- | source/Mobs/Sheep.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/source/Mobs/Sheep.cpp b/source/Mobs/Sheep.cpp index 2f371f384..440c5c2b9 100644 --- a/source/Mobs/Sheep.cpp +++ b/source/Mobs/Sheep.cpp @@ -3,15 +3,17 @@ #include "Sheep.h" #include "../BlockID.h" +#include "../Entities/Player.h" +#include "../World.h" -cSheep::cSheep(void) : +cSheep::cSheep(int a_Color) : super("Sheep", 91, "mob.sheep.say", "mob.sheep.say", 0.6, 1.3), m_IsSheared(false), - m_WoolColor(E_META_WOOL_WHITE) + m_WoolColor(a_Color) { } @@ -30,3 +32,25 @@ void cSheep::GetDrops(cItems & a_Drops, cEntity * a_Killer) + +void cSheep::OnRightClicked(cPlayer & a_Player) +{ + if ((a_Player.GetEquippedItem().m_ItemType == E_ITEM_SHEARS) && (!m_IsSheared)) + { + m_IsSheared = true; + m_World->BroadcastEntityMetadata(*this); + + if (!a_Player.IsGameModeCreative()) + { + a_Player.UseEquippedItem(); + } + + cItems Drops; + Drops.push_back(cItem(E_BLOCK_WOOL, 4, m_WoolColor)); + m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10); + } +} + + + + |