Add entity health saving.
This commit is contained in:
parent
a1d2c114cf
commit
d4e1277724
@ -345,6 +345,7 @@ void cNBTChunkSerializer::AddBasicEntity(cEntity * a_Entity, const AString & a_C
|
||||
m_Writer.AddDouble("", a_Entity->GetYaw());
|
||||
m_Writer.AddDouble("", a_Entity->GetPitch());
|
||||
m_Writer.EndList();
|
||||
m_Writer.AddShort("Health", a_Entity->GetHealth());
|
||||
}
|
||||
|
||||
|
||||
@ -575,7 +576,6 @@ void cNBTChunkSerializer::AddPickupEntity(cPickup * a_Pickup)
|
||||
m_Writer.BeginCompound("");
|
||||
AddBasicEntity(a_Pickup, "Item");
|
||||
AddItem(a_Pickup->GetItem(), -1, "Item");
|
||||
m_Writer.AddShort("Health", (Int16)(unsigned char)a_Pickup->GetHealth());
|
||||
m_Writer.AddShort("Age", (Int16)a_Pickup->GetAge());
|
||||
m_Writer.EndCompound();
|
||||
}
|
||||
@ -678,7 +678,6 @@ void cNBTChunkSerializer::AddExpOrbEntity(cExpOrb * a_ExpOrb)
|
||||
{
|
||||
m_Writer.BeginCompound("");
|
||||
AddBasicEntity(a_ExpOrb, "XPOrb");
|
||||
m_Writer.AddShort("Health", (Int16)(unsigned char)a_ExpOrb->GetHealth());
|
||||
m_Writer.AddShort("Age", (Int16)a_ExpOrb->GetAge());
|
||||
m_Writer.AddShort("Value", (Int16)a_ExpOrb->GetReward());
|
||||
m_Writer.EndCompound();
|
||||
|
@ -1461,13 +1461,6 @@ void cWSSAnvil::LoadPickupFromNBT(cEntityList & a_Entities, const cParsedNBT & a
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Load health:
|
||||
int Health = a_NBT.FindChildByName(a_TagIdx, "Health");
|
||||
if (Health > 0)
|
||||
{
|
||||
Pickup->SetHealth((int) (a_NBT.GetShort(Health) & 0xFF));
|
||||
}
|
||||
|
||||
// Load age:
|
||||
int Age = a_NBT.FindChildByName(a_TagIdx, "Age");
|
||||
@ -1513,13 +1506,6 @@ void cWSSAnvil::LoadExpOrbFromNBT(cEntityList & a_Entities, const cParsedNBT & a
|
||||
return;
|
||||
}
|
||||
|
||||
// Load Health:
|
||||
int Health = a_NBT.FindChildByName(a_TagIdx, "Health");
|
||||
if (Health > 0)
|
||||
{
|
||||
ExpOrb->SetHealth((int) (a_NBT.GetShort(Health) & 0xFF));
|
||||
}
|
||||
|
||||
// Load Age:
|
||||
int Age = a_NBT.FindChildByName(a_TagIdx, "Age");
|
||||
if (Age > 0)
|
||||
@ -2437,6 +2423,13 @@ bool cWSSAnvil::LoadEntityBaseFromNBT(cEntity & a_Entity, const cParsedNBT & a_N
|
||||
}
|
||||
a_Entity.SetYaw(Rotation[0]);
|
||||
a_Entity.SetRoll(Rotation[1]);
|
||||
|
||||
// Load health:
|
||||
int Health = a_NBT.FindChildByName(a_TagIdx, "Health");
|
||||
if (Health > 0)
|
||||
{
|
||||
a_Entity.SetHealth(a_NBT.GetShort(Health));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user