MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / parseLevelDat

Function parseLevelDat

launcher/minecraft/World.cpp:127–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127std::unique_ptr <nbt::tag_compound> parseLevelDat(QByteArray data)
128{
129 QByteArray output;
130 if(!GZip::unzip(data, output))
131 {
132 return nullptr;
133 }
134 std::istringstream foo(std::string(output.constData(), output.size()));
135 try {
136 auto pair = nbt::io::read_compound(foo);
137
138 if(pair.first != "")
139 return nullptr;
140
141 if(pair.second == nullptr)
142 return nullptr;
143
144 return std::move(pair.second);
145 }
146 catch (const nbt::io::input_error &e)
147 {
148 qWarning() << "Unable to parse level.dat:" << e.what();
149 return nullptr;
150 }
151}
152
153QByteArray serializeLevelDat(nbt::tag_compound * levelInfo)
154{

Callers 2

renameMethod · 0.85
loadFromLevelDatMethod · 0.85

Calls 2

whatMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected