summaryrefslogtreecommitdiffstats
path: root/src/Inventory.h
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2020-04-02 14:42:15 +0200
committerGitHub <noreply@github.com>2020-04-02 14:42:15 +0200
commitcdc452916e3ec7e61f4a1ad822666192593b4b08 (patch)
treefcf35adfb6f907b7c2cd4388facc551cfe6c684a /src/Inventory.h
parentTweak attack ranges (diff)
downloadcuberite-cdc452916e3ec7e61f4a1ad822666192593b4b08.tar
cuberite-cdc452916e3ec7e61f4a1ad822666192593b4b08.tar.gz
cuberite-cdc452916e3ec7e61f4a1ad822666192593b4b08.tar.bz2
cuberite-cdc452916e3ec7e61f4a1ad822666192593b4b08.tar.lz
cuberite-cdc452916e3ec7e61f4a1ad822666192593b4b08.tar.xz
cuberite-cdc452916e3ec7e61f4a1ad822666192593b4b08.tar.zst
cuberite-cdc452916e3ec7e61f4a1ad822666192593b4b08.zip
Diffstat (limited to 'src/Inventory.h')
-rw-r--r--src/Inventory.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Inventory.h b/src/Inventory.h
index b91b16c8b..7436d7528 100644
--- a/src/Inventory.h
+++ b/src/Inventory.h
@@ -71,6 +71,7 @@ public:
/** Adds as many items out of a_ItemStack as can fit.
If a_AllowNewStacks is set to false, only existing stacks can be topped up;
if a_AllowNewStacks is set to true, empty slots can be used for the rest.
+ Fills existing stacks first and fills the hotbar before the main inventory.
Returns the number of items that fit.
*/
int AddItem(const cItem & a_ItemStack, bool a_AllowNewStacks = true);
@@ -90,6 +91,13 @@ public:
/** Removes one item out of the currently equipped item stack, returns true if successful, false if empty-handed */
bool RemoveOneEquippedItem(void);
+ /** Removes one item from the the current equipped item stack, and attempts to add the specified item stack
+ back to the same slot. If it is not possible to place the item in the same slot, optionally (default true) tries to
+ place the specified item elsewhere in the inventory. Returns the number of items successfully added. If the
+ currently equipped slot is empty, its contents are simply set to the given Item.
+ */
+ int ReplaceOneEquippedItem(const cItem & a_Item, bool a_TryOtherSlots = true);
+
/** Returns the number of items of type a_Item that are stored */
int HowManyItems(const cItem & a_Item);
@@ -143,6 +151,8 @@ public:
void SetHotbarSlot(int a_HotBarSlotNum, const cItem & a_Item);
/** Sets current item in shield slot */
void SetShieldSlot(const cItem & a_Item);
+ /** Sets current item in the equipped hotbar slot */
+ void SetEquippedItem(const cItem & a_Item);
/** Sets equiped item to the a_SlotNum slot number */
void SetEquippedSlotNum(int a_SlotNum);
/** Returns slot number of equiped item */