summaryrefslogtreecommitdiffstats
path: root/src/Item.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2019-10-16 10:06:34 +0200
committerGitHub <noreply@github.com>2019-10-16 10:06:34 +0200
commit221cc4ec5cb6301743e947eaabed3fecedba796f (patch)
tree4e44c8bb7523e5d1d04468fc906ae24674c10abc /src/Item.cpp
parentFixed crash in hopper while pulling items from blockentity above itself (#4412) (diff)
downloadcuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar
cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.gz
cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.bz2
cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.lz
cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.xz
cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.zst
cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.zip
Diffstat (limited to '')
-rw-r--r--src/Item.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Item.cpp b/src/Item.cpp
index 5d486fdab..16aa22b50 100644
--- a/src/Item.cpp
+++ b/src/Item.cpp
@@ -2,6 +2,7 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Item.h"
+#include "ItemGrid.h"
#include "json/json.h"
#include "Items/ItemHandler.h"
@@ -626,6 +627,15 @@ int cItem::AddEnchantmentsFromItem(const cItem & a_Other)
////////////////////////////////////////////////////////////////////////////////
// cItems:
+cItems::cItems(cItem && a_InitialItem)
+{
+ push_back(std::move(a_InitialItem));
+}
+
+
+
+
+
cItem * cItems::Get(int a_Idx)
{
if ((a_Idx < 0) || (a_Idx >= static_cast<int>(size())))
@@ -711,3 +721,14 @@ bool cItems::ContainsType(const cItem & a_Item)
}
+
+
+
+void cItems::AddItemGrid(const cItemGrid & a_ItemGrid)
+{
+ auto numSlots = a_ItemGrid.GetNumSlots();
+ for (int i = 0; i < numSlots; ++i)
+ {
+ Add(a_ItemGrid.GetSlot(i));
+ }
+}