diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-05-26 22:52:39 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-05-26 22:52:39 +0200 |
commit | edbc2790e31f27195835ef184a9d452bc83b2c56 (patch) | |
tree | 6d6904f240ad9e7d9f61ee99a9e6a18da4663a7c /source/DropSpenserEntity.cpp | |
parent | Clarified documentation on the cItemGrid:RemoveItem() functions (diff) | |
download | cuberite-edbc2790e31f27195835ef184a9d452bc83b2c56.tar cuberite-edbc2790e31f27195835ef184a9d452bc83b2c56.tar.gz cuberite-edbc2790e31f27195835ef184a9d452bc83b2c56.tar.bz2 cuberite-edbc2790e31f27195835ef184a9d452bc83b2c56.tar.lz cuberite-edbc2790e31f27195835ef184a9d452bc83b2c56.tar.xz cuberite-edbc2790e31f27195835ef184a9d452bc83b2c56.tar.zst cuberite-edbc2790e31f27195835ef184a9d452bc83b2c56.zip |
Diffstat (limited to 'source/DropSpenserEntity.cpp')
-rw-r--r-- | source/DropSpenserEntity.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/source/DropSpenserEntity.cpp b/source/DropSpenserEntity.cpp index 580f96944..3830e1d01 100644 --- a/source/DropSpenserEntity.cpp +++ b/source/DropSpenserEntity.cpp @@ -146,8 +146,14 @@ bool cDropSpenserEntity::LoadFromJson(const Json::Value & a_Value) int SlotIdx = 0;
for (Json::Value::iterator itr = AllSlots.begin(); itr != AllSlots.end(); ++itr)
{
- m_Contents.GetSlot(SlotIdx).FromJson(*itr);
+ cItem Contents;
+ Contents.FromJson(*itr);
+ m_Contents.SetSlot(SlotIdx, Contents);
SlotIdx++;
+ if (SlotIdx >= m_Contents.GetNumSlots())
+ {
+ return true;
+ }
}
return true;
@@ -210,3 +216,20 @@ void cDropSpenserEntity::UsedBy(cPlayer * a_Player) +
+void cDropSpenserEntity::DropFromSlot(int a_SlotNum)
+{
+ int DispX = m_PosX;
+ int DispY = m_PosY;
+ int DispZ = m_PosZ;
+ NIBBLETYPE Meta = m_World->GetBlockMeta(m_PosX, m_PosY, m_PosZ);
+ AddDropSpenserDir(DispX, DispY, DispZ, Meta);
+
+ cItems Pickups;
+ Pickups.push_back(m_Contents.RemoveOneItem(a_SlotNum));
+ m_World->SpawnItemPickups(Pickups, DispX, DispY, DispZ);
+}
+
+
+
+
|