diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2020-09-23 17:02:32 +0200 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2020-09-25 11:07:01 +0200 |
commit | a2ecbf6a2e515794cdd02e51780ead5b888a2165 (patch) | |
tree | 4b1e7e44c0b65434cdbd5cd11bbaeb6d12f6f45b /src/Item.cpp | |
parent | Fix ice behaviour in world (#4927) (diff) | |
download | cuberite-a2ecbf6a2e515794cdd02e51780ead5b888a2165.tar cuberite-a2ecbf6a2e515794cdd02e51780ead5b888a2165.tar.gz cuberite-a2ecbf6a2e515794cdd02e51780ead5b888a2165.tar.bz2 cuberite-a2ecbf6a2e515794cdd02e51780ead5b888a2165.tar.lz cuberite-a2ecbf6a2e515794cdd02e51780ead5b888a2165.tar.xz cuberite-a2ecbf6a2e515794cdd02e51780ead5b888a2165.tar.zst cuberite-a2ecbf6a2e515794cdd02e51780ead5b888a2165.zip |
Diffstat (limited to 'src/Item.cpp')
-rw-r--r-- | src/Item.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Item.cpp b/src/Item.cpp index f1177c84a..ca4210c75 100644 --- a/src/Item.cpp +++ b/src/Item.cpp @@ -804,9 +804,12 @@ 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) + for (int i = 0; i < a_ItemGrid.GetNumSlots(); ++i) { - Add(a_ItemGrid.GetSlot(i)); + const auto & Slot = a_ItemGrid.GetSlot(i); + if (!Slot.IsEmpty()) + { + Add(Slot); + } } } |