summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGargaj <gargaj@conspiracy.hu>2015-12-01 23:30:47 +0100
committerGargaj <gargaj@conspiracy.hu>2015-12-03 14:55:32 +0100
commit72b2ab6406ca57627e2b91c0ffe054dafbe0cca5 (patch)
tree39a3aa00d0587b36fb1eabb7c59a1cce5d3d6778
parentMerge pull request #2699 from SafwatHalaby/breedDocs (diff)
downloadcuberite-72b2ab6406ca57627e2b91c0ffe054dafbe0cca5.tar
cuberite-72b2ab6406ca57627e2b91c0ffe054dafbe0cca5.tar.gz
cuberite-72b2ab6406ca57627e2b91c0ffe054dafbe0cca5.tar.bz2
cuberite-72b2ab6406ca57627e2b91c0ffe054dafbe0cca5.tar.lz
cuberite-72b2ab6406ca57627e2b91c0ffe054dafbe0cca5.tar.xz
cuberite-72b2ab6406ca57627e2b91c0ffe054dafbe0cca5.tar.zst
cuberite-72b2ab6406ca57627e2b91c0ffe054dafbe0cca5.zip
Diffstat (limited to '')
-rw-r--r--src/Items/CMakeLists.txt1
-rw-r--r--src/Items/ItemFood.h24
-rw-r--r--src/Items/ItemHandler.cpp3
-rw-r--r--src/Items/ItemMushroomSoup.h53
4 files changed, 25 insertions, 56 deletions
diff --git a/src/Items/CMakeLists.txt b/src/Items/CMakeLists.txt
index 91083d31b..a0910ea8a 100644
--- a/src/Items/CMakeLists.txt
+++ b/src/Items/CMakeLists.txt
@@ -38,7 +38,6 @@ SET (HDRS
ItemMilk.h
ItemMinecart.h
ItemMobHead.h
- ItemMushroomSoup.h
ItemNetherWart.h
ItemPainting.h
ItemPickaxe.h
diff --git a/src/Items/ItemFood.h b/src/Items/ItemFood.h
index e7c718c77..2fbbb2528 100644
--- a/src/Items/ItemFood.h
+++ b/src/Items/ItemFood.h
@@ -42,6 +42,7 @@ public:
// Golden apple handled in ItemGoldenApple
case E_ITEM_GOLDEN_CARROT: return FoodInfo(6, 14.4);
case E_ITEM_MELON_SLICE: return FoodInfo(2, 1.2);
+ case E_ITEM_MUSHROOM_SOUP: return FoodInfo(6, 7.2);
case E_ITEM_POISONOUS_POTATO: return FoodInfo(2, 1.2);
// Potatoes handled in ItemSeeds
case E_ITEM_PUMPKIN_PIE: return FoodInfo(8, 4.8);
@@ -101,6 +102,29 @@ public:
return false;
}
+ virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) override
+ {
+ if (!super::EatItem(a_Player, a_Item))
+ {
+ return false;
+ }
+
+ switch (m_ItemType)
+ {
+ case E_ITEM_MUSHROOM_SOUP:
+ case E_ITEM_RABBIT_STEW:
+ {
+ // Return a bowl to the inventory
+ if (!a_Player->IsGameModeCreative())
+ {
+ a_Player->GetInventory().AddItem(cItem(E_ITEM_BOWL));
+ }
+ break;
+ }
+ }
+ return true;
+ }
+
};
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp
index 580a0b7ee..5ff3c84bf 100644
--- a/src/Items/ItemHandler.cpp
+++ b/src/Items/ItemHandler.cpp
@@ -37,7 +37,6 @@
#include "ItemMilk.h"
#include "ItemMinecart.h"
#include "ItemMobHead.h"
-#include "ItemMushroomSoup.h"
#include "ItemNetherWart.h"
#include "ItemPainting.h"
#include "ItemPickaxe.h"
@@ -138,7 +137,6 @@ cItemHandler * cItemHandler::CreateItemHandler(int a_ItemType)
case E_ITEM_GOLDEN_APPLE: return new cItemGoldenAppleHandler();
case E_ITEM_MAP: return new cItemMapHandler();
case E_ITEM_MILK: return new cItemMilkHandler();
- case E_ITEM_MUSHROOM_SOUP: return new cItemMushroomSoupHandler(a_ItemType);
case E_ITEM_ITEM_FRAME: return new cItemItemFrameHandler(a_ItemType);
case E_ITEM_NETHER_WART: return new cItemNetherWartHandler(a_ItemType);
case E_ITEM_PAINTING: return new cItemPaintingHandler(a_ItemType);
@@ -237,6 +235,7 @@ cItemHandler * cItemHandler::CreateItemHandler(int a_ItemType)
case E_ITEM_COOKIE:
case E_ITEM_GOLDEN_CARROT:
case E_ITEM_MELON_SLICE:
+ case E_ITEM_MUSHROOM_SOUP:
case E_ITEM_POISONOUS_POTATO:
case E_ITEM_PUMPKIN_PIE:
case E_ITEM_RABBIT_STEW:
diff --git a/src/Items/ItemMushroomSoup.h b/src/Items/ItemMushroomSoup.h
deleted file mode 100644
index 1a761cbf1..000000000
--- a/src/Items/ItemMushroomSoup.h
+++ /dev/null
@@ -1,53 +0,0 @@
-
-#pragma once
-
-#include "ItemHandler.h"
-
-
-
-
-
-class cItemMushroomSoupHandler :
- public cItemHandler
-{
- typedef cItemHandler super;
-
-public:
- cItemMushroomSoupHandler(int a_ItemType)
- : super(a_ItemType)
- {
- }
-
-
- virtual bool IsFood(void) override
- {
- return true;
- }
-
-
- virtual FoodInfo GetFoodInfo(void) override
- {
- return FoodInfo(6, 7.2);
- }
-
-
- virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) override
- {
- if (!super::EatItem(a_Player, a_Item))
- {
- return false;
- }
-
- // Return a bowl to the inventory
- if (!a_Player->IsGameModeCreative())
- {
- a_Player->GetInventory().AddItem(cItem(E_ITEM_BOWL));
- }
- return true;
- }
-
-};
-
-
-
-