diff options
author | Howaner <franzi.moos@googlemail.com> | 2015-02-18 23:33:27 +0100 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2015-02-18 23:33:27 +0100 |
commit | 1a60785ca248bb081bf9fc699273292540a1de5f (patch) | |
tree | 61d63e4893bf54807c76a2513cab2f8076233817 /src/WorldStorage | |
parent | NetworkSingleton: LibEvent thread is joined properly on server exit. (diff) | |
download | cuberite-1a60785ca248bb081bf9fc699273292540a1de5f.tar cuberite-1a60785ca248bb081bf9fc699273292540a1de5f.tar.gz cuberite-1a60785ca248bb081bf9fc699273292540a1de5f.tar.bz2 cuberite-1a60785ca248bb081bf9fc699273292540a1de5f.tar.lz cuberite-1a60785ca248bb081bf9fc699273292540a1de5f.tar.xz cuberite-1a60785ca248bb081bf9fc699273292540a1de5f.tar.zst cuberite-1a60785ca248bb081bf9fc699273292540a1de5f.zip |
Diffstat (limited to 'src/WorldStorage')
-rwxr-xr-x | src/WorldStorage/WSSAnvil.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index ae82db346..cc8b8d3f5 100755 --- a/src/WorldStorage/WSSAnvil.cpp +++ b/src/WorldStorage/WSSAnvil.cpp @@ -1007,21 +1007,28 @@ cBlockEntity * cWSSAnvil::LoadFlowerPotFromNBT(const cParsedNBT & a_NBT, int a_T } std::unique_ptr<cFlowerPotEntity> FlowerPot(new cFlowerPotEntity(a_BlockX, a_BlockY, a_BlockZ, m_World)); - short ItemType = 0, ItemData = 0; + cItem Item; int currentLine = a_NBT.FindChildByName(a_TagIdx, "Item"); if (currentLine >= 0) { - ItemType = (short) a_NBT.GetInt(currentLine); + if (a_NBT.GetType(currentLine) == TAG_String) + { + StringToItem(a_NBT.GetString(currentLine), Item); + } + else if (a_NBT.GetType(currentLine) == TAG_Int) + { + Item.m_ItemType = (short) a_NBT.GetInt(currentLine); + } } currentLine = a_NBT.FindChildByName(a_TagIdx, "Data"); - if (currentLine >= 0) + if ((currentLine >= 0) && (a_NBT.GetType(currentLine) == TAG_Int)) { - ItemData = (short) a_NBT.GetInt(currentLine); + Item.m_ItemDamage = (short) a_NBT.GetInt(currentLine); } - FlowerPot->SetItem(cItem(ItemType, 1, ItemData)); + FlowerPot->SetItem(Item); return FlowerPot.release(); } |