Update Map Bot

This commit is contained in:
BruceChen 2022-10-14 10:38:28 +08:00 committed by GitHub
commit d30bda4777
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 1902 additions and 1449 deletions

@ -1 +1 @@
Subproject commit 225b10ec96af5c8f179a008cc442b502d23bc601
Subproject commit 42074c449b8cf32e035f982bd83af6dcf75bc764

View file

@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Runtime.Versioning;
using System.Text;
using MinecraftClient.Mapping;
using MinecraftClient.Protocol.Handlers;
using Tomlet.Attributes;
namespace MinecraftClient.ChatBots
@ -22,11 +20,11 @@ namespace MinecraftClient.ChatBots
public bool Enabled = false;
[TomlInlineComment("$config.ChatBot.Map.Should_Resize$")]
public bool Should_Resize = false;
[TomlInlineComment("$config.ChatBot.Map.Render_In_Console$")]
public bool Render_In_Console = true;
[TomlInlineComment("$config.ChatBot.Map.Resize_To$")]
public int Resize_To = 256;
[TomlInlineComment("$config.ChatBot.Map.Save_To_File$")]
public bool Save_To_File = false;
[TomlInlineComment("$config.ChatBot.Map.Auto_Render_On_Update$")]
public bool Auto_Render_On_Update = false;
@ -37,11 +35,7 @@ namespace MinecraftClient.ChatBots
[TomlInlineComment("$config.ChatBot.Map.Notify_On_First_Update$")]
public bool Notify_On_First_Update = true;
public void OnSettingUpdate()
{
if (Resize_To < 128)
Resize_To = 128;
}
public void OnSettingUpdate() { }
}
private readonly string baseDirectory = @"Rendered_Maps";
@ -95,12 +89,16 @@ namespace MinecraftClient.ChatBots
if (!cachedMaps.ContainsKey(mapId))
return Translations.TryGet("bot.map.cmd.not_found", mapId);
if (OperatingSystem.IsWindows())
{
try
{
McMap map = cachedMaps[mapId];
GenerateMapImage(map);
if (Config.Save_To_File)
SaveToFile(map);
if (Config.Render_In_Console)
RenderInConsole(map);
return "";
}
catch (Exception e)
{
@ -108,18 +106,9 @@ namespace MinecraftClient.ChatBots
return Translations.TryGet("bot.map.failed_to_render", mapId);
}
}
else
{
LogToConsoleTranslated("bot.map.windows_only");
}
return "";
}
return Translations.TryGet("bot.map.cmd.invalid_id");
}
}
return "";
}
@ -138,8 +127,8 @@ namespace MinecraftClient.ChatBots
TrackingPosition = trackingPosition,
Locked = locked,
MapIcons = icons,
Width = rowsUpdated,
Height = columnsUpdated,
Width = columnsUpdated,
Height = rowsUpdated,
X = mapCoulmnX,
Z = mapRowZ,
Colors = colors,
@ -155,64 +144,132 @@ namespace MinecraftClient.ChatBots
}
else
{
cachedMaps.Remove(mapid);
cachedMaps.Add(mapid, map);
McMap old_map = cachedMaps[mapid];
lock (old_map)
{
for (int x = 0; x < map.Width; ++x)
for (int y = 0; y < map.Height; ++y)
old_map.Colors![(map.X + x) + (map.Z + y) * old_map.Width] = map.Colors![x + y * map.Width];
}
map = old_map;
}
if (Config.Auto_Render_On_Update)
{
if (OperatingSystem.IsWindows())
GenerateMapImage(map);
else
LogToConsoleTranslated("bot.map.windows_only");
if (Config.Save_To_File)
SaveToFile(map);
if (Config.Render_In_Console)
RenderInConsole(map);
}
}
[SupportedOSPlatform("windows")]
private void GenerateMapImage(McMap map)
private void SaveToFile(McMap map)
{
string fileName = baseDirectory + "/Map_" + map.MapId + ".jpg";
string fileName = baseDirectory + Path.DirectorySeparatorChar + "Map_" + map.MapId.ToString().PadLeft(5, '0') + ".bmp";
if (File.Exists(fileName))
File.Delete(fileName);
/** Warning CA1416: Bitmap is only support Windows **/
/* https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only */
Bitmap image = new(map.Width, map.Height);
using FileStream file = File.OpenWrite(fileName);
file.Write(BitConverter.GetBytes((ushort)0x4d42)); // WORD File Header bfType: "BM"
file.Write(BitConverter.GetBytes((uint)(14 + 40 + 3 * map.Width * map.Height))); // DWORD File Header bfSize
file.Write(BitConverter.GetBytes((ushort)0)); // WORD File Header bfReserved1
file.Write(BitConverter.GetBytes((ushort)0)); // WORD File Header bfReserved2
file.Write(BitConverter.GetBytes((uint)54)); // DWORD File Header bfOffBits
file.Write(BitConverter.GetBytes((uint)40)); // DWORD Info Header biSize
file.Write(BitConverter.GetBytes((uint)map.Width)); // LONG Info Header biWidth
file.Write(BitConverter.GetBytes((uint)map.Height)); // LONG Info Header biHeight
file.Write(BitConverter.GetBytes((ushort)1)); // WORD Info Header biPlanes
file.Write(BitConverter.GetBytes((ushort)24)); // WORD Info Header biBitCount
file.Write(BitConverter.GetBytes((uint)0x00)); // DWORD Info Header biCompression: BI_RGB
file.Write(BitConverter.GetBytes((uint)0)); // DWORD Info Header biSizeImage
file.Write(BitConverter.GetBytes((uint)0)); // LONG Info Header biXPelsPerMeter
file.Write(BitConverter.GetBytes((uint)0)); // LONG Info Header biYPelsPerMeter
file.Write(BitConverter.GetBytes((uint)0)); // DWORD Info Header biClrUsed
file.Write(BitConverter.GetBytes((uint)0)); // DWORD Info Header biClrImportant
Span<byte> pixel = stackalloc byte[3];
for (int y = map.Height - 1; y >= 0; --y)
{
for (int x = 0; x < map.Width; ++x)
{
for (int y = 0; y < map.Height; ++y)
{
byte inputColor = map.Colors![x + y * map.Width];
ColorRGBA color = MapColors.ColorByteToRGBA(inputColor);
if (color.Unknown)
{
string hexCode = new DataTypes(GetProtocolVersion()).ByteArrayToString(new byte[] { inputColor });
LogDebugToConsole("Unknown color encountered: " + inputColor + " (Hex: " + hexCode + "), using: RGB(248, 0, 248)");
}
image.SetPixel(x, y, Color.FromArgb(color.A, color.R, color.G, color.B));
ColorRGBA color = MapColors.ColorByteToRGBA(map.Colors![x + y * map.Width]);
pixel[0] = color.B; pixel[1] = color.G; pixel[2] = color.R;
file.Write(pixel);
}
}
// Resize, double the image
if (Config.Should_Resize)
image = ResizeBitmap(image, Config.Resize_To, Config.Resize_To);
image.Save(fileName);
file.Close();
LogToConsole(Translations.TryGet("bot.map.rendered", map.MapId, fileName));
}
[SupportedOSPlatform("windows")]
private Bitmap ResizeBitmap(Bitmap sourceBMP, int width, int height)
private void RenderInConsole(McMap map)
{
Bitmap result = new(width, height);
using (Graphics g = Graphics.FromImage(result))
g.DrawImage(sourceBMP, 0, 0, width, height);
return result;
StringBuilder sb = new();
int consoleWidth = Math.Max(Console.BufferWidth, Settings.Config.Main.Advanced.MinTerminalWidth) / 2;
int consoleHeight = Math.Max(Console.BufferHeight, Settings.Config.Main.Advanced.MinTerminalHeight) - 1;
int scaleX = (map.Width + consoleWidth - 1) / consoleWidth;
int scaleY = (map.Height + consoleHeight - 1) / consoleHeight;
int scale = Math.Max(scaleX, scaleY);
if (scale > 1)
sb.AppendLine(Translations.Get("bot.map.scale", map.Width, map.Height, map.Width / scale, map.Height / scale));
for (int base_y = 0; base_y < map.Height; base_y += scale)
{
int last_R = -1, last_G = -1, last_B = -1;
for (int base_x = 0; base_x < map.Width; base_x += scale)
{
int RL = 0, GL = 0, BL = 0, RR = 0, GR = 0, BR = 0;
double mid_dx = (double)(scale - 1) / 2;
for (int dy = 0; dy < scale; ++dy)
{
for (int dx = 0; dx < scale; ++dx)
{
int x = Math.Min(base_x + dx, map.Width - 1);
int y = Math.Min(base_y + dy, map.Height - 1);
ColorRGBA color = MapColors.ColorByteToRGBA(map.Colors![x + y * map.Width]);
if (dx <= mid_dx)
{
RL += color.R; GL += color.G; BL += color.B;
}
if (dx >= mid_dx)
{
RR += color.R; GR += color.G; BR += color.B;
}
}
}
int pixel_cnt = ((scale + 1) / 2) * scale;
RL = (int)Math.Round((double)RL / pixel_cnt);
GL = (int)Math.Round((double)GL / pixel_cnt);
BL = (int)Math.Round((double)BL / pixel_cnt);
RR = (int)Math.Round((double)RR / pixel_cnt);
GR = (int)Math.Round((double)GR / pixel_cnt);
BR = (int)Math.Round((double)BR / pixel_cnt);
if (RL == last_R && GL == last_G && BL == last_B)
sb.Append(' ');
else
{
sb.Append(ColorHelper.GetColorEscapeCode((byte)RL, (byte)GL, (byte)BL, false)).Append(' ');
last_R = RL; last_G = GL; last_B = BL;
}
if (RR == last_R && GR == last_G && BR == last_B)
sb.Append(' ');
else
{
sb.Append(ColorHelper.GetColorEscapeCode((byte)RR, (byte)GR, (byte)BR, false)).Append(' ');
last_R = RR; last_G = GR; last_B = BR;
}
}
if (base_y >= map.Height - scale)
sb.Append(ColorHelper.GetResetEscapeCode());
else
sb.AppendLine(ColorHelper.GetResetEscapeCode());
}
ConsoleIO.WriteLine(sb.ToString());
}
}
@ -231,15 +288,6 @@ namespace MinecraftClient.ChatBots
public DateTime LastUpdated { get; set; }
}
class ColorRGBA
{
public byte R { get; set; }
public byte G { get; set; }
public byte B { get; set; }
public byte A { get; set; }
public bool Unknown { get; set; } = false;
}
class MapColors
{
// When colors are updated in a new update, you can get them using the game code: net\minecraft\world\level\material\MaterialColor.java
@ -318,7 +366,7 @@ namespace MinecraftClient.ChatBots
// Any new colors that we haven't added will be purple like in the missing CS: Source Texture
if (!Colors.ContainsKey(baseColorId))
return new ColorRGBA { R = 248, G = 0, B = 248, A = 255, Unknown = true };
return new(248, 0, 248, 255, true);
byte shadeId = (byte)(receivedColorId % 4);
byte shadeMultiplier = 255;
@ -339,13 +387,12 @@ namespace MinecraftClient.ChatBots
break;
}
return new ColorRGBA
{
R = (byte)((Colors[baseColorId][0] * shadeMultiplier) / 255),
G = (byte)((Colors[baseColorId][1] * shadeMultiplier) / 255),
B = (byte)((Colors[baseColorId][2] * shadeMultiplier) / 255),
A = 255
};
return new(
r: (byte)((Colors[baseColorId][0] * shadeMultiplier) / 255),
g: (byte)((Colors[baseColorId][1] * shadeMultiplier) / 255),
b: (byte)((Colors[baseColorId][2] * shadeMultiplier) / 255),
a: 255
);
}
}
}

View file

@ -0,0 +1,184 @@
using System;
using static MinecraftClient.Settings.MainConfigHealper.MainConfig.AdvancedConfig;
namespace MinecraftClient
{
public static class ColorHelper
{
// ANSI escape code - Colors: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
private static readonly Tuple<ColorRGBA, int>[] ColorMap4 = new Tuple<ColorRGBA, int>[]
{
new(new(0, 0, 0), 40),
new(new(128, 0, 0), 41),
new(new(0, 128, 0), 42),
new(new(151, 109, 77), 43),
new(new(45, 45, 180), 44),
new(new(128, 0, 128), 45),
new(new(138, 138, 220), 46),
new(new(174, 164, 115), 47),
new(new(96, 96, 96), 100),
new(new(255, 0, 0), 101),
new(new(127, 178, 56), 102),
new(new(213, 201, 140), 103),
new(new(64, 64, 255), 104),
new(new(255, 0, 255), 105),
new(new(0, 255, 255), 106),
new(new(255, 255, 255), 107),
};
private static readonly Tuple<ColorRGBA, int>[] ColorMap8 = new Tuple<ColorRGBA, int>[]
{
new(new(0, 0, 0), 0),
new(new(128, 0, 0), 1),
new(new(0, 128, 0), 2),
new(new(128, 128, 0), 3),
new(new(0, 0, 128), 4),
new(new(128, 0, 128), 5),
new(new(0, 128, 128), 6),
new(new(192, 192, 192), 7),
new(new(128, 128, 128), 8),
new(new(255, 0, 0), 9),
new(new(0, 255, 0), 10),
new(new(255, 255, 0), 11),
new(new(0, 0, 255), 12),
new(new(255, 0, 255), 13),
new(new(0, 255, 255), 14),
new(new(255, 255, 255), 15),
new(new(8, 8, 8), 232),
new(new(18, 18, 18), 233),
new(new(28, 28, 28), 234),
new(new(38, 38, 38), 235),
new(new(48, 48, 48), 236),
new(new(58, 58, 58), 237),
new(new(68, 68, 68), 238),
new(new(78, 78, 78), 239),
new(new(88, 88, 88), 240),
new(new(98, 98, 98), 241),
new(new(108, 108, 108), 242),
new(new(118, 118, 118), 243),
new(new(128, 128, 128), 244),
new(new(138, 138, 138), 245),
new(new(148, 148, 148), 246),
new(new(158, 158, 158), 247),
new(new(168, 168, 168), 248),
new(new(178, 178, 178), 249),
new(new(188, 188, 188), 250),
new(new(198, 198, 198), 251),
new(new(208, 208, 208), 252),
new(new(218, 218, 218), 253),
new(new(228, 228, 228), 254),
new(new(238, 238, 238), 255),
};
private static readonly byte[] ColorMap8_Step = new byte[] { 0, 95, 135, 175, 215, 255 };
public static string GetColorEscapeCode(byte R, byte G, byte B, bool foreground)
{
return GetColorEscapeCode(R, G, B, foreground, Settings.Config.Main.Advanced.TerminalColorDepth);
}
public static string GetColorEscapeCode(byte R, byte G, byte B, bool foreground, TerminalColorDepthType colorDepth)
{
switch (colorDepth)
{
case TerminalColorDepthType.bit_4:
{
ColorRGBA color = new(R, G, B);
int best_idx = 0;
double min_distance = ColorMap4[0].Item1.Distance(color);
for (int i = 1; i < ColorMap4.Length; ++i)
{
double distance = ColorMap4[i].Item1.Distance(color);
if (distance < min_distance)
{
min_distance = distance;
best_idx = i;
}
}
return string.Format("\u001b[{0}m", ColorMap4[best_idx].Item2 - (foreground ? 10 : 0));
}
case TerminalColorDepthType.bit_8:
{
ColorRGBA color = new(R, G, B);
int R_idx = (int)(R <= 95 ? Math.Round(R / 95.0) : 1 + Math.Round((R - 95.0) / 40.0));
int G_idx = (int)(G <= 95 ? Math.Round(G / 95.0) : 1 + Math.Round((G - 95.0) / 40.0));
int B_idx = (int)(B <= 95 ? Math.Round(B / 95.0) : 1 + Math.Round((B - 95.0) / 40.0));
int best_idx = -1;
double min_distance = color.Distance(new ColorRGBA(ColorMap8_Step[R_idx],
ColorMap8_Step[G_idx],
ColorMap8_Step[B_idx]));
for (int i = 0; i < ColorMap8.Length; ++i)
{
double distance = ColorMap8[i].Item1.Distance(color);
if (distance < min_distance)
{
min_distance = distance;
best_idx = i;
}
}
if (best_idx == -1)
return string.Format("\u001B[{0};5;{1}m", (foreground ? 38 : 48), 16 + (36 * R_idx) + (6 * G_idx) + B_idx);
else
return string.Format("\u001B[{0};5;{1}m", (foreground ? 38 : 48), ColorMap8[best_idx].Item2);
}
case TerminalColorDepthType.bit_24:
return string.Format("\u001B[{0};2;{1};{2};{3}m", (foreground ? 38 : 48), R, G, B);
default:
return string.Empty;
}
}
public static string GetResetEscapeCode()
{
return "\u001b[0m";
}
}
public class ColorRGBA
{
public byte R { get; set; }
public byte G { get; set; }
public byte B { get; set; }
public byte A { get; set; }
public bool Unknown { get; set; } = false;
public double Distance(ColorRGBA color)
{
double r_mean = (double)(this.R + color.R) / 2.0;
double R = this.R - color.R;
double G = this.G - color.G;
double B = this.B - color.B;
return Math.Sqrt((2.0 + r_mean / 256.0) * (R * R) + 4.0 * (G * G) + (2.0 + (255 - r_mean) / 256.0) * (B * B));
}
public ColorRGBA(byte r, byte g, byte b, byte a, bool unknown)
{
R = r;
G = g;
B = b;
A = a;
Unknown = unknown;
}
public ColorRGBA(byte r, byte g, byte b, byte a)
{
R = r;
G = g;
B = b;
A = a;
}
public ColorRGBA(byte r, byte g, byte b)
{
R = r;
G = g;
B = b;
A = 255;
}
}
}

View file

@ -44,11 +44,11 @@ namespace MinecraftClient.Commands
sb.AppendLine(Translations.Get("cmd.chunk.chunk_pos", markChunkX, markChunkZ));;
}
int consoleHeight = Math.Max(Console.BufferHeight - 2, 25);
int consoleHeight = Math.Max(Math.Max(Console.BufferHeight, Settings.Config.Main.Advanced.MinTerminalHeight) - 2, 25);
if (consoleHeight % 2 == 0)
--consoleHeight;
int consoleWidth = Math.Max(Console.BufferWidth / 2, 17);
int consoleWidth = Math.Max(Math.Max(Console.BufferWidth, Settings.Config.Main.Advanced.MinTerminalWidth) / 2, 17);
if (consoleWidth % 2 == 0)
--consoleWidth;

View file

@ -352,7 +352,36 @@ namespace MinecraftClient
//Test line to troubleshoot invisible colors
if (Config.Logging.DebugMessages)
{
ConsoleIO.WriteLineFormatted(Translations.Get("debug.color_test", "[0123456789ABCDEF]: [§00§11§22§33§44§55§66§77§88§99§aA§bB§cC§dD§eE§fF§r]"));
ConsoleIO.WriteLineFormatted(Translations.Get("debug.color_test", "[0123456789ABCDEF]: (4bit)[§00§11§22§33§44§55§66§77§88§99§aA§bB§cC§dD§eE§fF§r]"));
Random random = new();
{ // Test 8 bit color
StringBuilder sb = new();
sb.Append("[0123456789]: (8bit)[");
for (int i = 0; i < 10; ++i)
{
sb.Append(ColorHelper.GetColorEscapeCode((byte)random.Next(255),
(byte)random.Next(255),
(byte)random.Next(255),
true,
TerminalColorDepthType.bit_8)).Append(i);
}
sb.Append(ColorHelper.GetResetEscapeCode()).Append(']');
ConsoleIO.WriteLine(Translations.Get("debug.color_test", sb.ToString()));
}
{ // Test 24 bit color
StringBuilder sb = new();
sb.Append("[0123456789]: (24bit)[");
for (int i = 0; i < 10; ++i)
{
sb.Append(ColorHelper.GetColorEscapeCode((byte)random.Next(255),
(byte)random.Next(255),
(byte)random.Next(255),
true,
TerminalColorDepthType.bit_24)).Append(i);
}
sb.Append(ColorHelper.GetResetEscapeCode()).Append(']');
ConsoleIO.WriteLine(Translations.Get("debug.color_test", sb.ToString()));
}
}
//Load cached sessions from disk if necessary

View file

@ -553,6 +553,19 @@ namespace MinecraftClient.Protocol.Handlers
(messageTypeEnum == ChatParser.MessageType.TEAM_MSG_COMMAND_INCOMING || messageTypeEnum == ChatParser.MessageType.TEAM_MSG_COMMAND_OUTGOING))
senderTeamName = Json.ParseJson(targetName).Properties["with"].DataArray[0].Properties["text"].StringValue;
if (string.IsNullOrWhiteSpace(senderDisplayName))
{
PlayerInfo? player = handler.GetPlayerInfo(senderUUID);
if (player != null && (player.DisplayName != null || player.Name != null) && string.IsNullOrWhiteSpace(senderDisplayName))
{
senderDisplayName = ChatParser.ParseText(player.DisplayName ?? player.Name);
if (string.IsNullOrWhiteSpace(senderDisplayName))
senderDisplayName = player.DisplayName ?? player.Name;
else
senderDisplayName += "§r";
}
}
bool verifyResult;
if (!isOnlineMode)
verifyResult = false;
@ -1382,8 +1395,8 @@ namespace MinecraftClient.Protocol.Handlers
byte windowID = dataTypes.ReadNextByte(packetData);
short actionID = dataTypes.ReadNextShort(packetData);
bool accepted = dataTypes.ReadNextBool(packetData);
if (!accepted && actionID > 0)
SendWindowConfirmation(windowID, actionID, accepted);
if (!accepted)
SendWindowConfirmation(windowID, actionID, true);
}
break;
case PacketTypesIn.ResourcePackSend:

View file

@ -47,8 +47,10 @@ namespace MinecraftClient.Protocol
/// <returns>Returns the translated text</returns>
public static string ParseSignedChat(ChatMessage message, List<string>? links = null)
{
string chatContent = Config.Signature.ShowModifiedChat && message.unsignedContent != null ? message.unsignedContent : message.content;
string content = message.isJson ? ParseText(chatContent, links) : chatContent;
string chatContent = (Config.Signature.ShowModifiedChat && message.unsignedContent != null) ? message.unsignedContent : message.content;
string content = ParseText(chatContent, links);
if (string.IsNullOrEmpty(content))
content = chatContent;
string sender = message.displayName!;
string text;

View file

@ -50,6 +50,8 @@ mcc.realms_available=Du hast Zugang zu den folgenden Realms-Welten
mcc.realms_join=Nutze realms:index als Server-IP, um der Realms-Welt beizutreten
mcc.generator.generating=
mcc.generator.done=
mcc.invaild_config=
mcc.gen_new_config=
[debug]
# Messages from MCC Debug Mode
@ -237,6 +239,12 @@ cmd.changeSlot.fail=Konnte Slot nicht ändern.
# Chunk
cmd.chunk.desc=
cmd.chunk.current=
cmd.chunk.marked=
cmd.chunk.chunk_pos=
cmd.chunk.outside=
cmd.chunk.icon=
cmd.chunk.for_debug=
# Connect
cmd.connect.desc=Verbinde zum angegebenen Server.
@ -487,6 +495,18 @@ bot.autoCraft.debug.no_config=Keine Config-Datei gefunden. Schreibe eine neue...
bot.autocraft.invaild_slots=
bot.autocraft.invaild_invaild_result=
# AutoDig
bot.autodig.start_delay=
bot.autodig.dig_timeout=
bot.autodig.not_allow=
bot.autodig.cmd=
bot.autodig.available_cmd=
bot.autodig.start=
bot.autodig.stop=
bot.autodig.help.start=
bot.autodig.help.stop=
bot.autodig.help.help=
# AutoDrop
bot.autoDrop.cmd=AutoDrop ChatBot Befehl
bot.autoDrop.alias=AutoDrop ChatBot Befehl alias
@ -584,6 +604,7 @@ bot.map.received_map=
bot.map.rendered=
bot.map.failed_to_render=
bot.map.list_item=
bot.map.scale=
# ReplayCapture
bot.replayCapture.cmd=replay Befehl
@ -682,6 +703,9 @@ config.Main.Advanced.timeout=
config.Main.Advanced.enable_emoji=
config.Main.Advanced.movement_speed=
config.Main.Advanced.language.invaild=
config.Main.Advanced.TerminalColorDepth=
config.Main.Advanced.MinTerminalWidth=
config.Main.Advanced.MinTerminalHeight=
# Signature
config.Signature=
@ -755,6 +779,7 @@ config.ChatBot.Alerts.Log_File=
config.ChatBot.AntiAfk=
config.ChatBot.AntiAfk.Delay=
config.ChatBot.AntiAfk.Command=
config.ChatBot.AntiAfk.Use_Sneak=
config.ChatBot.AntiAfk.Use_Terrain_Handling=
config.ChatBot.AntiAfk.Walk_Range=
config.ChatBot.AntiAfk.Walk_Retries=
@ -776,6 +801,19 @@ config.ChatBot.AutoCraft.CraftingTable=
config.ChatBot.AutoCraft.OnFailure=
config.ChatBot.AutoCraft.Recipes=
# AutoDig
config.ChatBot.AutoDig=
config.ChatBot.AutoDig.Auto_Tool_Switch=
config.ChatBot.AutoDig.Durability_Limit=
config.ChatBot.AutoDig.Drop_Low_Durability_Tools=
config.ChatBot.AutoDig.Mode=
config.ChatBot.AutoDig.Locations=
config.ChatBot.AutoDig.Location_Order=
config.ChatBot.AutoDig.Auto_Start_Delay=
config.ChatBot.AutoDig.Dig_Timeout=
config.ChatBot.AutoDig.Log_Block_Dig=
config.ChatBot.AutoDig.List_Type=
# ChatBot.AutoDrop
config.ChatBot.AutoDrop=
config.ChatBot.AutoDrop.Mode=
@ -826,11 +864,11 @@ config.ChatBot.Mailer=
# ChatBot.Map
config.ChatBot.Map=
config.ChatBot.Map.Should_Resize=
config.ChatBot.Map.Resize_To=
config.ChatBot.Map.Auto_Render_On_Update=
config.ChatBot.Map.Delete_All_On_Unload=
config.ChatBot.Map.Notify_On_First_Update=
config.ChatBot.Map.Render_In_Console=
config.ChatBot.Map.Save_To_File=
# ChatBot.PlayerListLogger
config.ChatBot.PlayerListLogger=

View file

@ -604,7 +604,7 @@ bot.map.received_map=Received a new Map, with Id: {0}
bot.map.rendered=Succesfully rendered a map with id '{0}' to: '{1}'
bot.map.failed_to_render=Failed to render the map with id: '{0}'
bot.map.list_item=- Map id: {0} (Last Updated: {1})
bot.map.windows_only=Save to file is currently only available for the windows platform.
bot.map.scale=The size of the map is reduced from ({0}x{1}) to ({2}x{3}) due to the size limitation of the current terminal.
# ReplayCapture
bot.replayCapture.cmd=replay command
@ -703,6 +703,9 @@ config.Main.Advanced.timeout=Customize the TCP connection timeout with the serve
config.Main.Advanced.enable_emoji=If turned off, the emoji will be replaced with a simpler character (for /chunk status).
config.Main.Advanced.movement_speed=A movement speed higher than 2 may be considered cheating.
config.Main.Advanced.language.invaild=The language code is invalid!
config.Main.Advanced.TerminalColorDepth=Use "none", "bit_4", "bit_8" or "bit_24". This can be checked by opening the debug log.
config.Main.Advanced.MinTerminalWidth=The minimum width used when calculating the image size from the width of the terminal.
config.Main.Advanced.MinTerminalHeight=The minimum height to use when calculating the image size from the height of the terminal.
# Signature
config.Signature=Chat signature related settings (affects minecraft 1.19+)
@ -799,7 +802,7 @@ config.ChatBot.AutoCraft.OnFailure=What to do on crafting failure, "abort" or "w
config.ChatBot.AutoCraft.Recipes=Recipes.Name: The name can be whatever you like and it is used to represent the recipe.\n# Recipes.Type: crafting table type: "player" or "table"\n# Recipes.Result: the resulting item\n# Recipes.Slots: All slots, counting from left to right, top to bottom. Please fill in "Null" for empty slots.\n# For the naming of the items, please see:\n# https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/Inventory/ItemType.cs
# AutoDig
config.ChatBot.AutoDig=Auto-digging blocks.\n# You can use "/digbot start" and "/digbot stop" to control the start and stop of AutoDig.\n# Since MCC does not yet support accurate calculation of the collision volume of blocks, all blocks are considered as complete cubes when obtaining the position of the lookahead.\n# For the naming of the block, please see https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/Mapping/Material.cs
config.ChatBot.AutoDig=Auto-digging blocks.\n# You need to enable Terrain Handling to use this bot\n# You can use "/digbot start" and "/digbot stop" to control the start and stop of AutoDig.\n# Since MCC does not yet support accurate calculation of the collision volume of blocks, all blocks are considered as complete cubes when obtaining the position of the lookahead.\n# For the naming of the block, please see https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/Mapping/Material.cs
config.ChatBot.AutoDig.Auto_Tool_Switch=Automatically switch to the appropriate tool.
config.ChatBot.AutoDig.Durability_Limit=Will not use tools with less durability than this. Set to zero to disable this feature.
config.ChatBot.AutoDig.Drop_Low_Durability_Tools=Whether to drop the current tool when its durability is too low.
@ -861,8 +864,8 @@ config.ChatBot.Mailer=Relay messages between players and servers, like a mail pl
# ChatBot.Map
config.ChatBot.Map=Allows you to render maps into .jpg images\n# This is useful for solving captchas which use maps\n# The maps are rendered into Rendered_Maps folder.\n# NOTE:\n# This feature is currently only useful for solving captchas which use maps.\n# If some servers have a very short time for solving captchas, enabe Auto_Render_On_Update and prepare to open the file quickly.\n# On linux you can use FTP to access generated files.\n# In the future it might will be possible to display maps directly in the console with a separate command.\n# /!\ Make sure server rules allow bots to be used on the server, or you risk being punished.
config.ChatBot.Map.Should_Resize=Should the map be resized? (Default one is small 128x128)
config.ChatBot.Map.Resize_To=The size to resize the map to (Note: the bigger it is, the lower the quallity is)
config.ChatBot.Map.Render_In_Console=Whether to render the map in the console.
config.ChatBot.Map.Save_To_File=Whether to store the rendered map as a file.
config.ChatBot.Map.Auto_Render_On_Update=Automatically render the map once it is received or updated from/by the server
config.ChatBot.Map.Delete_All_On_Unload=Delete all rendered maps on unload/reload (Does not delete the images if you exit the client)
config.ChatBot.Map.Notify_On_First_Update=Get a notification when you have gotten a map from the server for the first time

View file

@ -50,6 +50,8 @@ mcc.realms_available=Vous avez accès aux mondes Realms suivants
mcc.realms_join=Utilisez realms:<index> comme ip de serveur pour rejoindre un monde Realms
mcc.generator.generating=
mcc.generator.done=
mcc.invaild_config=
mcc.gen_new_config=
[debug]
# Messages from MCC Debug Mode
@ -237,6 +239,12 @@ cmd.changeSlot.fail=Le slot n'a pas pu être sélectionné
# Chunk
cmd.chunk.desc=
cmd.chunk.current=
cmd.chunk.marked=
cmd.chunk.chunk_pos=
cmd.chunk.outside=
cmd.chunk.icon=
cmd.chunk.for_debug=
# Connect
cmd.connect.desc=Se connecter au serveur spécifié
@ -487,6 +495,18 @@ bot.autoCraft.debug.no_config=Fichier de configuration introuvable. Création d'
bot.autocraft.invaild_slots=
bot.autocraft.invaild_invaild_result=
# AutoDig
bot.autodig.start_delay=
bot.autodig.dig_timeout=
bot.autodig.not_allow=
bot.autodig.cmd=
bot.autodig.available_cmd=
bot.autodig.start=
bot.autodig.stop=
bot.autodig.help.start=
bot.autodig.help.stop=
bot.autodig.help.help=
# AutoDrop
bot.autoDrop.cmd=Commande du ChatBot AutoDrop
bot.autoDrop.alias=Alias des commandes du ChatBot AutoDrop
@ -584,6 +604,7 @@ bot.map.received_map=
bot.map.rendered=
bot.map.failed_to_render=
bot.map.list_item=
bot.map.scale=
# ReplayCapture
bot.replayCapture.cmd=Commande de Replay
@ -682,6 +703,9 @@ config.Main.Advanced.timeout=
config.Main.Advanced.enable_emoji=
config.Main.Advanced.movement_speed=
config.Main.Advanced.language.invaild=
config.Main.Advanced.TerminalColorDepth=
config.Main.Advanced.MinTerminalWidth=
config.Main.Advanced.MinTerminalHeight=
# Signature
config.Signature=
@ -755,6 +779,7 @@ config.ChatBot.Alerts.Log_File=
config.ChatBot.AntiAfk=
config.ChatBot.AntiAfk.Delay=
config.ChatBot.AntiAfk.Command=
config.ChatBot.AntiAfk.Use_Sneak=
config.ChatBot.AntiAfk.Use_Terrain_Handling=
config.ChatBot.AntiAfk.Walk_Range=
config.ChatBot.AntiAfk.Walk_Retries=
@ -776,6 +801,19 @@ config.ChatBot.AutoCraft.CraftingTable=
config.ChatBot.AutoCraft.OnFailure=
config.ChatBot.AutoCraft.Recipes=
# AutoDig
config.ChatBot.AutoDig=
config.ChatBot.AutoDig.Auto_Tool_Switch=
config.ChatBot.AutoDig.Durability_Limit=
config.ChatBot.AutoDig.Drop_Low_Durability_Tools=
config.ChatBot.AutoDig.Mode=
config.ChatBot.AutoDig.Locations=
config.ChatBot.AutoDig.Location_Order=
config.ChatBot.AutoDig.Auto_Start_Delay=
config.ChatBot.AutoDig.Dig_Timeout=
config.ChatBot.AutoDig.Log_Block_Dig=
config.ChatBot.AutoDig.List_Type=
# ChatBot.AutoDrop
config.ChatBot.AutoDrop=
config.ChatBot.AutoDrop.Mode=
@ -826,11 +864,11 @@ config.ChatBot.Mailer=
# ChatBot.Map
config.ChatBot.Map=
config.ChatBot.Map.Should_Resize=
config.ChatBot.Map.Resize_To=
config.ChatBot.Map.Auto_Render_On_Update=
config.ChatBot.Map.Delete_All_On_Unload=
config.ChatBot.Map.Notify_On_First_Update=
config.ChatBot.Map.Render_In_Console=
config.ChatBot.Map.Save_To_File=
# ChatBot.PlayerListLogger
config.ChatBot.PlayerListLogger=

View file

@ -50,6 +50,8 @@ mcc.realms_available=У вас есть доступ к следующим ми
mcc.realms_join=Используйте realms:index как IP сервера, чтобы присоединиться к миру Realms
mcc.generator.generating=
mcc.generator.done=
mcc.invaild_config=
mcc.gen_new_config=
[debug]
# Messages from MCC Debug Mode
@ -237,6 +239,12 @@ cmd.changeSlot.fail=Не удалось изменить слот
# Chunk
cmd.chunk.desc=
cmd.chunk.current=
cmd.chunk.marked=
cmd.chunk.chunk_pos=
cmd.chunk.outside=
cmd.chunk.icon=
cmd.chunk.for_debug=
# Connect
cmd.connect.desc=подключиться к указанному серверу.
@ -487,6 +495,18 @@ bot.autoCraft.debug.no_config=Конфигурация не найдена. За
bot.autocraft.invaild_slots=
bot.autocraft.invaild_invaild_result=
# AutoDig
bot.autodig.start_delay=
bot.autodig.dig_timeout=
bot.autodig.not_allow=
bot.autodig.cmd=
bot.autodig.available_cmd=
bot.autodig.start=
bot.autodig.stop=
bot.autodig.help.start=
bot.autodig.help.stop=
bot.autodig.help.help=
# AutoDrop
bot.autoDrop.cmd=Команда автоудаления ЧатБота
bot.autoDrop.alias=Псевдоним команды автоудаления ЧатБота
@ -584,6 +604,7 @@ bot.map.received_map=
bot.map.rendered=
bot.map.failed_to_render=
bot.map.list_item=
bot.map.scale=
# ReplayCapture
bot.replayCapture.cmd=команда воспроизведения
@ -682,6 +703,9 @@ config.Main.Advanced.timeout=
config.Main.Advanced.enable_emoji=
config.Main.Advanced.movement_speed=
config.Main.Advanced.language.invaild=
config.Main.Advanced.TerminalColorDepth=
config.Main.Advanced.MinTerminalWidth=
config.Main.Advanced.MinTerminalHeight=
# Signature
config.Signature=
@ -755,6 +779,7 @@ config.ChatBot.Alerts.Log_File=
config.ChatBot.AntiAfk=
config.ChatBot.AntiAfk.Delay=
config.ChatBot.AntiAfk.Command=
config.ChatBot.AntiAfk.Use_Sneak=
config.ChatBot.AntiAfk.Use_Terrain_Handling=
config.ChatBot.AntiAfk.Walk_Range=
config.ChatBot.AntiAfk.Walk_Retries=
@ -776,6 +801,19 @@ config.ChatBot.AutoCraft.CraftingTable=
config.ChatBot.AutoCraft.OnFailure=
config.ChatBot.AutoCraft.Recipes=
# AutoDig
config.ChatBot.AutoDig=
config.ChatBot.AutoDig.Auto_Tool_Switch=
config.ChatBot.AutoDig.Durability_Limit=
config.ChatBot.AutoDig.Drop_Low_Durability_Tools=
config.ChatBot.AutoDig.Mode=
config.ChatBot.AutoDig.Locations=
config.ChatBot.AutoDig.Location_Order=
config.ChatBot.AutoDig.Auto_Start_Delay=
config.ChatBot.AutoDig.Dig_Timeout=
config.ChatBot.AutoDig.Log_Block_Dig=
config.ChatBot.AutoDig.List_Type=
# ChatBot.AutoDrop
config.ChatBot.AutoDrop=
config.ChatBot.AutoDrop.Mode=
@ -826,11 +864,11 @@ config.ChatBot.Mailer=
# ChatBot.Map
config.ChatBot.Map=
config.ChatBot.Map.Should_Resize=
config.ChatBot.Map.Resize_To=
config.ChatBot.Map.Auto_Render_On_Update=
config.ChatBot.Map.Delete_All_On_Unload=
config.ChatBot.Map.Notify_On_First_Update=
config.ChatBot.Map.Render_In_Console=
config.ChatBot.Map.Save_To_File=
# ChatBot.PlayerListLogger
config.ChatBot.PlayerListLogger=

View file

@ -50,6 +50,8 @@ mcc.realms_available=Bạn có quyền tham gia vào những máy chủ Realm n
mcc.realms_join=Dùng realm:[thứ tự] để tham gia máy chủ Realm
mcc.generator.generating=
mcc.generator.done=
mcc.invaild_config=
mcc.gen_new_config=
[debug]
# Messages from MCC Debug Mode
@ -237,6 +239,12 @@ cmd.changeSlot.fail=Could not change slot
# Chunk
cmd.chunk.desc=
cmd.chunk.current=
cmd.chunk.marked=
cmd.chunk.chunk_pos=
cmd.chunk.outside=
cmd.chunk.icon=
cmd.chunk.for_debug=
# Connect
cmd.connect.desc=connect to the specified server.
@ -487,6 +495,18 @@ bot.autoCraft.debug.no_config=No config found. Writing a new one.
bot.autocraft.invaild_slots=
bot.autocraft.invaild_invaild_result=
# AutoDig
bot.autodig.start_delay=
bot.autodig.dig_timeout=
bot.autodig.not_allow=
bot.autodig.cmd=
bot.autodig.available_cmd=
bot.autodig.start=
bot.autodig.stop=
bot.autodig.help.start=
bot.autodig.help.stop=
bot.autodig.help.help=
# AutoDrop
bot.autoDrop.cmd=AutoDrop ChatBot command
bot.autoDrop.alias=AutoDrop ChatBot command alias
@ -584,6 +604,7 @@ bot.map.received_map=
bot.map.rendered=
bot.map.failed_to_render=
bot.map.list_item=
bot.map.scale=
# ReplayCapture
bot.replayCapture.cmd=replay command
@ -682,6 +703,9 @@ config.Main.Advanced.timeout=
config.Main.Advanced.enable_emoji=
config.Main.Advanced.movement_speed=
config.Main.Advanced.language.invaild=
config.Main.Advanced.TerminalColorDepth=
config.Main.Advanced.MinTerminalWidth=
config.Main.Advanced.MinTerminalHeight=
# Signature
config.Signature=
@ -755,6 +779,7 @@ config.ChatBot.Alerts.Log_File=
config.ChatBot.AntiAfk=
config.ChatBot.AntiAfk.Delay=
config.ChatBot.AntiAfk.Command=
config.ChatBot.AntiAfk.Use_Sneak=
config.ChatBot.AntiAfk.Use_Terrain_Handling=
config.ChatBot.AntiAfk.Walk_Range=
config.ChatBot.AntiAfk.Walk_Retries=
@ -776,6 +801,19 @@ config.ChatBot.AutoCraft.CraftingTable=
config.ChatBot.AutoCraft.OnFailure=
config.ChatBot.AutoCraft.Recipes=
# AutoDig
config.ChatBot.AutoDig=
config.ChatBot.AutoDig.Auto_Tool_Switch=
config.ChatBot.AutoDig.Durability_Limit=
config.ChatBot.AutoDig.Drop_Low_Durability_Tools=
config.ChatBot.AutoDig.Mode=
config.ChatBot.AutoDig.Locations=
config.ChatBot.AutoDig.Location_Order=
config.ChatBot.AutoDig.Auto_Start_Delay=
config.ChatBot.AutoDig.Dig_Timeout=
config.ChatBot.AutoDig.Log_Block_Dig=
config.ChatBot.AutoDig.List_Type=
# ChatBot.AutoDrop
config.ChatBot.AutoDrop=
config.ChatBot.AutoDrop.Mode=
@ -826,11 +864,11 @@ config.ChatBot.Mailer=
# ChatBot.Map
config.ChatBot.Map=
config.ChatBot.Map.Should_Resize=
config.ChatBot.Map.Resize_To=
config.ChatBot.Map.Auto_Render_On_Update=
config.ChatBot.Map.Delete_All_On_Unload=
config.ChatBot.Map.Notify_On_First_Update=
config.ChatBot.Map.Render_In_Console=
config.ChatBot.Map.Save_To_File=
# ChatBot.PlayerListLogger
config.ChatBot.PlayerListLogger=

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -396,6 +396,11 @@ namespace MinecraftClient
for (int i = 0; i < Advanced.BotOwners.Count; ++i)
Advanced.BotOwners[i] = ToLowerIfNeed(Advanced.BotOwners[i]);
if (Advanced.MinTerminalWidth < 1)
Advanced.MinTerminalWidth = 1;
if (Advanced.MinTerminalHeight < 1)
Advanced.MinTerminalHeight = 1;
}
[TomlDoNotInlineObject]
@ -466,6 +471,12 @@ namespace MinecraftClient
[TomlInlineComment("$config.Main.Advanced.terrain_and_movements$")]
public bool TerrainAndMovements = false;
[TomlInlineComment("$config.Main.Advanced.move_head_while_walking$")]
public bool MoveHeadWhileWalking = true;
[TomlInlineComment("$config.Main.Advanced.movement_speed$")]
public int MovementSpeed = 2;
[TomlInlineComment("$config.Main.Advanced.inventory_handling$")]
public bool InventoryHandling = false;
@ -511,17 +522,20 @@ namespace MinecraftClient
[TomlInlineComment("$config.Main.Advanced.minecraft_realms$")]
public bool MinecraftRealms = false;
[TomlInlineComment("$config.Main.Advanced.move_head_while_walking$")]
public bool MoveHeadWhileWalking = true;
[TomlInlineComment("$config.Main.Advanced.timeout$")]
public int TcpTimeout = 30;
[TomlInlineComment("$config.Main.Advanced.enable_emoji$")]
public bool EnableEmoji = true;
[TomlInlineComment("$config.Main.Advanced.movement_speed$")]
public int MovementSpeed = 2;
[TomlInlineComment("$config.Main.Advanced.TerminalColorDepth$")]
public TerminalColorDepthType TerminalColorDepth = TerminalColorDepthType.bit_24;
[TomlInlineComment("$config.Main.Advanced.MinTerminalWidth$")]
public int MinTerminalWidth = 16;
[TomlInlineComment("$config.Main.Advanced.MinTerminalHeight$")]
public int MinTerminalHeight = 10;
/// <summary>
/// Load login/password using an account alias
@ -549,6 +563,8 @@ namespace MinecraftClient
public enum ResolveSrvRecordType { no, fast, yes };
public enum ForgeConfigType { no, auto, force };
public enum TerminalColorDepthType { bit_4, bit_8, bit_24};
}
public struct AccountInfoConfig
@ -1231,9 +1247,10 @@ namespace MinecraftClient
{
public static string GetFullMessage(this Exception ex)
{
string msg = ex.Message.Replace("+", "->");
return ex.InnerException == null
? ex.Message
: ex.Message + "\n --> " + ex.InnerException.GetFullMessage();
? msg
: msg + "\n --> " + ex.InnerException.GetFullMessage();
}
}
}

View file

@ -50,11 +50,11 @@ If you'd like to contribute to Minecraft Console Client, great, just fork the re
Check out: [How to update or add translations for MCC](https://mccteam.github.io/guide/contibuting.html#translations).
MCC now supports the following languages (Alphabetical order) :
* `de.ini` (54.64% translated) : Deutsch - German
* `de.ini` (54.40% translated) : Deutsch - German
* `en.ini` : English - English
* `fr.ini` (54.64% translated) : Français (France) - French
* `ru.ini` (53.74% translated) : Русский (Russkiy) - Russian
* `vi.ini` (53.74% translated) : Tiếng Việt (Việt Nam) - Vietnamese
* `fr.ini` (54.40% translated) : Français (France) - French
* `ru.ini` (53.50% translated) : Русский (Russkiy) - Russian
* `vi.ini` (53.50% translated) : Tiếng Việt (Việt Nam) - Vietnamese
* `zh-Hans.ini` (100.00% translated) : 简体中文 - Chinese Simplified
* `zh-Hant.ini` (100.00% translated) : 繁體中文 - Chinese Traditional