using System; using System.Collections.Generic; using MinecraftClient.Inventory; namespace MinecraftClient.Mapping { /// /// Represents an entity evolving into a Minecraft world /// public class Entity { /// /// ID of the entity on the Minecraft server /// public int ID; /// /// UUID of the entity if it is a player. /// public Guid UUID; /// /// Nickname of the entity if it is a player. /// public string? Name; /// /// CustomName of the entity. /// public string? CustomNameJson; /// /// IsCustomNameVisible of the entity. /// public bool IsCustomNameVisible; /// /// CustomName of the entity. /// public string? CustomName; /// /// Latency of the entity if it is a player. /// public int Latency; /// /// Entity type /// public EntityType Type; /// /// Entity location in the Minecraft world /// public Location Location; /// /// Entity head yaw /// /// Untested public float Yaw = 0; /// /// Entity head pitch /// /// Untested public float Pitch = 0; /// /// Used in Item Frame, Falling Block and Fishing Float. /// See https://wiki.vg/Object_Data for details. /// /// Untested public int ObjectData = -1; /// /// Health of the entity /// public float Health; /// /// Item of the entity if ItemFrame or Item /// public Item Item; /// /// Entity pose in the Minecraft world /// public EntityPose Pose; /// /// Entity metadata /// public Dictionary? Metadata; /// /// Entity equipment /// public Dictionary Equipment; /// /// Create a new entity based on Entity ID, Entity Type and location /// /// Entity ID /// Entity Type Enum /// Entity location public Entity(int ID, EntityType type, Location location) { this.ID = ID; Type = type; Location = location; Health = 1.0f; Equipment = new Dictionary(); Item = new Item(ItemType.Air, 0, null); } /// /// Create a new entity based on Entity ID, Entity Type and location /// /// Entity ID /// Entity Type Enum /// Entity location public Entity(int ID, EntityType type, Location location, byte yaw, byte pitch, int objectData) { this.ID = ID; Type = type; Location = location; Health = 1.0f; Equipment = new Dictionary(); Item = new Item(ItemType.Air, 0, null); Yaw = yaw * (1 / 256) * 360; // to angle in 360 degree Pitch = pitch * (1 / 256) * 360; ObjectData = objectData; } /// /// Create a new entity based on Entity ID, Entity Type, location, name and UUID /// /// Entity ID /// Entity Type Enum /// Entity location /// Player uuid /// Player name public Entity(int ID, EntityType type, Location location, Guid uuid, string? name, byte yaw, byte pitch) { this.ID = ID; Type = type; Location = location; UUID = uuid; Name = name; Health = 1.0f; Equipment = new Dictionary(); Item = new Item(ItemType.Air, 0, null); Yaw = yaw * (1 / 256) * 360; // to angle in 360 degree Pitch = pitch * (1 / 256) * 360; } } }