summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-10-29 15:47:43 +0100
committerHowaner <franzi.moos@googlemail.com>2014-10-29 15:47:43 +0100
commit165533c27e380300f5e9411e4d46aa553bf2fdeb (patch)
tree43821c2e6604e563f5e9a1cc4e9be054d62d7a23
parentQtBiomeVisualiser: Added quick shutdown to region loaders. (diff)
downloadcuberite-165533c27e380300f5e9411e4d46aa553bf2fdeb.tar
cuberite-165533c27e380300f5e9411e4d46aa553bf2fdeb.tar.gz
cuberite-165533c27e380300f5e9411e4d46aa553bf2fdeb.tar.bz2
cuberite-165533c27e380300f5e9411e4d46aa553bf2fdeb.tar.lz
cuberite-165533c27e380300f5e9411e4d46aa553bf2fdeb.tar.xz
cuberite-165533c27e380300f5e9411e4d46aa553bf2fdeb.tar.zst
cuberite-165533c27e380300f5e9411e4d46aa553bf2fdeb.zip
-rw-r--r--src/BlockID.cpp7
-rw-r--r--src/WorldStorage/WSSAnvil.cpp21
2 files changed, 25 insertions, 3 deletions
diff --git a/src/BlockID.cpp b/src/BlockID.cpp
index c0f3193bb..c98e0cad1 100644
--- a/src/BlockID.cpp
+++ b/src/BlockID.cpp
@@ -217,7 +217,12 @@ BLOCKTYPE BlockStringToType(const AString & a_BlockTypeString)
bool StringToItem(const AString & a_ItemTypeString, cItem & a_Item)
{
- return gsBlockIDMap.ResolveItem(TrimString(a_ItemTypeString), a_Item);
+ AString ItemName = TrimString(a_ItemTypeString);
+ if (ItemName.substr(0, 10) == "minecraft:")
+ {
+ ItemName = ItemName.substr(10);
+ }
+ return gsBlockIDMap.ResolveItem(ItemName, a_Item);
}
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();