+ if(name == "MaterialItem")
+ {
+ // Obsoleted on 2011-07-30
+
+ u16 material;
+ is>>material;
+ u16 materialcount;
+ is>>materialcount;
+ // Convert old materials
+ if(material <= 0xff)
+ material = content_translate_from_19_to_internal(material);
+ if(material > 0xfff)
+ throw SerializationError("Too large material number");
+ // Convert old id to name
+ NameIdMapping legacy_nimap;
+ content_mapnode_get_name_id_mapping(&legacy_nimap);
+ legacy_nimap.getName(material, name);
+ if(name.empty())
+ name = "unknown_block";
+ if (itemdef)
+ name = itemdef->getAlias(name);
+ count = materialcount;
+ }
+ else if(name == "MaterialItem2")
+ {
+ // Obsoleted on 2011-11-16
+
+ u16 material;
+ is>>material;
+ u16 materialcount;
+ is>>materialcount;
+ if(material > 0xfff)
+ throw SerializationError("Too large material number");
+ // Convert old id to name
+ NameIdMapping legacy_nimap;
+ content_mapnode_get_name_id_mapping(&legacy_nimap);
+ legacy_nimap.getName(material, name);
+ if(name.empty())
+ name = "unknown_block";
+ if (itemdef)
+ name = itemdef->getAlias(name);
+ count = materialcount;
+ }
+ else if(name == "node" || name == "NodeItem" || name == "MaterialItem3"
+ || name == "craft" || name == "CraftItem")
+ {
+ // Obsoleted on 2012-01-07
+
+ std::string all;
+ std::getline(is, all, '\n');
+ // First attempt to read inside ""
+ Strfnd fnd(all);
+ fnd.next("\"");
+ // If didn't skip to end, we have ""s
+ if(!fnd.at_end()){
+ name = fnd.next("\"");
+ } else { // No luck, just read a word then
+ fnd.start(all);
+ name = fnd.next(" ");
+ }
+ fnd.skip_over(" ");
+ if (itemdef)
+ name = itemdef->getAlias(name);
+ count = stoi(trim(fnd.next("")));
+ if(count == 0)
+ count = 1;
+ }
+ else if(name == "MBOItem")
+ {
+ // Obsoleted on 2011-10-14
+ throw SerializationError("MBOItem not supported anymore");
+ }
+ else if(name == "tool" || name == "ToolItem")
+ {
+ // Obsoleted on 2012-01-07