summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/WSSAnvil.cpp
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/WSSAnvil.cpp
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 '')
-rw-r--r--src/WorldStorage/WSSAnvil.cpp7
1 files changed, 1 insertions, 6 deletions
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;
}