mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Better translation
This commit is contained in:
parent
bce2bc8b7f
commit
117a38b5f9
21 changed files with 95 additions and 156 deletions
|
|
@ -10,7 +10,7 @@ namespace MinecraftClient.Commands
|
|||
public override string CmdUsage { get { return "blockinfo <x> <y> <z> [-s]"; } }
|
||||
public override string CmdDesc { get { return "cmd.blockinfo.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object>? localVars)
|
||||
{
|
||||
string[] args = GetArgs(command);
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ namespace MinecraftClient.Commands
|
|||
|
||||
Block block = handler.GetWorld().GetBlock(targetBlockLocation);
|
||||
|
||||
handler.Log.Info(Translations.TryGet("cmd.blockinfo.BlockType") + ": " + block.Type);
|
||||
handler.Log.Info(Translations.TryGet("cmd.blockinfo.BlockType") + ": " + block.GetTypeString());
|
||||
|
||||
if (reportSurrounding)
|
||||
{
|
||||
|
|
@ -38,14 +38,14 @@ namespace MinecraftClient.Commands
|
|||
Block blockZPositive = handler.GetWorld().GetBlock(new Location(targetBlockLocation.X, targetBlockLocation.Y, targetBlockLocation.Z + 1));
|
||||
Block blockZNegative = handler.GetWorld().GetBlock(new Location(targetBlockLocation.X, targetBlockLocation.Y, targetBlockLocation.Z - 1));
|
||||
|
||||
sb.AppendLine("[X " + Translations.TryGet("cmd.blockinfo.Positive") + "] " + Translations.TryGet("cmd.blockinfo.BlockType") + ": " + blockXPositive.Type);
|
||||
sb.AppendLine("[X " + Translations.TryGet("cmd.blockinfo.Negative") + "] " + Translations.TryGet("cmd.blockinfo.BlockType") + ": " + blockXNegative.Type);
|
||||
sb.AppendLine("[X " + Translations.TryGet("cmd.blockinfo.Positive") + "] " + Translations.TryGet("cmd.blockinfo.BlockType") + ": " + blockXPositive.GetTypeString());
|
||||
sb.AppendLine("[X " + Translations.TryGet("cmd.blockinfo.Negative") + "] " + Translations.TryGet("cmd.blockinfo.BlockType") + ": " + blockXNegative.GetTypeString());
|
||||
sb.AppendLine(" ");
|
||||
sb.AppendLine("[Y " + Translations.TryGet("cmd.blockinfo.Positive") + "] " + Translations.TryGet("cmd.blockinfo.BlockType") + ": " + blockYPositive.Type);
|
||||
sb.AppendLine("[Y " + Translations.TryGet("cmd.blockinfo.Negative") + "] " + Translations.TryGet("cmd.blockinfo.BlockType") + ": " + blockYNegative.Type);
|
||||
sb.AppendLine("[Y " + Translations.TryGet("cmd.blockinfo.Positive") + "] " + Translations.TryGet("cmd.blockinfo.BlockType") + ": " + blockYPositive.GetTypeString());
|
||||
sb.AppendLine("[Y " + Translations.TryGet("cmd.blockinfo.Negative") + "] " + Translations.TryGet("cmd.blockinfo.BlockType") + ": " + blockYNegative.GetTypeString());
|
||||
sb.AppendLine(" ");
|
||||
sb.AppendLine("[Z " + Translations.TryGet("cmd.blockinfo.Positive") + "] " + Translations.TryGet("cmd.blockinfo.BlockType") + ": " + blockZPositive.Type);
|
||||
sb.AppendLine("[Z " + Translations.TryGet("cmd.blockinfo.Negative") + "] " + Translations.TryGet("cmd.blockinfo.BlockType") + ": " + blockZNegative.Type);
|
||||
sb.AppendLine("[Z " + Translations.TryGet("cmd.blockinfo.Positive") + "] " + Translations.TryGet("cmd.blockinfo.BlockType") + ": " + blockZPositive.GetTypeString());
|
||||
sb.AppendLine("[Z " + Translations.TryGet("cmd.blockinfo.Negative") + "] " + Translations.TryGet("cmd.blockinfo.BlockType") + ": " + blockZNegative.GetTypeString());
|
||||
|
||||
handler.Log.Info(sb.ToString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace MinecraftClient.Commands
|
|||
else if (block.Type == Material.Air)
|
||||
return Translations.Get("cmd.dig.no_block");
|
||||
else if (handler.DigBlock(blockLoc, lookAtBlock: false))
|
||||
return Translations.Get("cmd.dig.dig", blockLoc.X, blockLoc.Y, blockLoc.Z, block.Type);
|
||||
return Translations.Get("cmd.dig.dig", blockLoc.X, blockLoc.Y, blockLoc.Z, block.GetTypeString());
|
||||
else
|
||||
return Translations.Get("cmd.dig.fail");
|
||||
}
|
||||
|
|
@ -42,7 +42,7 @@ namespace MinecraftClient.Commands
|
|||
else if (handler.DigBlock(blockToBreak))
|
||||
{
|
||||
blockToBreak = blockToBreak.ToCenter();
|
||||
return Translations.Get("cmd.dig.dig", blockToBreak.X, blockToBreak.Y, blockToBreak.Z, block.Type);
|
||||
return Translations.Get("cmd.dig.dig", blockToBreak.X, blockToBreak.Y, blockToBreak.Z, block.GetTypeString());
|
||||
}
|
||||
else
|
||||
return Translations.Get("cmd.dig.fail");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using MinecraftClient.Inventory;
|
||||
using MinecraftClient.Mapping;
|
||||
|
||||
|
|
@ -56,43 +57,44 @@ namespace MinecraftClient.Commands
|
|||
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 done = Translations.Replace("([cmd.entityCmd.entity]): {0}\n [MCC] Type: {1}", id, type);
|
||||
StringBuilder done = new();
|
||||
done.Append(Translations.Replace("([cmd.entityCmd.entity]): {0}\n [MCC] Type: {1}", id, entity.GetTypeString()));
|
||||
if (!String.IsNullOrEmpty(nickname))
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.nickname]): {0}", nickname);
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.nickname]): {0}", nickname));
|
||||
else if (!String.IsNullOrEmpty(customname))
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.customname]): {0}§8", customname.Replace("&", "§"));
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.customname]): {0}§8", customname.Replace("&", "§")));
|
||||
if (type == EntityType.Player)
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.latency]): {0}", latency);
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.latency]): {0}", 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 += Translations.Replace("\n [MCC] ([cmd.entityCmd.item]): {0} x{1}", item.Type, item.Count);
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.item]): {0} x{1}", item.GetTypeString(), item.Count));
|
||||
else
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.item]): {0} x{1} - {2}§8", item.Type, item.Count, displayName);
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.item]): {0} x{1} - {2}§8", item.GetTypeString(), item.Count, displayName));
|
||||
}
|
||||
|
||||
if (entity.Equipment.Count >= 1 && entity.Equipment != null)
|
||||
{
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.equipment]):");
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.equipment]):"));
|
||||
if (entity.Equipment.ContainsKey(0) && entity.Equipment[0] != null)
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.mainhand]): {0} x{1}", entity.Equipment[0].Type, entity.Equipment[0].Count);
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.mainhand]): {0} x{1}", entity.Equipment[0].GetTypeString(), entity.Equipment[0].Count));
|
||||
if (entity.Equipment.ContainsKey(1) && entity.Equipment[1] != null)
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.offhand]): {0} x{1}", entity.Equipment[1].Type, entity.Equipment[1].Count);
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.offhand]): {0} x{1}", entity.Equipment[1].GetTypeString(), entity.Equipment[1].Count));
|
||||
if (entity.Equipment.ContainsKey(5) && entity.Equipment[5] != null)
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.helmet]): {0} x{1}", entity.Equipment[5].Type, entity.Equipment[5].Count);
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.helmet]): {0} x{1}", entity.Equipment[5].GetTypeString(), entity.Equipment[5].Count));
|
||||
if (entity.Equipment.ContainsKey(4) && entity.Equipment[4] != null)
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.chestplate]): {0} x{1}", entity.Equipment[4].Type, entity.Equipment[4].Count);
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.chestplate]): {0} x{1}", entity.Equipment[4].GetTypeString(), entity.Equipment[4].Count));
|
||||
if (entity.Equipment.ContainsKey(3) && entity.Equipment[3] != null)
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.leggings]): {0} x{1}", entity.Equipment[3].Type, entity.Equipment[3].Count);
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.leggings]): {0} x{1}", entity.Equipment[3].GetTypeString(), entity.Equipment[3].Count));
|
||||
if (entity.Equipment.ContainsKey(2) && entity.Equipment[2] != null)
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.boots]): {0} x{1}", entity.Equipment[2].Type, entity.Equipment[2].Count);
|
||||
done.Append(Translations.Replace("\n [MCC] ([cmd.entityCmd.boots]): {0} x{1}", entity.Equipment[2].GetTypeString(), entity.Equipment[2].Count));
|
||||
}
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.pose]): {0}", pose);
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.health]): {0}", color + health + "§8");
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.distance]): {0}", distance);
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.location]): {0}", location);
|
||||
return done;
|
||||
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));
|
||||
return done.ToString();
|
||||
}
|
||||
}
|
||||
else return Translations.Get("cmd.entityCmd.not_found");
|
||||
|
|
@ -132,10 +134,8 @@ namespace MinecraftClient.Commands
|
|||
else
|
||||
{
|
||||
Dictionary<int, Entity> entities = handler.GetEntities();
|
||||
List<string> response = new()
|
||||
{
|
||||
Translations.Get("cmd.entityCmd.entities")
|
||||
};
|
||||
StringBuilder response = new();
|
||||
response.AppendLine(Translations.Get("cmd.entityCmd.entities"));
|
||||
foreach (var entity2 in entities)
|
||||
{
|
||||
int id = entity2.Key;
|
||||
|
|
@ -149,16 +149,16 @@ namespace MinecraftClient.Commands
|
|||
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));
|
||||
|
||||
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.Add(Translations.Replace(" #{0}: ([cmd.entityCmd.type]): {1}, ([cmd.entityCmd.item]): {2}, ([cmd.entityCmd.location]): {3}", id, type, item.Type, location));
|
||||
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.Add(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, type, nickname, latency, health, pose, location));
|
||||
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.Add(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, type, customname.Replace("&", "§"), latency, health, pose, location));
|
||||
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));
|
||||
else
|
||||
response.Add(Translations.Replace(" #{0}: ([cmd.entityCmd.type]): {1}, ([cmd.entityCmd.health]): {2}, ([cmd.entityCmd.location]): {3}", id, type, health, location));
|
||||
response.AppendLine(Translations.Replace(" #{0}: ([cmd.entityCmd.type]): {1}, ([cmd.entityCmd.health]): {2}, ([cmd.entityCmd.location]): {3}", id, entity2.Value.GetTypeString(), health, location));
|
||||
}
|
||||
response.Add(GetCmdDescTranslated());
|
||||
return String.Join("\n", response);
|
||||
response.Append(GetCmdDescTranslated());
|
||||
return response.ToString();
|
||||
}
|
||||
}
|
||||
else return Translations.Get("extra.entity_required");
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ namespace MinecraftClient.Commands
|
|||
response.AppendLine(String.Format("{0} (#{1}):", inventories[invId].Title, invId));
|
||||
|
||||
foreach (Item item in itemsList)
|
||||
response.AppendLine(String.Format("\t- {0}", item.ToString()));
|
||||
response.AppendLine(String.Format("\t- {0}", item.ToFullString()));
|
||||
|
||||
response.AppendLine(" ");
|
||||
}
|
||||
|
|
@ -195,7 +195,7 @@ namespace MinecraftClient.Commands
|
|||
string hotbarString = isHotbar ? (hotbar + 1).ToString() : " ";
|
||||
if ((hotbar + 1) == selectedHotbar)
|
||||
hotbarString = ">" + hotbarString;
|
||||
response.AppendLine(String.Format("{0,2} | #{1,-2}: {2}", hotbarString, itemId, item.ToString()));
|
||||
response.AppendLine(String.Format("{0,2} | #{1,-2}: {2}", hotbarString, itemId, item.ToFullString()));
|
||||
}
|
||||
|
||||
if (inventoryId == 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue