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

Function read_long

launcher/minecraft/World.cpp:379–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377}
378
379optional<int64_t> read_long (nbt::value& parent, const char * name)
380{
381 try
382 {
383 auto &namedValue = parent.at(name);
384 if(namedValue.get_type() != nbt::tag_type::Long)
385 {
386 return nullopt;
387 }
388 auto & tag_str = namedValue.as<nbt::tag_long>();
389 return tag_str.get();
390 }
391 catch (const std::out_of_range &e)
392 {
393 // fallback for old world formats
394 qWarning() << "Long NBT tag" << name << "could not be found.";
395 return nullopt;
396 }
397 catch (const std::bad_cast &e)
398 {
399 // type mismatch
400 qWarning() << "NBT tag" << name << "could not be converted to long.";
401 return nullopt;
402 }
403}
404
405optional<int> read_int (nbt::value& parent, const char * name)
406{

Callers 1

loadFromLevelDatMethod · 0.85

Calls 2

atMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected