mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Add health information for entity
This commit is contained in:
parent
44270ab394
commit
1f93fdbab5
2 changed files with 15 additions and 1 deletions
|
|
@ -33,6 +33,11 @@ namespace MinecraftClient.Mapping
|
|||
/// </summary>
|
||||
public Location Location;
|
||||
|
||||
/// <summary>
|
||||
/// Health of the entity
|
||||
/// </summary>
|
||||
public float Health;
|
||||
|
||||
/// <summary>
|
||||
/// Create a new entity based on Entity ID, Entity Type and location
|
||||
/// </summary>
|
||||
|
|
@ -44,6 +49,7 @@ namespace MinecraftClient.Mapping
|
|||
this.ID = ID;
|
||||
this.Type = type;
|
||||
this.Location = location;
|
||||
this.Health = 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2119,7 +2119,14 @@ namespace MinecraftClient
|
|||
/// <param name="metadata">Metadata</param>
|
||||
public void OnEntityMetadata(int entityID, Dictionary<int, object> 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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue