mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
* Implement entity metadata protocol handling * Add health information for entity * Make AutoAttack check entity health * LivingEntity: Default health is 1.0 as per https://wiki.vg/Entity_metadata#Living_Entity * Fix entity metadata for lower MC versions * Fix commit888297d(1.0f instead of 1.0) * Add OnEntityHealth ChatBot event (Remove protocol-dependant stuff from McClient (undo part of85c32b9)) * Remove OnEntityMetadata in favor of OnEntityHealth Co-authored-by: ORelio <ORelio@users.noreply.github.com>
72 lines
2.1 KiB
C#
72 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace MinecraftClient.Mapping
|
|
{
|
|
/// <summary>
|
|
/// Represents an entity evolving into a Minecraft world
|
|
/// </summary>
|
|
public class Entity
|
|
{
|
|
/// <summary>
|
|
/// ID of the entity on the Minecraft server
|
|
/// </summary>
|
|
public int ID;
|
|
|
|
/// <summary>
|
|
/// UUID of the entity if it is a player.
|
|
/// </summary>
|
|
public Guid UUID;
|
|
|
|
/// <summary>
|
|
/// Nickname of the entity if it is a player.
|
|
/// </summary>
|
|
public string Name;
|
|
|
|
/// <summary>
|
|
/// Entity type
|
|
/// </summary>
|
|
public EntityType Type;
|
|
|
|
/// <summary>
|
|
/// Entity location in the Minecraft world
|
|
/// </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>
|
|
/// <param name="ID">Entity ID</param>
|
|
/// <param name="type">Entity Type Enum</param>
|
|
/// <param name="location">Entity location</param>
|
|
public Entity(int ID, EntityType type, Location location)
|
|
{
|
|
this.ID = ID;
|
|
this.Type = type;
|
|
this.Location = location;
|
|
this.Health = 1.0f;
|
|
}
|
|
/// <summary>
|
|
/// Create a new entity based on Entity ID, Entity Type, location, name and UUID
|
|
/// </summary>
|
|
/// <param name="ID">Entity ID</param>
|
|
/// <param name="type">Entity Type Enum</param>
|
|
/// <param name="location">Entity location</param>
|
|
/// <param name="uuid">Player uuid</param>
|
|
/// <param name="name">Player name</param>
|
|
public Entity(int ID, EntityType type, Location location, Guid uuid, string name)
|
|
{
|
|
this.ID = ID;
|
|
this.Type = type;
|
|
this.Location = location;
|
|
this.UUID = uuid;
|
|
this.Name = name;
|
|
this.Health = 1.0f;
|
|
}
|
|
}
|
|
}
|