MCPcopy Create free account
hub / github.com/MultiMC/Launcher / parseLevelDat

Function parseLevelDat

launcher/minecraft/World.cpp:106–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106std::unique_ptr <nbt::tag_compound> parseLevelDat(QByteArray data)
107{
108 QByteArray output;
109 if(!GZip::unzip(data, output))
110 {
111 return nullptr;
112 }
113 std::istringstream foo(std::string(output.constData(), output.size()));
114 try {
115 auto pair = nbt::io::read_compound(foo);
116
117 if(pair.first != "")
118 return nullptr;
119
120 if(pair.second == nullptr)
121 return nullptr;
122
123 return std::move(pair.second);
124 }
125 catch (const nbt::io::input_error &e)
126 {
127 qWarning() << "Unable to parse level.dat:" << e.what();
128 return nullptr;
129 }
130}
131
132QByteArray serializeLevelDat(nbt::tag_compound * levelInfo)
133{

Callers 2

renameMethod · 0.85
loadFromLevelDatMethod · 0.85

Calls 2

whatMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected