mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Merge master into brigadier-dev
This commit is contained in:
commit
f2f88ac009
197 changed files with 102227 additions and 3487 deletions
|
|
@ -12,7 +12,7 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
public override string CmdName { get { return "entity"; } }
|
||||
public override string CmdUsage { get { return "entity <id|entitytype> <attack|use>"; } }
|
||||
public override string CmdDesc { get { return ""; } }
|
||||
public override string CmdDesc { get { return string.Empty; } }
|
||||
|
||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CommandSource> dispatcher)
|
||||
{
|
||||
|
|
@ -39,10 +39,10 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
case "attack":
|
||||
handler.InteractEntity(entityID, InteractType.Attack);
|
||||
return Translations.Get("cmd.entityCmd.attacked");
|
||||
return Translations.cmd_entityCmd_attacked;
|
||||
case "use":
|
||||
handler.InteractEntity(entityID, InteractType.Interact);
|
||||
return Translations.Get("cmd.entityCmd.used");
|
||||
return Translations.cmd_entityCmd_used;
|
||||
default:
|
||||
Entity entity = handler.GetEntities()[entityID];
|
||||
int id = entity.ID;
|
||||
|
|
@ -61,53 +61,53 @@ namespace MinecraftClient.Commands
|
|||
else if (health < 15)
|
||||
color = "§e"; // Yellow
|
||||
|
||||
string location = String.Format("X:{0}, Y:{1}, Z:{2}", Math.Round(entity.Location.X, 2), Math.Round(entity.Location.Y, 2), Math.Round(entity.Location.Z, 2));
|
||||
string location = $"X:{Math.Round(entity.Location.X, 2)}, Y:{Math.Round(entity.Location.Y, 2)}, Z:{Math.Round(entity.Location.Z, 2)}";
|
||||
StringBuilder done = new();
|
||||
done.Append(Translations.Replace("([cmd.entityCmd.entity]): {0}\n [MCC] Type: {1}", id, entity.GetTypeString()));
|
||||
if (!String.IsNullOrEmpty(nickname))
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.nickname]): {0}", nickname));
|
||||
else if (!String.IsNullOrEmpty(customname))
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.customname]): {0}§8", customname.Replace("&", "§")));
|
||||
done.Append($"{Translations.cmd_entityCmd_entity}: {id}\n [MCC] Type: {entity.GetTypeString()}");
|
||||
if (!string.IsNullOrEmpty(nickname))
|
||||
done.Append($"\n [MCC] {Translations.cmd_entityCmd_nickname}: {nickname}");
|
||||
else if (!string.IsNullOrEmpty(customname))
|
||||
done.Append($"\n [MCC] {Translations.cmd_entityCmd_customname}: {customname.Replace("&", "§")}§8");
|
||||
if (type == EntityType.Player)
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.latency]): {0}", latency));
|
||||
done.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))
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.item]): {0} x{1}", item.GetTypeString(), item.Count));
|
||||
if (string.IsNullOrEmpty(displayName))
|
||||
done.Append($"\n [MCC] {Translations.cmd_entityCmd_item}: {item.GetTypeString()} x{item.Count}");
|
||||
else
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.item]): {0} x{1} - {2}§8", item.GetTypeString(), item.Count, displayName));
|
||||
done.Append($"\n [MCC] {Translations.cmd_entityCmd_item}: {item.GetTypeString()} x{item.Count} - {displayName}§8");
|
||||
}
|
||||
|
||||
if (entity.Equipment.Count >= 1 && entity.Equipment != null)
|
||||
{
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.equipment]):"));
|
||||
done.Append($"\n [MCC] {Translations.cmd_entityCmd_equipment}:");
|
||||
if (entity.Equipment.ContainsKey(0) && entity.Equipment[0] != null)
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.mainhand]): {0} x{1}", entity.Equipment[0].GetTypeString(), entity.Equipment[0].Count));
|
||||
done.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)
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.offhand]): {0} x{1}", entity.Equipment[1].GetTypeString(), entity.Equipment[1].Count));
|
||||
done.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)
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.helmet]): {0} x{1}", entity.Equipment[5].GetTypeString(), entity.Equipment[5].Count));
|
||||
done.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)
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.chestplate]): {0} x{1}", entity.Equipment[4].GetTypeString(), entity.Equipment[4].Count));
|
||||
done.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)
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.leggings]): {0} x{1}", entity.Equipment[3].GetTypeString(), entity.Equipment[3].Count));
|
||||
done.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)
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.boots]): {0} x{1}", entity.Equipment[2].GetTypeString(), entity.Equipment[2].Count));
|
||||
done.Append($"\n [MCC] {Translations.cmd_entityCmd_boots}: {entity.Equipment[2].GetTypeString()} x{entity.Equipment[2].Count}");
|
||||
}
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.pose]): {0}", pose));
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.health]): {0}", color + health + "§8"));
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.distance]): {0}", distance));
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.location]): {0}", location));
|
||||
done.Append($"\n [MCC] {Translations.cmd_entityCmd_pose}: {pose}");
|
||||
done.Append($"\n [MCC] {Translations.cmd_entityCmd_health}: {color}{health}§8");
|
||||
done.Append($"\n [MCC] {Translations.cmd_entityCmd_distance}: {distance}");
|
||||
done.Append($"\n [MCC] {Translations.cmd_entityCmd_location}: {location}");
|
||||
return done.ToString();
|
||||
}
|
||||
}
|
||||
else return Translations.Get("cmd.entityCmd.not_found");
|
||||
else return Translations.cmd_entityCmd_not_found;
|
||||
}
|
||||
else
|
||||
{
|
||||
EntityType interacttype = Enum.Parse<EntityType>(args[0]);
|
||||
string actionst = "cmd.entityCmd.attacked";
|
||||
string actionst = Translations.cmd_entityCmd_attacked;
|
||||
int actioncount = 0;
|
||||
foreach (var entity2 in handler.GetEntities())
|
||||
{
|
||||
|
|
@ -119,19 +119,19 @@ namespace MinecraftClient.Commands
|
|||
if (action == "attack")
|
||||
{
|
||||
handler.InteractEntity(entity2.Key, InteractType.Attack);
|
||||
actionst = "cmd.entityCmd.attacked";
|
||||
actionst = Translations.cmd_entityCmd_attacked;
|
||||
actioncount++;
|
||||
}
|
||||
else if (action == "use")
|
||||
{
|
||||
handler.InteractEntity(entity2.Key, InteractType.Interact);
|
||||
actionst = "cmd.entityCmd.used";
|
||||
actionst = Translations.cmd_entityCmd_used;
|
||||
actioncount++;
|
||||
}
|
||||
else return GetCmdDescTranslated();
|
||||
}
|
||||
}
|
||||
return actioncount + " " + Translations.Get(actionst);
|
||||
return actioncount + " " + actionst;
|
||||
}
|
||||
}
|
||||
catch (FormatException) { return GetCmdDescTranslated(); }
|
||||
|
|
@ -140,7 +140,7 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
Dictionary<int, Entity> entities = handler.GetEntities();
|
||||
StringBuilder response = new();
|
||||
response.AppendLine(Translations.Get("cmd.entityCmd.entities"));
|
||||
response.AppendLine(Translations.cmd_entityCmd_entities);
|
||||
foreach (var entity2 in entities)
|
||||
{
|
||||
int id = entity2.Key;
|
||||
|
|
@ -151,22 +151,22 @@ namespace MinecraftClient.Commands
|
|||
EntityPose pose = entity2.Value.Pose;
|
||||
EntityType type = entity2.Value.Type;
|
||||
Item item = entity2.Value.Item;
|
||||
string location = String.Format("X:{0}, Y:{1}, Z:{2}", Math.Round(entity2.Value.Location.X, 2), Math.Round(entity2.Value.Location.Y, 2), Math.Round(entity2.Value.Location.Z, 2));
|
||||
string location = $"X:{Math.Round(entity2.Value.Location.X, 2)}, Y:{Math.Round(entity2.Value.Location.Y, 2)}, Z:{Math.Round(entity2.Value.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)
|
||||
response.AppendLine(Translations.Replace(" #{0}: ([cmd.entityCmd.type]): {1}, ([cmd.entityCmd.item]): {2}, ([cmd.entityCmd.location]): {3}", id, entity2.Value.GetTypeString(), item.GetTypeString(), location));
|
||||
else if (type == EntityType.Player && !String.IsNullOrEmpty(nickname))
|
||||
response.AppendLine(Translations.Replace(" #{0}: ([cmd.entityCmd.type]): {1}, ([cmd.entityCmd.nickname]): §8{2}§8, ([cmd.entityCmd.latency]): {3}, ([cmd.entityCmd.health]): {4}, ([cmd.entityCmd.pose]): {5}, ([cmd.entityCmd.location]): {6}", id, entity2.Value.GetTypeString(), nickname, latency, health, pose, location));
|
||||
else if (type == EntityType.Player && !String.IsNullOrEmpty(customname))
|
||||
response.AppendLine(Translations.Replace(" #{0}: ([cmd.entityCmd.type]): {1}, ([cmd.entityCmd.customname]): §8{2}§8, ([cmd.entityCmd.latency]): {3}, ([cmd.entityCmd.health]): {4}, ([cmd.entityCmd.pose]): {5}, ([cmd.entityCmd.location]): {6}", id, entity2.Value.GetTypeString(), customname.Replace("&", "§"), latency, health, pose, location));
|
||||
response.AppendLine($" #{id}: {Translations.cmd_entityCmd_type}: {entity2.Value.GetTypeString()}, {Translations.cmd_entityCmd_item}: {item.GetTypeString()}, {Translations.cmd_entityCmd_location}: {location}");
|
||||
else if (type == EntityType.Player && !string.IsNullOrEmpty(nickname))
|
||||
response.AppendLine($" #{id}: {Translations.cmd_entityCmd_type}: {entity2.Value.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))
|
||||
response.AppendLine($" #{id}: {Translations.cmd_entityCmd_type}: {entity2.Value.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
|
||||
response.AppendLine(Translations.Replace(" #{0}: ([cmd.entityCmd.type]): {1}, ([cmd.entityCmd.health]): {2}, ([cmd.entityCmd.location]): {3}", id, entity2.Value.GetTypeString(), health, location));
|
||||
response.AppendLine($" #{id}: {Translations.cmd_entityCmd_type}: {entity2.Value.GetTypeString()}, {Translations.cmd_entityCmd_health}: {health}, {Translations.cmd_entityCmd_location}: {location}");
|
||||
}
|
||||
response.Append(GetCmdDescTranslated());
|
||||
return response.ToString();
|
||||
}
|
||||
}
|
||||
else return Translations.Get("extra.entity_required");
|
||||
else return Translations.extra_entity_required;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue