summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-10-29 22:35:16 +0100
committerMattes D <github@xoft.cz>2014-10-29 22:35:16 +0100
commitd898fb904b16e9a08818bcf14d0646db5fb02dde (patch)
tree43821c2e6604e563f5e9a1cc4e9be054d62d7a23 /src/WorldStorage
parentQtBiomeVisualiser: Added quick shutdown to region loaders. (diff)
parentFixed 1.8 world item format reading. (diff)
downloadcuberite-d898fb904b16e9a08818bcf14d0646db5fb02dde.tar
cuberite-d898fb904b16e9a08818bcf14d0646db5fb02dde.tar.gz
cuberite-d898fb904b16e9a08818bcf14d0646db5fb02dde.tar.bz2
cuberite-d898fb904b16e9a08818bcf14d0646db5fb02dde.tar.lz
cuberite-d898fb904b16e9a08818bcf14d0646db5fb02dde.tar.xz
cuberite-d898fb904b16e9a08818bcf14d0646db5fb02dde.tar.zst
cuberite-d898fb904b16e9a08818bcf14d0646db5fb02dde.zip
Diffstat (limited to 'src/WorldStorage')
-rw-r--r--src/WorldStorage/WSSAnvil.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index af7551ee4..0c77b4d67 100644
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -696,11 +696,28 @@ cBlockEntity * cWSSAnvil::LoadBlockEntityFromNBT(const cParsedNBT & a_NBT, int a
bool cWSSAnvil::LoadItemFromNBT(cItem & a_Item, const cParsedNBT & a_NBT, int a_TagIdx)
{
int Type = a_NBT.FindChildByName(a_TagIdx, "id");
- if ((Type < 0) || (a_NBT.GetType(Type) != TAG_Short))
+ if (Type <= 0)
{
return false;
}
- a_Item.m_ItemType = a_NBT.GetShort(Type);
+
+ if (a_NBT.GetType(Type) == TAG_String)
+ {
+ if (!StringToItem(a_NBT.GetString(Type), a_Item))
+ {
+ // Can't resolve item type
+ return false;
+ }
+ }
+ else if (a_NBT.GetType(Type) == TAG_Short)
+ {
+ a_Item.m_ItemType = a_NBT.GetShort(Type);
+ }
+ else
+ {
+ return false;
+ }
+
if (a_Item.m_ItemType < 0)
{
a_Item.Empty();