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

Function read_long

launcher/minecraft/World.cpp:422–446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420}
421
422optional<int64_t> read_long (nbt::value& parent, const char * name)
423{
424 try
425 {
426 auto &namedValue = parent.at(name);
427 if(namedValue.get_type() != nbt::tag_type::Long)
428 {
429 return nullopt;
430 }
431 auto & tag_str = namedValue.as<nbt::tag_long>();
432 return tag_str.get();
433 }
434 catch (const std::out_of_range &e)
435 {
436 // fallback for old world formats
437 qWarning() << "Long NBT tag" << name << "could not be found.";
438 return nullopt;
439 }
440 catch (const std::bad_cast &e)
441 {
442 // type mismatch
443 qWarning() << "NBT tag" << name << "could not be converted to long.";
444 return nullopt;
445 }
446}
447
448optional<int> read_int (nbt::value& parent, const char * name)
449{

Callers 1

loadFromLevelDatMethod · 0.85

Calls 2

atMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected