mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Modernize data carriers to records and add primary constructors
Convert 14 data carrier classes to records: - VillagerInfo, MapIcon, EnchantmentData: non-positional records (mutable properties) - ForgeMod, SkinInfo, VillagerTrade, Node, Response: positional records - CommandNode: sealed positional record - CommandArgumentDescriptor: readonly record struct - ColorRGBA: record struct (multiple constructors preserved) - RecipeConfig, Recipe, BannerLayer: non-positional records Add primary constructors to 6 classes: - DataTypes, Protocol18Terrain, Protocol18Forge, ItemMovingHelper, LastSeenMessageList, Acknowledgment, SuggestionTooltip Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
81b756292e
commit
654a16907b
18 changed files with 68 additions and 231 deletions
|
|
@ -19,19 +19,7 @@ namespace MinecraftClient.Protocol
|
|||
/// Information about a players Skin.
|
||||
/// Empty string if not available.
|
||||
/// </summary>
|
||||
public class SkinInfo
|
||||
{
|
||||
public readonly string SkinUrl;
|
||||
public readonly string CapeUrl;
|
||||
public readonly string SkinModel;
|
||||
|
||||
public SkinInfo(string skinUrl = "", string capeUrl = "", string skinModel = "")
|
||||
{
|
||||
SkinUrl = skinUrl;
|
||||
CapeUrl = capeUrl;
|
||||
SkinModel = skinModel;
|
||||
}
|
||||
}
|
||||
public record SkinInfo(string SkinUrl = "", string CapeUrl = "", string SkinModel = "");
|
||||
|
||||
/// <summary>
|
||||
/// Status of the single Mojang services
|
||||
|
|
@ -254,14 +242,14 @@ namespace MinecraftClient.Protocol
|
|||
// Can apparently be missing, if no custom skin is set.
|
||||
if (textureObj.ContainsKey("SKIN"))
|
||||
{
|
||||
return new SkinInfo(skinUrl: textureObj["SKIN"]!["url"] is not null ? textureObj["SKIN"]!["url"]!.GetStringValue() : string.Empty,
|
||||
capeUrl: textureObj.ContainsKey("CAPE") ? textureObj["CAPE"]!["url"]!.GetStringValue() : string.Empty,
|
||||
skinModel: textureObj["SKIN"]!["metadata"] is not null ? "Alex" : "Steve");
|
||||
return new SkinInfo(SkinUrl: textureObj["SKIN"]!["url"] is not null ? textureObj["SKIN"]!["url"]!.GetStringValue() : string.Empty,
|
||||
CapeUrl: textureObj.ContainsKey("CAPE") ? textureObj["CAPE"]!["url"]!.GetStringValue() : string.Empty,
|
||||
SkinModel: textureObj["SKIN"]!["metadata"] is not null ? "Alex" : "Steve");
|
||||
}
|
||||
else
|
||||
{
|
||||
return new SkinInfo(capeUrl: textureObj.ContainsKey("CAPE") ? textureObj["CAPE"]!["url"]!.GetStringValue() : string.Empty,
|
||||
skinModel: DefaultModelAlex(uuid) ? "Alex" : "Steve");
|
||||
return new SkinInfo(CapeUrl: textureObj.ContainsKey("CAPE") ? textureObj["CAPE"]!["url"]!.GetStringValue() : string.Empty,
|
||||
SkinModel: DefaultModelAlex(uuid) ? "Alex" : "Steve");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue