diff --git a/MinecraftClient/Mapping/Entity.cs b/MinecraftClient/Mapping/Entity.cs
index 34ed4a3e..916bb985 100644
--- a/MinecraftClient/Mapping/Entity.cs
+++ b/MinecraftClient/Mapping/Entity.cs
@@ -33,6 +33,11 @@ namespace MinecraftClient.Mapping
///
public Location Location;
+ ///
+ /// Health of the entity
+ ///
+ public float Health;
+
///
/// Create a new entity based on Entity ID, Entity Type and location
///
@@ -44,6 +49,7 @@ namespace MinecraftClient.Mapping
this.ID = ID;
this.Type = type;
this.Location = location;
+ this.Health = 0;
}
///
/// Create a new entity based on Entity ID, Entity Type, location, name and UUID
@@ -60,6 +66,7 @@ namespace MinecraftClient.Mapping
this.Location = location;
this.UUID = uuid;
this.Name = name;
+ this.Health = 0;
}
}
}
diff --git a/MinecraftClient/McClient.cs b/MinecraftClient/McClient.cs
index c12c55ae..14ae10aa 100644
--- a/MinecraftClient/McClient.cs
+++ b/MinecraftClient/McClient.cs
@@ -2119,7 +2119,14 @@ namespace MinecraftClient
/// Metadata
public void OnEntityMetadata(int entityID, Dictionary metadata)
{
-
+ if (entities.ContainsKey(entityID))
+ {
+ // Get health data for an entity
+ if (metadata.ContainsKey(8) && metadata[8].GetType() == typeof(float))
+ {
+ entities[entityID].Health = (float)metadata[8];
+ }
+ }
}
#endregion
}