summaryrefslogtreecommitdiffstats
path: root/source/Item.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-16 16:12:25 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-16 16:12:25 +0200
commitb929efc9a6c7fcf5a1e016a82f760298f49ee51e (patch)
tree1bbfc488265197fa1f4cb8d6157528a91ffe4fe9 /source/Item.cpp
parentAdded respawn screen when switching worlds. (diff)
downloadcuberite-b929efc9a6c7fcf5a1e016a82f760298f49ee51e.tar
cuberite-b929efc9a6c7fcf5a1e016a82f760298f49ee51e.tar.gz
cuberite-b929efc9a6c7fcf5a1e016a82f760298f49ee51e.tar.bz2
cuberite-b929efc9a6c7fcf5a1e016a82f760298f49ee51e.tar.lz
cuberite-b929efc9a6c7fcf5a1e016a82f760298f49ee51e.tar.xz
cuberite-b929efc9a6c7fcf5a1e016a82f760298f49ee51e.tar.zst
cuberite-b929efc9a6c7fcf5a1e016a82f760298f49ee51e.zip
Diffstat (limited to '')
-rw-r--r--source/Item.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/source/Item.cpp b/source/Item.cpp
index fce4a431b..31a09a608 100644
--- a/source/Item.cpp
+++ b/source/Item.cpp
@@ -3,6 +3,7 @@
#include "Item.h"
#include <json/json.h>
+#include "Items/ItemHandler.h"
@@ -19,6 +20,20 @@ cItem cItem::CopyOne(void) const
+cItem & cItem::AddCount(char a_AmountToAdd)
+{
+ m_ItemCount += a_AmountToAdd;
+ if (m_ItemCount <= 0)
+ {
+ Empty();
+ }
+ return *this;
+}
+
+
+
+
+
short cItem::GetMaxDamage(void) const
{
switch (m_ItemType)
@@ -97,6 +112,25 @@ bool cItem::IsStackableWith(const cItem & a_OtherStack) const
+bool cItem::IsFullStack(void) const
+{
+ return (m_ItemCount >= ItemHandler(m_ItemType)->GetMaxStackSize());
+}
+
+
+
+
+
+/// Returns the cItemHandler responsible for this item type
+cItemHandler * cItem::GetHandler(void) const
+{
+ return ItemHandler(m_ItemType);
+}
+
+
+
+
+
void cItem::GetJson(Json::Value & a_OutValue) const
{
a_OutValue["ID"] = m_ItemType;