using System; using System.Collections.Generic; using System.Linq; using System.Text; 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; /// /// Entity type determined by Minecraft Console Client /// public EntityType Type; /// /// Entity type ID (more precise than Type, but may change between Minecraft versions) /// public int TypeID; /// /// Entity location in the Minecraft world /// public Location Location; /// /// Create a new entity based on Entity ID and location /// /// Entity ID /// Entity location public Entity(int ID, Location location) { this.ID = ID; this.Location = location; } /// /// Create a new entity based on Entity ID, Entity Type and location /// /// Entity ID /// Entity Type ID /// Entity location public Entity(int ID, int TypeID, Location location) { this.ID = ID; this.TypeID = TypeID; this.Location = location; } /// /// Create a new entity based on Entity ID, Entity Type, location, and UUID /// /// Entity ID /// Entity Type ID /// Entity Type Enum /// Entity location public Entity(int ID, int TypeID, EntityType type, Location location, Guid uuid) { this.ID = ID; this.TypeID = TypeID; this.Type = type; this.Location = location; this.UUID = uuid; } /// /// 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; this.Type = type; this.Location = location; } /// /// Create a new entity based on Entity ID, Entity Type, location and UUID /// /// Entity ID /// Entity Type Enum /// Entity location public Entity(int ID, EntityType type, Location location, Guid uuid) { this.ID = ID; this.Type = type; this.Location = location; this.UUID = uuid; } /// /// Return TRUE if the Entity is an hostile mob /// /// New mobs added in newer Minecraft versions might be absent from the list /// TRUE if hostile public bool IsHostile() { switch (TypeID) { case 5: return true; // Blaze; case 12: return true; // Creeper case 16: return true; // Drowned case 23: return true; // Evoker case 29: return true; // Ghast case 31: return true; // Guardian case 33: return true; // Husk case 41: return true; // Magma Cube case 57: return true; // Zombie Pigman case 63: return true; // Shulker case 65: return true; // Silverfish case 66: return true; // Skeleton case 68: return true; // Slime case 75: return true; // Stray case 84: return true; // Vex case 87: return true; // Vindicator case 88: return true; // Pillager case 90: return true; // Witch case 92: return true; // Wither Skeleton case 95: return true; // Zombie case 97: return true; // Zombie Villager case 98: return true; // Phantom case 99: return true; // Ravager default: return false; } } } }