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

Function parseLevelDat

launcher/minecraft/World.cpp:125–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 3

renameMethod · 0.85
loadSeedFunction · 0.85
loadFromLevelDatMethod · 0.85

Calls 3

moveFunction · 0.85
whatMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected