mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
- 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
29 lines
1 KiB
C#
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);
|
|
}
|
|
}
|