Better translation

This commit is contained in:
BruceChen 2022-10-17 20:00:33 +08:00
parent bce2bc8b7f
commit 117a38b5f9
21 changed files with 95 additions and 156 deletions

View file

@ -112,6 +112,13 @@ namespace MinecraftClient.Mapping
blockIdAndMeta = typeAndMeta;
}
public string GetTypeString()
{
string typeStr = Type.ToString();
string? trans = Protocol.ChatParser.TranslateString("block.minecraft." + typeStr.ToUnderscoreCase());
return string.IsNullOrEmpty(trans) ? typeStr : trans;
}
/// <summary>
/// String representation of the block
/// </summary>

View file

@ -154,5 +154,12 @@ namespace MinecraftClient.Mapping
Yaw = yaw * (1 / 256) * 360; // to angle in 360 degree
Pitch = pitch * (1 / 256) * 360;
}
public string GetTypeString()
{
string typeStr = Type.ToString();
string? trans = Protocol.ChatParser.TranslateString("entity.minecraft." + typeStr.ToUnderscoreCase());
return string.IsNullOrEmpty(trans) ? typeStr : trans;
}
}
}

View file

@ -64,7 +64,7 @@ namespace MinecraftClient.Mapping
/// <summary>
/// Parse location from the string.
/// return NULL if the parsing fails.
/// throw FormatException if the parsing fails.
/// </summary>
/// <param name="x">The string representation of the X-axis coordinate.</param>
/// <param name="y">The string representation of the Y-axis coordinate.</param>
@ -99,7 +99,7 @@ namespace MinecraftClient.Mapping
/// <summary>
/// Parse location from the string (relative coordinate representation is supported).
/// return NULL if the parsing fails.
/// throw FormatException if the parsing fails.
/// </summary>
/// <param name="current">Relative position base point.</param>
/// <param name="x">The string representation of the X-axis coordinate.</param>