MCPcopy Create free account
hub / github.com/cuberite/cuberite / LoadExpOrbFromNBT

Method LoadExpOrbFromNBT

src/WorldStorage/WSSAnvil.cpp:1479–1509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1477
1478
1479void cWSSAnvil::LoadExpOrbFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
1480{
1481 std::auto_ptr<cExpOrb> ExpOrb(new cExpOrb(0.0, 0.0, 0.0, 0));
1482 if (!LoadEntityBaseFromNBT(*ExpOrb.get(), a_NBT, a_TagIdx))
1483 {
1484 return;
1485 }
1486
1487 // Load Health:
1488 int Health = a_NBT.FindChildByName(a_TagIdx, "Health");
1489 if (Health > 0)
1490 {
1491 ExpOrb->SetHealth((int) (a_NBT.GetShort(Health) & 0xFF));
1492 }
1493
1494 // Load Age:
1495 int Age = a_NBT.FindChildByName(a_TagIdx, "Age");
1496 if (Age > 0)
1497 {
1498 ExpOrb->SetAge(a_NBT.GetShort(Age));
1499 }
1500
1501 // Load Reward (Value):
1502 int Reward = a_NBT.FindChildByName(a_TagIdx, "Value");
1503 if (Reward > 0)
1504 {
1505 ExpOrb->SetReward(a_NBT.GetShort(Reward));
1506 }
1507
1508 a_Entities.push_back(ExpOrb.release());
1509}
1510
1511
1512

Callers

nothing calls this directly

Calls 7

getMethod · 0.80
SetHealthMethod · 0.80
GetShortMethod · 0.80
SetRewardMethod · 0.80
releaseMethod · 0.80
FindChildByNameMethod · 0.45
SetAgeMethod · 0.45

Tested by

no test coverage detected