summaryrefslogtreecommitdiffstats
path: root/source/Mobs/Sheep.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-10-08 20:20:49 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-10-08 20:20:49 +0200
commit5db6213f34318031ece7e2a6765f69564b671891 (patch)
tree074213cf13247c4e6370528eaa000bbd4b3a625d /source/Mobs/Sheep.cpp
parentMerge pull request #2 from tigerw/bugfixes (diff)
downloadcuberite-5db6213f34318031ece7e2a6765f69564b671891.tar
cuberite-5db6213f34318031ece7e2a6765f69564b671891.tar.gz
cuberite-5db6213f34318031ece7e2a6765f69564b671891.tar.bz2
cuberite-5db6213f34318031ece7e2a6765f69564b671891.tar.lz
cuberite-5db6213f34318031ece7e2a6765f69564b671891.tar.xz
cuberite-5db6213f34318031ece7e2a6765f69564b671891.tar.zst
cuberite-5db6213f34318031ece7e2a6765f69564b671891.zip
Diffstat (limited to '')
-rw-r--r--source/Mobs/Sheep.cpp28
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);
+ }
+}
+
+
+
+