Minecraft-Console-Client/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/ContainerComponent.cs
copilot-swe-agent[bot] 81b756292e Fix all compilation warnings (CS9107, CS8600, CS8604, CS8618, CS0168, CS0169, CS0649)
- Fix CS9107: Replace lowercase primary constructor parameter refs with
  PascalCase base class properties in 90+ StructuredComponent files
- Fix CS8618: Add null! initializers for late-initialized properties
- Fix CS8600: Use nullable out parameters in World.cs, ChatParser.cs
- Fix CS8604: Add null guard in Compiler.cs, fix null-conditional in McClient.cs
- Fix CS0168: Replace unused variable with discard in DataTypes.cs
- Fix CS0169: Remove unused motionY field from McClient.cs
- Fix CS0649: Remove never-assigned steps field, simplify ClientIsMoving()
- Initialize client/handler with null! to avoid CS8618 cascade

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/milutinke/Minecraft-Console-Client/sessions/7fcee1b2-21e2-4457-b01b-5e0a1f07752f
2026-03-24 01:25:50 +00:00

29 lines
1 KiB
C#

using System.Collections.Generic;
using MinecraftClient.Inventory;
using MinecraftClient.Inventory.ItemPalettes;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class ContainerComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public List<Item?> Items { get; set; } = [];
public override void Parse(Queue<byte> data)
{
var count = DataTypes.ReadNextVarInt(data);
for (var i = 0; i < count; i++)
Items.Add(DataTypes.ReadNextItemSlot(data, ItemPalette));
}
public override Queue<byte> Serialize()
{
var data = new List<byte>();
data.AddRange(DataTypes.GetVarInt(Items.Count));
foreach (var item in Items)
data.AddRange(DataTypes.GetItemSlot(item, ItemPalette));
return new Queue<byte>(data);
}
}