diff options
author | Tobias Wilken <TooAngel@TooAngel.de> | 2020-07-14 18:56:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-14 18:56:42 +0200 |
commit | 36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9 (patch) | |
tree | 04c224231a800002692a296131af4988dd465845 /src/Inventory.cpp | |
parent | Custom command depend is automatic (diff) | |
download | cuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.tar cuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.tar.gz cuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.tar.bz2 cuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.tar.lz cuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.tar.xz cuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.tar.zst cuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Inventory.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/Inventory.cpp b/src/Inventory.cpp index 42c243f17..6509dfe5d 100644 --- a/src/Inventory.cpp +++ b/src/Inventory.cpp @@ -105,6 +105,8 @@ int cInventory::HowManyCanFit(const cItem & a_ItemStack, int a_BeginSlotNum, int int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks) { + m_Owner.AddKnownItem(a_Item); + cItem ToAdd(a_Item); int res = 0; @@ -207,6 +209,26 @@ int cInventory::RemoveItem(const cItem & a_ItemStack) +cItem * cInventory::FindItem(const cItem & a_RecipeItem) +{ + cItem * Item = m_ShieldSlots.FindItem(a_RecipeItem); + if (Item != nullptr) + { + return Item; + } + Item = m_HotbarSlots.FindItem(a_RecipeItem); + if (Item != nullptr) + { + return Item; + } + + return m_InventorySlots.FindItem(a_RecipeItem); +} + + + + + bool cInventory::RemoveOneEquippedItem(void) { if (m_HotbarSlots.GetSlot(m_EquippedSlotNum).IsEmpty()) @@ -863,7 +885,3 @@ void cInventory::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) SendSlot(Base + a_SlotNum); } - - - - |