summaryrefslogtreecommitdiffstats
path: root/src/Mobs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mobs')
-rw-r--r--src/Mobs/Mooshroom.cpp38
-rw-r--r--src/Mobs/Mooshroom.h1
2 files changed, 38 insertions, 1 deletions
diff --git a/src/Mobs/Mooshroom.cpp b/src/Mobs/Mooshroom.cpp
index 17995ce91..4787c6096 100644
--- a/src/Mobs/Mooshroom.cpp
+++ b/src/Mobs/Mooshroom.cpp
@@ -2,11 +2,12 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Mooshroom.h"
+#include "../Entities/Player.h"
+
-// TODO: Milk Cow
@@ -30,3 +31,38 @@ void cMooshroom::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+
+
+void cMooshroom::OnRightClicked(cPlayer & a_Player)
+{
+ if ((a_Player.GetEquippedItem().m_ItemType == E_ITEM_BUCKET))
+ {
+ if (!a_Player.IsGameModeCreative())
+ {
+ a_Player.GetInventory().RemoveOneEquippedItem();
+ a_Player.GetInventory().AddItem(E_ITEM_MILK);
+ }
+ }
+
+ if ((a_Player.GetEquippedItem().m_ItemType == E_ITEM_BOWL))
+ {
+ if (!a_Player.IsGameModeCreative())
+ {
+ a_Player.GetInventory().RemoveOneEquippedItem();
+ a_Player.GetInventory().AddItem(E_ITEM_MUSHROOM_SOUP);
+ }
+ }
+
+ if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_SHEARS)
+ {
+ if (!a_Player.IsGameModeCreative())
+ {
+ a_Player.UseEquippedItem();
+ }
+
+ cItems Drops;
+ Drops.push_back(cItem(E_BLOCK_RED_MUSHROOM, 5, 0));
+ m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10);
+ }
+}
+
diff --git a/src/Mobs/Mooshroom.h b/src/Mobs/Mooshroom.h
index c94301098..16f6c8248 100644
--- a/src/Mobs/Mooshroom.h
+++ b/src/Mobs/Mooshroom.h
@@ -18,6 +18,7 @@ public:
CLASS_PROTODEF(cMooshroom);
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+ virtual void OnRightClicked(cPlayer & a_Player) override;
virtual const cItem GetFollowedItem(void) const override { return cItem(E_ITEM_WHEAT); }
} ;