2024-09-11 19:12:31 +02:00
|
|
|
using System.Collections.Generic;
|
2024-09-11 20:35:23 +02:00
|
|
|
using MinecraftClient.Inventory.ItemPalettes;
|
2024-09-11 19:12:31 +02:00
|
|
|
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|
|
|
|
using MinecraftClient.Protocol.Message;
|
|
|
|
|
|
|
|
|
|
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
|
|
|
|
|
2024-10-05 13:37:52 +02:00
|
|
|
public class CustomNameComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
2024-09-11 20:35:23 +02:00
|
|
|
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
2024-09-11 19:12:31 +02:00
|
|
|
{
|
|
|
|
|
public string CustomName { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
public override void Parse(Queue<byte> data)
|
|
|
|
|
{
|
|
|
|
|
CustomName = ChatParser.ParseText(dataTypes.ReadNextString(data));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override Queue<byte> Serialize()
|
|
|
|
|
{
|
|
|
|
|
var data = new List<byte>();
|
|
|
|
|
data.AddRange(DataTypes.GetString(CustomName));
|
|
|
|
|
return new Queue<byte>(data);
|
|
|
|
|
}
|
|
|
|
|
}
|