summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-11 14:46:09 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-11 14:46:09 +0200
commit15a50318852bb232a8ae25e9c3b4e13c49f52a1b (patch)
tree18be0fa7c76e4d87e0ec2aef86caa2bbc3d90139 /source
parentRemoved a useless include file. (diff)
downloadcuberite-15a50318852bb232a8ae25e9c3b4e13c49f52a1b.tar
cuberite-15a50318852bb232a8ae25e9c3b4e13c49f52a1b.tar.gz
cuberite-15a50318852bb232a8ae25e9c3b4e13c49f52a1b.tar.bz2
cuberite-15a50318852bb232a8ae25e9c3b4e13c49f52a1b.tar.lz
cuberite-15a50318852bb232a8ae25e9c3b4e13c49f52a1b.tar.xz
cuberite-15a50318852bb232a8ae25e9c3b4e13c49f52a1b.tar.zst
cuberite-15a50318852bb232a8ae25e9c3b4e13c49f52a1b.zip
Diffstat (limited to 'source')
-rw-r--r--source/items/Item.cpp16
-rw-r--r--source/items/Item.h12
2 files changed, 28 insertions, 0 deletions
diff --git a/source/items/Item.cpp b/source/items/Item.cpp
index 35a612434..47c0852e9 100644
--- a/source/items/Item.cpp
+++ b/source/items/Item.cpp
@@ -237,6 +237,22 @@ void cItemHandler::OnFoodEaten(cWorld *a_World, cPlayer *a_Player, cItem *a_Item
+char cItemHandler::GetMaxStackSize(void)
+{
+ if (m_ItemID < 256)
+ {
+ // All blocks can stack up to 64
+ return 64;
+ }
+
+ // By default items don't stack:
+ return 1;
+}
+
+
+
+
+
bool cItemHandler::IsTool()
{
return
diff --git a/source/items/Item.h b/source/items/Item.h
index a465ae80a..5fe260fd8 100644
--- a/source/items/Item.h
+++ b/source/items/Item.h
@@ -1,10 +1,19 @@
+
#pragma once
#include "../Defines.h"
+
+
+
+
+// fwd:
class cWorld;
class cPlayer;
+
+
+
class cItemHandler
{
public:
@@ -13,6 +22,9 @@ public:
virtual bool OnDiggingBlock(cWorld *a_World, cPlayer *a_Player, cItem *a_Item, int a_X, int a_Y, int a_Z, char a_Dir);
virtual void OnBlockDestroyed(cWorld *a_World, cPlayer *a_Player, cItem *a_Item, int a_X, int a_Y, int a_Z);
virtual void OnFoodEaten(cWorld *a_World, cPlayer *a_Player, cItem *a_Item);
+
+ /// Returns the maximum stack size for a given item
+ virtual char GetMaxStackSize(void);
struct FoodInfo
{