summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-29 21:50:30 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-29 21:50:30 +0200
commit4f5d73b7704e351365a987b421c35f1384afa240 (patch)
tree88b4da666ea4723377cfa489c737618ef8cde2b1 /src/WorldStorage
parentMerge pull request #1061 from mc-server/portals (diff)
downloadcuberite-4f5d73b7704e351365a987b421c35f1384afa240.tar
cuberite-4f5d73b7704e351365a987b421c35f1384afa240.tar.gz
cuberite-4f5d73b7704e351365a987b421c35f1384afa240.tar.bz2
cuberite-4f5d73b7704e351365a987b421c35f1384afa240.tar.lz
cuberite-4f5d73b7704e351365a987b421c35f1384afa240.tar.xz
cuberite-4f5d73b7704e351365a987b421c35f1384afa240.tar.zst
cuberite-4f5d73b7704e351365a987b421c35f1384afa240.zip
Diffstat (limited to 'src/WorldStorage')
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp1
-rw-r--r--src/WorldStorage/WSSAnvil.cpp7
2 files changed, 1 insertions, 7 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index b7a3d40ce..4857da1b6 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -486,7 +486,6 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
m_Writer.AddFloat("", a_Monster->GetDropChanceBoots());
m_Writer.EndList();
m_Writer.AddByte("CanPickUpLoot", (char)a_Monster->CanPickUpLoot());
- m_Writer.AddShort("Health", (short)a_Monster->GetHealth());
switch (a_Monster->GetMobType())
{
case cMonster::mtBat:
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index 6134e2c0a..71ff3ef99 100644
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -2475,10 +2475,7 @@ bool cWSSAnvil::LoadEntityBaseFromNBT(cEntity & a_Entity, const cParsedNBT & a_N
// Load health:
int Health = a_NBT.FindChildByName(a_TagIdx, "Health");
- if (Health > 0)
- {
- a_Entity.SetHealth(a_NBT.GetShort(Health));
- }
+ a_Entity.SetHealth(Health > 0 ? a_NBT.GetShort(Health) : a_Entity.GetMaxHealth());
return true;
}
@@ -2507,8 +2504,6 @@ bool cWSSAnvil::LoadMonsterBaseFromNBT(cMonster & a_Monster, const cParsedNBT &
a_Monster.SetCanPickUpLoot(CanPickUpLoot);
}
- int HealthTag = a_NBT.FindChildByName(a_TagIdx, "Health");
- a_Monster.SetHealth(HealthTag > 0 ? a_NBT.GetShort(HealthTag) : a_Monster.GetMaxHealth());
return true;
}