mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +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>
|
/// </summary>
|
||||||
public Location Location;
|
public Location Location;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Health of the entity
|
||||||
|
/// </summary>
|
||||||
|
public float Health;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new entity based on Entity ID, Entity Type and location
|
/// Create a new entity based on Entity ID, Entity Type and location
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -44,6 +49,7 @@ namespace MinecraftClient.Mapping
|
||||||
this.ID = ID;
|
this.ID = ID;
|
||||||
this.Type = type;
|
this.Type = type;
|
||||||
this.Location = location;
|
this.Location = location;
|
||||||
|
this.Health = 0;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new entity based on Entity ID, Entity Type, location, name and UUID
|
/// 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.Location = location;
|
||||||
this.UUID = uuid;
|
this.UUID = uuid;
|
||||||
this.Name = name;
|
this.Name = name;
|
||||||
|
this.Health = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2119,7 +2119,14 @@ namespace MinecraftClient
|
||||||
/// <param name="metadata">Metadata</param>
|
/// <param name="metadata">Metadata</param>
|
||||||
public void OnEntityMetadata(int entityID, Dictionary<int, object> metadata)
|
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
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue