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

Function read_long

launcher/minecraft/World.cpp:369–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

367}
368
369optional<int64_t> read_long(nbt::value& parent, const char* name)
370{
371 try {
372 auto& namedValue = parent.at(name);
373 if (namedValue.get_type() != nbt::tag_type::Long) {
374 return nullopt;
375 }
376 auto& tag_str = namedValue.as<nbt::tag_long>();
377 return tag_str.get();
378 } catch ([[maybe_unused]] const std::out_of_range& e) {
379 // fallback for old world formats
380 qWarning() << "Long NBT tag" << name << "could not be found.";
381 return nullopt;
382 } catch ([[maybe_unused]] const std::bad_cast& e) {
383 // type mismatch
384 qWarning() << "NBT tag" << name << "could not be converted to long.";
385 return nullopt;
386 }
387}
388
389optional<int> read_int(nbt::value& parent, const char* name)
390{

Callers 2

loadSeedFunction · 0.85
loadFromLevelDatMethod · 0.85

Calls 2

atMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected