From 5b471b518f4d7fe50de4fbfb8741bdf7310dcdf2 Mon Sep 17 00:00:00 2001 From: ITHackerstein Date: Mon, 28 Nov 2022 08:29:55 +0100 Subject: [PATCH 1/2] EntityNear: Created a new command called 'entitynear' similar to the 'entity' command except it will interact with the entity closest to the player. --- MinecraftClient/Commands/EntityNear.cs | 148 +++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 MinecraftClient/Commands/EntityNear.cs diff --git a/MinecraftClient/Commands/EntityNear.cs b/MinecraftClient/Commands/EntityNear.cs new file mode 100644 index 00000000..894f9fda --- /dev/null +++ b/MinecraftClient/Commands/EntityNear.cs @@ -0,0 +1,148 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Text; +using MinecraftClient.Inventory; +using MinecraftClient.Mapping; + +namespace MinecraftClient.Commands +{ + class EntityNear : Command + { + public override string CmdName { get { return "entitynear"; } } + public override string CmdUsage { get { return "entitynear "; } } + public override string CmdDesc { get { return string.Empty; } } + + private static void GetEntityInfoDetailed(StringBuilder sb, McClient handler, Entity entity) + { + int id = entity.ID; + float health = entity.Health; + int latency = entity.Latency; + Item item = entity.Item; + string? nickname = entity.Name; + string? customname = entity.CustomName; + EntityPose pose = entity.Pose; + EntityType type = entity.Type; + double distance = Math.Round(entity.Location.Distance(handler.GetCurrentLocation()), 2); + + string color = "§a"; // Green + if (health < 10) + color = "§c"; // Red + else if (health < 15) + color = "§e"; // Yellow + + string location = $"X:{Math.Round(entity.Location.X, 2)}, Y:{Math.Round(entity.Location.Y, 2)}, Z:{Math.Round(entity.Location.Z, 2)}"; + sb.Append($"{Translations.cmd_entityCmd_entity}: {id}\n [MCC] Type: {entity.GetTypeString()}"); + if (!string.IsNullOrEmpty(nickname)) + sb.Append($"\n [MCC] {Translations.cmd_entityCmd_nickname}: {nickname}"); + else if (!string.IsNullOrEmpty(customname)) + sb.Append($"\n [MCC] {Translations.cmd_entityCmd_customname}: {customname.Replace("&", "§")}§8"); + if (type == EntityType.Player) + sb.Append($"\n [MCC] {Translations.cmd_entityCmd_latency}: {latency}"); + else if (type == EntityType.Item || type == EntityType.ItemFrame || type == Mapping.EntityType.EyeOfEnder || type == Mapping.EntityType.Egg || type == Mapping.EntityType.EnderPearl || type == Mapping.EntityType.Potion || type == Mapping.EntityType.Fireball || type == Mapping.EntityType.FireworkRocket) + { + string? displayName = item.DisplayName; + if (string.IsNullOrEmpty(displayName)) + sb.Append($"\n [MCC] {Translations.cmd_entityCmd_item}: {item.GetTypeString()} x{item.Count}"); + else + sb.Append($"\n [MCC] {Translations.cmd_entityCmd_item}: {item.GetTypeString()} x{item.Count} - {displayName}§8"); + } + + if (entity.Equipment.Count >= 1 && entity.Equipment != null) + { + sb.Append($"\n [MCC] {Translations.cmd_entityCmd_equipment}:"); + if (entity.Equipment.ContainsKey(0) && entity.Equipment[0] != null) + sb.Append($"\n [MCC] {Translations.cmd_entityCmd_mainhand}: {entity.Equipment[0].GetTypeString()} x{entity.Equipment[0].Count}"); + if (entity.Equipment.ContainsKey(1) && entity.Equipment[1] != null) + sb.Append($"\n [MCC] {Translations.cmd_entityCmd_offhand}: {entity.Equipment[1].GetTypeString()} x{entity.Equipment[1].Count}"); + if (entity.Equipment.ContainsKey(5) && entity.Equipment[5] != null) + sb.Append($"\n [MCC] {Translations.cmd_entityCmd_helmet}: {entity.Equipment[5].GetTypeString()} x{entity.Equipment[5].Count}"); + if (entity.Equipment.ContainsKey(4) && entity.Equipment[4] != null) + sb.Append($"\n [MCC] {Translations.cmd_entityCmd_chestplate}: {entity.Equipment[4].GetTypeString()} x{entity.Equipment[4].Count}"); + if (entity.Equipment.ContainsKey(3) && entity.Equipment[3] != null) + sb.Append($"\n [MCC] {Translations.cmd_entityCmd_leggings}: {entity.Equipment[3].GetTypeString()} x{entity.Equipment[3].Count}"); + if (entity.Equipment.ContainsKey(2) && entity.Equipment[2] != null) + sb.Append($"\n [MCC] {Translations.cmd_entityCmd_boots}: {entity.Equipment[2].GetTypeString()} x{entity.Equipment[2].Count}"); + } + sb.Append($"\n [MCC] {Translations.cmd_entityCmd_pose}: {pose}"); + sb.Append($"\n [MCC] {Translations.cmd_entityCmd_health}: {color}{health}§8"); + sb.Append($"\n [MCC] {Translations.cmd_entityCmd_distance}: {distance}"); + sb.Append($"\n [MCC] {Translations.cmd_entityCmd_location}: {location}"); + } + + public override string Run(McClient handler, string command, Dictionary? localVars) + { + if (handler.GetEntityHandlingEnabled()) + { + string[] args = GetArgs(command); + if (args.Length >= 1) + { + if (Enum.TryParse(args[0], true, out EntityType entity_type)) + { + Dictionary entities = handler.GetEntities(); + Entity? closest = null; + double closest_distance = double.PositiveInfinity; + foreach (var entity in entities) + { + if (entity.Value.Type != entity_type) + continue; + + double distance = Math.Round(entity.Value.Location.Distance(handler.GetCurrentLocation()), 2); + if (distance < closest_distance) + { + closest = entity.Value; + closest_distance = distance; + } + } + + if (closest == null) + return Translations.cmd_entityCmd_not_found; + + string action = args.Length > 1 + ? args[1].ToLower() + : "list"; + + switch (action) + { + case "attack": + handler.InteractEntity(closest.ID, InteractType.Attack); + return Translations.cmd_entityCmd_attacked; + case "use": + handler.InteractEntity(closest.ID, InteractType.Interact); + return Translations.cmd_entityCmd_used; + default: + StringBuilder response = new(); + GetEntityInfoDetailed(response, handler, closest); + return response.ToString(); + } + } else { + return GetCmdDescTranslated(); + } + } + else + { + Dictionary entities = handler.GetEntities(); + Entity? closest = null; + double closest_distance = double.PositiveInfinity; + foreach (var entity in entities) + { + double distance = Math.Round(entity.Value.Location.Distance(handler.GetCurrentLocation()), 2); + if (distance < closest_distance) + { + closest = entity.Value; + closest_distance = distance; + } + } + + if (closest == null) + return Translations.cmd_entityCmd_not_found; + + StringBuilder response = new(); + GetEntityInfoDetailed(response, handler, closest); + return response.ToString(); + } + } + else return Translations.extra_entity_required; + } + } +} From 60bec055a51713ec3292384ac1865d4d1124c18a Mon Sep 17 00:00:00 2001 From: BruceChen Date: Wed, 30 Nov 2022 17:58:29 +0800 Subject: [PATCH 2/2] Migrate to the "entity" command. --- MinecraftClient/Commands/EntityNear.cs | 148 ------------------------- MinecraftClient/Commands/Entitycmd.cs | 120 ++++++++++++++------ 2 files changed, 88 insertions(+), 180 deletions(-) delete mode 100644 MinecraftClient/Commands/EntityNear.cs diff --git a/MinecraftClient/Commands/EntityNear.cs b/MinecraftClient/Commands/EntityNear.cs deleted file mode 100644 index 894f9fda..00000000 --- a/MinecraftClient/Commands/EntityNear.cs +++ /dev/null @@ -1,148 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text; -using MinecraftClient.Inventory; -using MinecraftClient.Mapping; - -namespace MinecraftClient.Commands -{ - class EntityNear : Command - { - public override string CmdName { get { return "entitynear"; } } - public override string CmdUsage { get { return "entitynear "; } } - public override string CmdDesc { get { return string.Empty; } } - - private static void GetEntityInfoDetailed(StringBuilder sb, McClient handler, Entity entity) - { - int id = entity.ID; - float health = entity.Health; - int latency = entity.Latency; - Item item = entity.Item; - string? nickname = entity.Name; - string? customname = entity.CustomName; - EntityPose pose = entity.Pose; - EntityType type = entity.Type; - double distance = Math.Round(entity.Location.Distance(handler.GetCurrentLocation()), 2); - - string color = "§a"; // Green - if (health < 10) - color = "§c"; // Red - else if (health < 15) - color = "§e"; // Yellow - - string location = $"X:{Math.Round(entity.Location.X, 2)}, Y:{Math.Round(entity.Location.Y, 2)}, Z:{Math.Round(entity.Location.Z, 2)}"; - sb.Append($"{Translations.cmd_entityCmd_entity}: {id}\n [MCC] Type: {entity.GetTypeString()}"); - if (!string.IsNullOrEmpty(nickname)) - sb.Append($"\n [MCC] {Translations.cmd_entityCmd_nickname}: {nickname}"); - else if (!string.IsNullOrEmpty(customname)) - sb.Append($"\n [MCC] {Translations.cmd_entityCmd_customname}: {customname.Replace("&", "§")}§8"); - if (type == EntityType.Player) - sb.Append($"\n [MCC] {Translations.cmd_entityCmd_latency}: {latency}"); - else if (type == EntityType.Item || type == EntityType.ItemFrame || type == Mapping.EntityType.EyeOfEnder || type == Mapping.EntityType.Egg || type == Mapping.EntityType.EnderPearl || type == Mapping.EntityType.Potion || type == Mapping.EntityType.Fireball || type == Mapping.EntityType.FireworkRocket) - { - string? displayName = item.DisplayName; - if (string.IsNullOrEmpty(displayName)) - sb.Append($"\n [MCC] {Translations.cmd_entityCmd_item}: {item.GetTypeString()} x{item.Count}"); - else - sb.Append($"\n [MCC] {Translations.cmd_entityCmd_item}: {item.GetTypeString()} x{item.Count} - {displayName}§8"); - } - - if (entity.Equipment.Count >= 1 && entity.Equipment != null) - { - sb.Append($"\n [MCC] {Translations.cmd_entityCmd_equipment}:"); - if (entity.Equipment.ContainsKey(0) && entity.Equipment[0] != null) - sb.Append($"\n [MCC] {Translations.cmd_entityCmd_mainhand}: {entity.Equipment[0].GetTypeString()} x{entity.Equipment[0].Count}"); - if (entity.Equipment.ContainsKey(1) && entity.Equipment[1] != null) - sb.Append($"\n [MCC] {Translations.cmd_entityCmd_offhand}: {entity.Equipment[1].GetTypeString()} x{entity.Equipment[1].Count}"); - if (entity.Equipment.ContainsKey(5) && entity.Equipment[5] != null) - sb.Append($"\n [MCC] {Translations.cmd_entityCmd_helmet}: {entity.Equipment[5].GetTypeString()} x{entity.Equipment[5].Count}"); - if (entity.Equipment.ContainsKey(4) && entity.Equipment[4] != null) - sb.Append($"\n [MCC] {Translations.cmd_entityCmd_chestplate}: {entity.Equipment[4].GetTypeString()} x{entity.Equipment[4].Count}"); - if (entity.Equipment.ContainsKey(3) && entity.Equipment[3] != null) - sb.Append($"\n [MCC] {Translations.cmd_entityCmd_leggings}: {entity.Equipment[3].GetTypeString()} x{entity.Equipment[3].Count}"); - if (entity.Equipment.ContainsKey(2) && entity.Equipment[2] != null) - sb.Append($"\n [MCC] {Translations.cmd_entityCmd_boots}: {entity.Equipment[2].GetTypeString()} x{entity.Equipment[2].Count}"); - } - sb.Append($"\n [MCC] {Translations.cmd_entityCmd_pose}: {pose}"); - sb.Append($"\n [MCC] {Translations.cmd_entityCmd_health}: {color}{health}§8"); - sb.Append($"\n [MCC] {Translations.cmd_entityCmd_distance}: {distance}"); - sb.Append($"\n [MCC] {Translations.cmd_entityCmd_location}: {location}"); - } - - public override string Run(McClient handler, string command, Dictionary? localVars) - { - if (handler.GetEntityHandlingEnabled()) - { - string[] args = GetArgs(command); - if (args.Length >= 1) - { - if (Enum.TryParse(args[0], true, out EntityType entity_type)) - { - Dictionary entities = handler.GetEntities(); - Entity? closest = null; - double closest_distance = double.PositiveInfinity; - foreach (var entity in entities) - { - if (entity.Value.Type != entity_type) - continue; - - double distance = Math.Round(entity.Value.Location.Distance(handler.GetCurrentLocation()), 2); - if (distance < closest_distance) - { - closest = entity.Value; - closest_distance = distance; - } - } - - if (closest == null) - return Translations.cmd_entityCmd_not_found; - - string action = args.Length > 1 - ? args[1].ToLower() - : "list"; - - switch (action) - { - case "attack": - handler.InteractEntity(closest.ID, InteractType.Attack); - return Translations.cmd_entityCmd_attacked; - case "use": - handler.InteractEntity(closest.ID, InteractType.Interact); - return Translations.cmd_entityCmd_used; - default: - StringBuilder response = new(); - GetEntityInfoDetailed(response, handler, closest); - return response.ToString(); - } - } else { - return GetCmdDescTranslated(); - } - } - else - { - Dictionary entities = handler.GetEntities(); - Entity? closest = null; - double closest_distance = double.PositiveInfinity; - foreach (var entity in entities) - { - double distance = Math.Round(entity.Value.Location.Distance(handler.GetCurrentLocation()), 2); - if (distance < closest_distance) - { - closest = entity.Value; - closest_distance = distance; - } - } - - if (closest == null) - return Translations.cmd_entityCmd_not_found; - - StringBuilder response = new(); - GetEntityInfoDetailed(response, handler, closest); - return response.ToString(); - } - } - else return Translations.extra_entity_required; - } - } -} diff --git a/MinecraftClient/Commands/Entitycmd.cs b/MinecraftClient/Commands/Entitycmd.cs index 9d2e0468..2e04cac3 100644 --- a/MinecraftClient/Commands/Entitycmd.cs +++ b/MinecraftClient/Commands/Entitycmd.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Text; using MinecraftClient.Inventory; @@ -10,10 +11,10 @@ namespace MinecraftClient.Commands class Entitycmd : Command { public override string CmdName { get { return "entity"; } } - public override string CmdUsage { get { return "entity "; } } + public override string CmdUsage { get { return "entity [near] "; } } public override string CmdDesc { get { return string.Empty; } } - private static void GetEntityInfoShort(StringBuilder sb, Entity entity) + private static string GetEntityInfoShort(Entity entity) { int id = entity.ID; float health = entity.Health; @@ -26,17 +27,18 @@ namespace MinecraftClient.Commands string location = $"X:{Math.Round(entity.Location.X, 2)}, Y:{Math.Round(entity.Location.Y, 2)}, Z:{Math.Round(entity.Location.Z, 2)}"; if (type == EntityType.Item || type == EntityType.ItemFrame || type == EntityType.EyeOfEnder || type == EntityType.Egg || type == EntityType.EnderPearl || type == EntityType.Potion || type == EntityType.Fireball || type == EntityType.FireworkRocket) - sb.AppendLine($" #{id}: {Translations.cmd_entityCmd_type}: {entity.GetTypeString()}, {Translations.cmd_entityCmd_item}: {item.GetTypeString()}, {Translations.cmd_entityCmd_location}: {location}"); + return $" #{id}: {Translations.cmd_entityCmd_type}: {entity.GetTypeString()}, {Translations.cmd_entityCmd_item}: {item.GetTypeString()}, {Translations.cmd_entityCmd_location}: {location}"; else if (type == EntityType.Player && !string.IsNullOrEmpty(nickname)) - sb.AppendLine($" #{id}: {Translations.cmd_entityCmd_type}: {entity.GetTypeString()}, {Translations.cmd_entityCmd_nickname}: §8{nickname}§8, {Translations.cmd_entityCmd_latency}: {latency}, {Translations.cmd_entityCmd_health}: {health}, {Translations.cmd_entityCmd_pose}: {pose}, {Translations.cmd_entityCmd_location}: {location}"); + return $" #{id}: {Translations.cmd_entityCmd_type}: {entity.GetTypeString()}, {Translations.cmd_entityCmd_nickname}: §8{nickname}§8, {Translations.cmd_entityCmd_latency}: {latency}, {Translations.cmd_entityCmd_health}: {health}, {Translations.cmd_entityCmd_pose}: {pose}, {Translations.cmd_entityCmd_location}: {location}"; else if (type == EntityType.Player && !string.IsNullOrEmpty(customname)) - sb.AppendLine($" #{id}: {Translations.cmd_entityCmd_type}: {entity.GetTypeString()}, {Translations.cmd_entityCmd_customname}: §8{customname.Replace("&", "§")}§8, {Translations.cmd_entityCmd_latency}: {latency}, {Translations.cmd_entityCmd_health}: {health}, {Translations.cmd_entityCmd_pose}: {pose}, {Translations.cmd_entityCmd_location}: {location}"); + return $" #{id}: {Translations.cmd_entityCmd_type}: {entity.GetTypeString()}, {Translations.cmd_entityCmd_customname}: §8{customname.Replace("&", "§")}§8, {Translations.cmd_entityCmd_latency}: {latency}, {Translations.cmd_entityCmd_health}: {health}, {Translations.cmd_entityCmd_pose}: {pose}, {Translations.cmd_entityCmd_location}: {location}"; else - sb.AppendLine($" #{id}: {Translations.cmd_entityCmd_type}: {entity.GetTypeString()}, {Translations.cmd_entityCmd_health}: {health}, {Translations.cmd_entityCmd_location}: {location}"); + return $" #{id}: {Translations.cmd_entityCmd_type}: {entity.GetTypeString()}, {Translations.cmd_entityCmd_health}: {health}, {Translations.cmd_entityCmd_location}: {location}"; } - private static void GetEntityInfoDetailed(StringBuilder sb, McClient handler, Entity entity) + private static string GetEntityInfoDetailed(McClient handler, Entity entity) { + StringBuilder sb = new(); int id = entity.ID; float health = entity.Health; int latency = entity.Latency; @@ -46,6 +48,7 @@ namespace MinecraftClient.Commands EntityPose pose = entity.Pose; EntityType type = entity.Type; double distance = Math.Round(entity.Location.Distance(handler.GetCurrentLocation()), 2); + string location = $"X:{Math.Round(entity.Location.X, 2)}, Y:{Math.Round(entity.Location.Y, 2)}, Z:{Math.Round(entity.Location.Z, 2)}"; string color = "§a"; // Green if (health < 10) @@ -53,14 +56,17 @@ namespace MinecraftClient.Commands else if (health < 15) color = "§e"; // Yellow - string location = $"X:{Math.Round(entity.Location.X, 2)}, Y:{Math.Round(entity.Location.Y, 2)}, Z:{Math.Round(entity.Location.Z, 2)}"; sb.Append($"{Translations.cmd_entityCmd_entity}: {id}\n [MCC] Type: {entity.GetTypeString()}"); + if (!string.IsNullOrEmpty(nickname)) sb.Append($"\n [MCC] {Translations.cmd_entityCmd_nickname}: {nickname}"); else if (!string.IsNullOrEmpty(customname)) sb.Append($"\n [MCC] {Translations.cmd_entityCmd_customname}: {customname.Replace("&", "§")}§8"); + if (type == EntityType.Player) + { sb.Append($"\n [MCC] {Translations.cmd_entityCmd_latency}: {latency}"); + } else if (type == EntityType.Item || type == EntityType.ItemFrame || type == Mapping.EntityType.EyeOfEnder || type == Mapping.EntityType.Egg || type == Mapping.EntityType.EnderPearl || type == Mapping.EntityType.Potion || type == Mapping.EntityType.Fireball || type == Mapping.EntityType.FireworkRocket) { string? displayName = item.DisplayName; @@ -86,10 +92,49 @@ namespace MinecraftClient.Commands if (entity.Equipment.ContainsKey(2) && entity.Equipment[2] != null) sb.Append($"\n [MCC] {Translations.cmd_entityCmd_boots}: {entity.Equipment[2].GetTypeString()} x{entity.Equipment[2].Count}"); } + sb.Append($"\n [MCC] {Translations.cmd_entityCmd_pose}: {pose}"); sb.Append($"\n [MCC] {Translations.cmd_entityCmd_health}: {color}{health}§8"); sb.Append($"\n [MCC] {Translations.cmd_entityCmd_distance}: {distance}"); sb.Append($"\n [MCC] {Translations.cmd_entityCmd_location}: {location}"); + + return sb.ToString(); + } + + private static bool TryGetClosetEntity(Dictionary entities, Location location, EntityType? entityType, [NotNullWhen(true)] out Entity? closest) + { + closest = null; + bool find = false; + double closest_distance = double.PositiveInfinity; + foreach (var entity in entities) + { + if (entityType.HasValue && entity.Value.Type != entityType) + continue; + + double distance = Math.Round(entity.Value.Location.Distance(location), 2); + if (distance < closest_distance) + { + find = true; + closest = entity.Value; + closest_distance = distance; + } + } + return find; + } + + private static string InteractionWithEntity(McClient handler, Entity entity, string action) + { + switch (action) + { + case "attack": + handler.InteractEntity(entity.ID, InteractType.Attack); + return Translations.cmd_entityCmd_attacked; + case "use": + handler.InteractEntity(entity.ID, InteractType.Interact); + return Translations.cmd_entityCmd_used; + default: + return GetEntityInfoDetailed(handler, entity); + } } public override string Run(McClient handler, string command, Dictionary? localVars) @@ -97,31 +142,14 @@ namespace MinecraftClient.Commands if (handler.GetEntityHandlingEnabled()) { string[] args = GetArgs(command); - if (args.Length >= 1) + if (args.Length > 0) { if (int.TryParse(args[0], NumberStyles.Any, CultureInfo.CurrentCulture, out int entityID)) { - if (handler.GetEntities().ContainsKey(entityID)) - { - string action = args.Length > 1 - ? args[1].ToLower() - : "list"; - switch (action) - { - case "attack": - handler.InteractEntity(entityID, InteractType.Attack); - return Translations.cmd_entityCmd_attacked; - case "use": - handler.InteractEntity(entityID, InteractType.Interact); - return Translations.cmd_entityCmd_used; - default: - Entity entity = handler.GetEntities()[entityID]; - StringBuilder done = new(); - GetEntityInfoDetailed(done, handler, entity); - return done.ToString(); - } - } - else return Translations.cmd_entityCmd_not_found; + if (handler.GetEntities().TryGetValue(entityID, out Entity? entity)) + return InteractionWithEntity(handler, entity, args.Length > 1 ? args[1].ToLower() : "list"); + else + return Translations.cmd_entityCmd_not_found; } else if (Enum.TryParse(args[0], true, out EntityType interacttype)) { @@ -160,12 +188,40 @@ namespace MinecraftClient.Commands { if (entity2.Value.Type == interacttype) { - GetEntityInfoShort(response, entity2.Value); + response.AppendLine(GetEntityInfoShort(entity2.Value)); } } response.Append(GetCmdDescTranslated()); return response.ToString(); } + else if (args[0] == "near") + { + if (args.Length > 1) + { + if (Enum.TryParse(args[1], true, out EntityType entityType)) + { + if (TryGetClosetEntity(handler.GetEntities(), handler.GetCurrentLocation(), entityType, out Entity? closest)) + return InteractionWithEntity(handler, closest, args.Length > 2 ? args[2].ToLower() : "list"); + else + return Translations.cmd_entityCmd_not_found; + } + else if (int.TryParse(args[0], NumberStyles.Any, CultureInfo.CurrentCulture, out int entityID2)) + { + if (handler.GetEntities().TryGetValue(entityID2, out Entity? entity)) + return InteractionWithEntity(handler, entity, args.Length > 1 ? args[1].ToLower() : "list"); + else + return Translations.cmd_entityCmd_not_found; + } + else return GetCmdDescTranslated(); + } + else + { + if (TryGetClosetEntity(handler.GetEntities(), handler.GetCurrentLocation(), null, out Entity? closest)) + return GetEntityInfoDetailed(handler, closest); + else + return Translations.cmd_entityCmd_not_found; + } + } else return GetCmdDescTranslated(); } else @@ -175,7 +231,7 @@ namespace MinecraftClient.Commands response.AppendLine(Translations.cmd_entityCmd_entities); foreach (var entity2 in entities) { - GetEntityInfoShort(response, entity2.Value); + response.AppendLine(GetEntityInfoShort(entity2.Value)); } response.Append(GetCmdDescTranslated()); return response.ToString();