diff options
author | TheJumper <maximilian.springer@web.de> | 2014-02-22 02:11:54 +0100 |
---|---|---|
committer | TheJumper <maximilian.springer@web.de> | 2014-02-22 02:11:54 +0100 |
commit | 748a9c60b336f5ffabed9d5f2d86fc757bd3a253 (patch) | |
tree | bd142f6b55c547d25a82ff8e786424627d224af8 /src/Mobs | |
parent | Monster.h: Added doxy-comments for drop methods (diff) | |
download | cuberite-748a9c60b336f5ffabed9d5f2d86fc757bd3a253.tar cuberite-748a9c60b336f5ffabed9d5f2d86fc757bd3a253.tar.gz cuberite-748a9c60b336f5ffabed9d5f2d86fc757bd3a253.tar.bz2 cuberite-748a9c60b336f5ffabed9d5f2d86fc757bd3a253.tar.lz cuberite-748a9c60b336f5ffabed9d5f2d86fc757bd3a253.tar.xz cuberite-748a9c60b336f5ffabed9d5f2d86fc757bd3a253.tar.zst cuberite-748a9c60b336f5ffabed9d5f2d86fc757bd3a253.zip |
Diffstat (limited to 'src/Mobs')
-rw-r--r-- | src/Mobs/Mooshroom.cpp | 38 | ||||
-rw-r--r-- | src/Mobs/Mooshroom.h | 1 |
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); } } ; |