diff --git a/MinecraftClient/Protocol/Handlers/DataTypes.cs b/MinecraftClient/Protocol/Handlers/DataTypes.cs
index b62d511c..45b74645 100644
--- a/MinecraftClient/Protocol/Handlers/DataTypes.cs
+++ b/MinecraftClient/Protocol/Handlers/DataTypes.cs
@@ -445,18 +445,20 @@ namespace MinecraftClient.Protocol.Handlers
{
var componentTypeId = ReadNextVarInt(cache);
- var strcuturedComponentHandler = new StructuredComponentsHandler(protocolversion, this);
+ var strcuturedComponentHandler = new StructuredComponentsHandler(protocolversion, this, itemPalette);
strcturedComponentsToAdd.Add(strcuturedComponentHandler.Parse(componentTypeId, cache));
}
for (var i = 0; i < numberofComponentsToRemove; i++)
{
- // TODO
+ // TODO: Check what this does exactly
+ ReadNextVarInt(cache); // The type of component to remove
}
// TODO: Wire up the strctured components in the Item class (extract info, update fields, etc..)
+ // Use strcturedComponentsToAdd
// Look at: https://wiki.vg/index.php?title=Slot_Data&oldid=19350#Structured_components
-
+
return item;
case >= Protocol18Handler.MC_1_13_Version:
{
@@ -1537,6 +1539,8 @@ namespace MinecraftClient.Protocol.Handlers
/// Item slot representation
public byte[] GetItemSlot(Item? item, ItemPalette itemPalette)
{
+ // TODO: Wire up Structured components for 1.20.6
+
List slotData = new();
if (protocolversion > Protocol18Handler.MC_1_13_Version)
{
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/AttributeModifiersComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/AttributeModifiersComponent1206.cs
index c2eaa2da..08e0e5f2 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/AttributeModifiersComponent1206.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/AttributeModifiersComponent1206.cs
@@ -1,12 +1,14 @@
using System;
using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Components.Subcomponents;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Components.Subcomponents._1_20_6;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
-public class AttributeModifiersComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : StructuredComponent(dataTypes, subComponentRegistry)
+public class AttributeModifiersComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int NumberOfAttributes { get; set; }
public List Attributes { get; set; } = new();
@@ -27,8 +29,8 @@ public class AttributeModifiersComponent1206(DataTypes dataTypes, SubComponentRe
var data = new List();
data.AddRange(DataTypes.GetVarInt(NumberOfAttributes));
- if(NumberOfAttributes > 0 && Attributes.Count == 0)
- throw new ArgumentNullException($"Can not serialize a AttributeModifiersComponent when the Attributes is empty but NumberOfAttributes is > 0!");
+ if(Attributes.Count != NumberOfAttributes)
+ throw new ArgumentNullException($"Can not serialize a AttributeModifiersComponent when the Attributes count != NumberOfAttributes!");
foreach (var attribute in Attributes)
data.AddRange(attribute.Serialize());
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/BundleContentsComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/BundleContentsComponent1206.cs
new file mode 100644
index 00000000..075c7a7b
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/BundleContentsComponent1206.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MinecraftClient.Inventory;
+using MinecraftClient.Inventory.ItemPalettes;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
+
+namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
+
+public class BundleContentsComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
+{
+ public int NumberOfItems { get; set; }
+ public List- Items { get; set; } = [];
+
+ public override void Parse(Queue data)
+ {
+ NumberOfItems = dataTypes.ReadNextVarInt(data);
+
+ for (var i = 0; i < NumberOfItems; i++)
+ Items.Add(dataTypes.ReadNextItemSlot(data, itemPalette));
+ }
+
+ public override Queue Serialize()
+ {
+ var data = new List();
+ data.AddRange(DataTypes.GetVarInt(NumberOfItems));
+
+ if (NumberOfItems != Items.Count)
+ throw new ArgumentNullException($"Cannot serialize BundleContentsComponent1206 because NumberOfItems != Items.Count!");
+
+ foreach (var item in Items.OfType
- ())
+ data.AddRange(DataTypes.GetItemSlot(item, itemPalette));
+
+ return new Queue(data);
+ }
+}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CanBreakComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CanBreakComponent1206.cs
index 24d50cf5..cf0433d8 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CanBreakComponent1206.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CanBreakComponent1206.cs
@@ -1,12 +1,14 @@
using System;
using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Components.Subcomponents;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Components.Subcomponents._1_20_6;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
-public class CanBreakComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : StructuredComponent(dataTypes, subComponentRegistry)
+public class CanBreakComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int NumberOfPredicates { get; set; }
public List BlockPredicates { get; set; } = new();
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CanPlaceOnComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CanPlaceOnComponent1206.cs
index f19211b6..ef2057c9 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CanPlaceOnComponent1206.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CanPlaceOnComponent1206.cs
@@ -1,12 +1,14 @@
using System;
using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Components.Subcomponents;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Components.Subcomponents._1_20_6;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
-public class CanPlaceOnComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : StructuredComponent(dataTypes, subComponentRegistry)
+public class CanPlaceOnComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int NumberOfPredicates { get; set; }
public List BlockPredicates { get; set; } = new();
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/ChargedProjectilesComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/ChargedProjectilesComponent1206.cs
new file mode 100644
index 00000000..842af032
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/ChargedProjectilesComponent1206.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MinecraftClient.Inventory;
+using MinecraftClient.Inventory.ItemPalettes;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
+
+namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
+
+public class ChargedProjectilesComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
+{
+ public int NumberOfItems { get; set; }
+ public List
- Items { get; set; } = [];
+
+ public override void Parse(Queue data)
+ {
+ NumberOfItems = dataTypes.ReadNextVarInt(data);
+
+ for (var i = 0; i < NumberOfItems; i++)
+ Items.Add(dataTypes.ReadNextItemSlot(data, itemPalette));
+ }
+
+ public override Queue Serialize()
+ {
+ var data = new List();
+ data.AddRange(DataTypes.GetVarInt(NumberOfItems));
+
+ if (NumberOfItems != Items.Count)
+ throw new ArgumentNullException($"Cannot serialize ChargedProjectilesComponent1206 because NumberOfItems != Items.Count!");
+
+ foreach (var item in Items.OfType
- ())
+ data.AddRange(DataTypes.GetItemSlot(item, itemPalette));
+
+ return new Queue(data);
+ }
+}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CreativeSlotLockComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CreativeSlotLockComponent1206.cs
new file mode 100644
index 00000000..5d78ac1f
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CreativeSlotLockComponent1206.cs
@@ -0,0 +1,8 @@
+using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
+
+namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
+
+public class CreativeSlotLockComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : EmptyComponent(dataTypes, itemPalette, subComponentRegistry);
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CustomDataComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CustomDataComponent1206.cs
index 58732f0a..a359522b 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CustomDataComponent1206.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CustomDataComponent1206.cs
@@ -1,9 +1,11 @@
using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
-public class CustomDataComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : StructuredComponent(dataTypes, subComponentRegistry)
+public class CustomDataComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public Dictionary? Nbt { get; set; } = new();
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CustomModelDataComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CustomModelDataComponent1206.cs
index 965c4040..a734faac 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CustomModelDataComponent1206.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CustomModelDataComponent1206.cs
@@ -1,9 +1,10 @@
using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
-public class CustomModelDataComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : StructuredComponent(dataTypes, subComponentRegistry)
+public class CustomModelDataComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry) : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int Value { get; set; }
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CustomNameComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CustomNameComponent1206.cs
index 71d95001..59483d4a 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CustomNameComponent1206.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/CustomNameComponent1206.cs
@@ -1,10 +1,12 @@
using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
using MinecraftClient.Protocol.Message;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
-public class CustomNameComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : StructuredComponent(dataTypes, subComponentRegistry)
+public class CustomNameComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public string CustomName { get; set; } = string.Empty;
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/DamageComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/DamageComponent1206.cs
index 2e6bbadd..6d135ec1 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/DamageComponent1206.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/DamageComponent1206.cs
@@ -1,9 +1,11 @@
using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
-public class DamageComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : StructuredComponent(dataTypes, subComponentRegistry)
+public class DamageComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int Damage { get; set; }
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/DyeColorComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/DyeColorComponent1206.cs
new file mode 100644
index 00000000..3667cdc5
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/DyeColorComponent1206.cs
@@ -0,0 +1,26 @@
+using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
+
+namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
+
+public class DyeColorComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
+{
+ public int Color { get; set; }
+ public bool ShowInTooltip { get; set; }
+
+ public override void Parse(Queue data)
+ {
+ Color = dataTypes.ReadNextInt(data);
+ ShowInTooltip = dataTypes.ReadNextBool(data);
+ }
+
+ public override Queue Serialize()
+ {
+ var data = new List();
+ data.AddRange(DataTypes.GetInt(Color));
+ data.AddRange(DataTypes.GetBool(ShowInTooltip));
+ return new Queue(data);
+ }
+}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/EnchantmentGlintOverrideComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/EnchantmentGlintOverrideComponent1206.cs
new file mode 100644
index 00000000..a5ac05e1
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/EnchantmentGlintOverrideComponent1206.cs
@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
+
+namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
+
+public class EnchantmentGlintOverrideComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
+{
+ public int HasGlint { get; set; }
+
+ public override void Parse(Queue data)
+ {
+ HasGlint = dataTypes.ReadNextVarInt(data);
+ }
+
+ public override Queue Serialize()
+ {
+ var data = new List();
+ data.AddRange(DataTypes.GetVarInt(HasGlint));
+ return new Queue(data);
+ }
+}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/EnchantmentsComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/EnchantmentsComponent1206.cs
index be5b6e81..3e849220 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/EnchantmentsComponent1206.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/EnchantmentsComponent1206.cs
@@ -1,10 +1,12 @@
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 EnchantmentsComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : StructuredComponent(dataTypes, subComponentRegistry)
+public class EnchantmentsComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int NumberOfEnchantments { get; set; }
public List Enchantments { get; set; } = new();
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/FireResistantComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/FireResistantComponent1206.cs
new file mode 100644
index 00000000..89d4a6af
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/FireResistantComponent1206.cs
@@ -0,0 +1,7 @@
+using MinecraftClient.Inventory.ItemPalettes;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
+
+namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
+
+public class FireResistantComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : EmptyComponent(dataTypes, itemPalette, subComponentRegistry);
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/FoodComponentComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/FoodComponentComponent1206.cs
new file mode 100644
index 00000000..ad9b6fd9
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/FoodComponentComponent1206.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Components.Subcomponents;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Components.Subcomponents._1_20_6;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
+
+namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
+
+public class FoodComponentComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
+{
+ public int Nutrition { get; set; }
+ public bool Saturation { get; set; }
+ public bool CanAlwaysEat { get; set; }
+ public float SecondsToEat { get; set; }
+ public int NumberOfEffects { get; set; }
+ public List Effects { get; set; } = new();
+
+ public override void Parse(Queue data)
+ {
+ Nutrition = dataTypes.ReadNextVarInt(data);
+ Saturation = dataTypes.ReadNextBool(data);
+ CanAlwaysEat = dataTypes.ReadNextBool(data);
+ SecondsToEat = dataTypes.ReadNextFloat(data);
+ NumberOfEffects = dataTypes.ReadNextVarInt(data);
+
+ for(var i = 0; i < NumberOfEffects; i++)
+ Effects.Add((EffectSubComponent1206)subComponentRegistry.ParseSubComponent(SubComponents.Effect, data));
+ }
+
+ public override Queue Serialize()
+ {
+ var data = new List();
+ data.AddRange(DataTypes.GetVarInt(Nutrition));
+ data.AddRange(DataTypes.GetBool(Saturation));
+ data.AddRange(DataTypes.GetBool(CanAlwaysEat));
+ data.AddRange(DataTypes.GetFloat(SecondsToEat));
+ data.AddRange(DataTypes.GetFloat(NumberOfEffects));
+
+ if (NumberOfEffects > 0)
+ {
+ if(Effects.Count != NumberOfEffects)
+ throw new ArgumentNullException($"Can not serialize FoodComponent1206 due to NumberOfEffcets being different from the count of elements in the Effects list!");
+
+ foreach(var effect in Effects)
+ data.AddRange(effect.Serialize());
+ }
+
+ return new Queue(data);
+ }
+}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/HideAdditionalTooltipComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/HideAdditionalTooltipComponent1206.cs
index 1c3d5f84..d3b9df83 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/HideAdditionalTooltipComponent1206.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/HideAdditionalTooltipComponent1206.cs
@@ -1,5 +1,7 @@
+using MinecraftClient.Inventory.ItemPalettes;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
-public class HideAdditionalTooltipComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : EmptyComponent(dataTypes, subComponentRegistry);
\ No newline at end of file
+public class HideAdditionalTooltipComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : EmptyComponent(dataTypes, itemPalette, subComponentRegistry);
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/HideTooltipComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/HideTooltipComponent1206.cs
index c93fa8f9..a7b23fb8 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/HideTooltipComponent1206.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/HideTooltipComponent1206.cs
@@ -1,5 +1,7 @@
+using MinecraftClient.Inventory.ItemPalettes;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
-public class HideTooltipComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : EmptyComponent(dataTypes, subComponentRegistry);
\ No newline at end of file
+public class HideTooltipComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : EmptyComponent(dataTypes, itemPalette, subComponentRegistry);
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/IntangibleProjectileComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/IntangibleProjectileComponent1206.cs
new file mode 100644
index 00000000..e9f94396
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/IntangibleProjectileComponent1206.cs
@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
+
+namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
+
+public class IntangibleProjectileComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
+{
+ public Dictionary? Nbt { get; set; } = new();
+
+ public override void Parse(Queue data)
+ {
+ Nbt = dataTypes.ReadNextNbt(data);
+ }
+
+ public override Queue Serialize()
+ {
+ var data = new List();
+ data.AddRange(DataTypes.GetNbt(Nbt));
+ return new Queue(data);
+ }
+}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/ItemNameComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/ItemNameComponent1206.cs
index 16107244..3cb8af44 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/ItemNameComponent1206.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/ItemNameComponent1206.cs
@@ -1,10 +1,12 @@
using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
using MinecraftClient.Protocol.Message;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
-public class ItemNameComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : StructuredComponent(dataTypes, subComponentRegistry)
+public class ItemNameComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public string ItemName { get; set; } = string.Empty;
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/LoreComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/LoreComponent1206.cs
index 5a88e04b..8aa711ef 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/LoreComponent1206.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/LoreComponent1206.cs
@@ -1,10 +1,12 @@
using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
using MinecraftClient.Protocol.Message;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
-public class LoreNameComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : StructuredComponent(dataTypes, subComponentRegistry)
+public class LoreNameComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int NumberOfLines { get; set; }
public List Lines { get; set; } = [];
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MapColorComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MapColorComponent1206.cs
new file mode 100644
index 00000000..17f84f6b
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MapColorComponent1206.cs
@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
+
+namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
+
+public class MapColorComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
+{
+ public int Id { get; set; }
+
+ public override void Parse(Queue data)
+ {
+ Id = dataTypes.ReadNextInt(data);
+ }
+
+ public override Queue Serialize()
+ {
+ var data = new List();
+ data.AddRange(DataTypes.GetInt(Id));
+ return new Queue(data);
+ }
+}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MapDecorationsComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MapDecorationsComponent1206.cs
new file mode 100644
index 00000000..9111f5b6
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MapDecorationsComponent1206.cs
@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
+
+namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
+
+public class MapDecorationsComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
+{
+ public Dictionary? Nbt { get; set; } = new();
+
+ public override void Parse(Queue data)
+ {
+ Nbt = dataTypes.ReadNextNbt(data);
+ }
+
+ public override Queue Serialize()
+ {
+ var data = new List();
+ data.AddRange(DataTypes.GetNbt(Nbt));
+ return new Queue(data);
+ }
+}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MapIdComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MapIdComponent1206.cs
new file mode 100644
index 00000000..283cf024
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MapIdComponent1206.cs
@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
+
+namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
+
+public class MapIdComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
+{
+ public int Id { get; set; }
+
+ public override void Parse(Queue data)
+ {
+ Id = dataTypes.ReadNextVarInt(data);
+ }
+
+ public override Queue Serialize()
+ {
+ var data = new List();
+ data.AddRange(DataTypes.GetVarInt(Id));
+ return new Queue(data);
+ }
+}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MapPostProcessingComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MapPostProcessingComponent1206.cs
new file mode 100644
index 00000000..c9abbca1
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MapPostProcessingComponent1206.cs
@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
+
+namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
+
+public class MapPostProcessingComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
+{
+ public int Type { get; set; }
+
+ public override void Parse(Queue data)
+ {
+ Type = dataTypes.ReadNextVarInt(data);
+ }
+
+ public override Queue Serialize()
+ {
+ var data = new List();
+ data.AddRange(DataTypes.GetVarInt(Type));
+ return new Queue(data);
+ }
+}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MaxDamageComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MaxDamageComponent1206.cs
index c3890dfb..abdd483f 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MaxDamageComponent1206.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MaxDamageComponent1206.cs
@@ -1,9 +1,11 @@
using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
-public class MaxDamageComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : StructuredComponent(dataTypes, subComponentRegistry)
+public class MaxDamageComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int MaxDamage { get; set; }
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MaxStackSizeComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MaxStackSizeComponent1206.cs
index de210a2b..ec598351 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MaxStackSizeComponent1206.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/MaxStackSizeComponent1206.cs
@@ -1,9 +1,11 @@
using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
-public class MaxStackSizeComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : StructuredComponent(dataTypes, subComponentRegistry)
+public class MaxStackSizeComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int MaxStackSize { get; set; }
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/PotionContentsComponentComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/PotionContentsComponentComponent1206.cs
new file mode 100644
index 00000000..e8a28d65
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/PotionContentsComponentComponent1206.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Components.Subcomponents;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Components.Subcomponents._1_20_6;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
+
+namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
+
+public class PotionContentsComponentComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
+{
+ public int PotiononId { get; set; }
+ public bool HasCustomColor { get; set; }
+ public int CustomColor { get; set; }
+ public int NumberOfCustomEffects { get; set; }
+ public List Effects { get; set; } = new();
+
+ public override void Parse(Queue data)
+ {
+ PotiononId = dataTypes.ReadNextVarInt(data);
+ HasCustomColor = dataTypes.ReadNextBool(data);
+ CustomColor = dataTypes.ReadNextInt(data);
+ NumberOfCustomEffects = dataTypes.ReadNextVarInt(data);
+
+ for(var i = 0; i < NumberOfCustomEffects; i++)
+ Effects.Add((PotionEffectSubComponent1206)subComponentRegistry.ParseSubComponent(SubComponents.PotionEffect, data));
+ }
+
+ public override Queue Serialize()
+ {
+ var data = new List();
+ data.AddRange(DataTypes.GetVarInt(PotiononId));
+ data.AddRange(DataTypes.GetBool(HasCustomColor));
+ data.AddRange(DataTypes.GetInt(CustomColor));
+
+ if (NumberOfCustomEffects > 0)
+ {
+ if(Effects.Count != NumberOfCustomEffects)
+ throw new ArgumentNullException($"Can not serialize PotionContentsComponentComponent1206 due to NumberOfCustomEffects being different from the count of elements in the Effects list!");
+
+ foreach(var effect in Effects)
+ data.AddRange(effect.Serialize());
+ }
+
+ return new Queue(data);
+ }
+}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/RarityComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/RarityComponent1206.cs
index f14b6d4d..100072c9 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/RarityComponent1206.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/RarityComponent1206.cs
@@ -1,10 +1,12 @@
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 RarityComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : StructuredComponent(dataTypes, subComponentRegistry)
+public class RarityComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public ItemRarity Rarity { get; set; }
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/RepairCostComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/RepairCostComponent1206.cs
new file mode 100644
index 00000000..e4153617
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/RepairCostComponent1206.cs
@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
+
+namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
+
+public class RepairCostComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
+{
+ public int Cost { get; set; }
+
+ public override void Parse(Queue data)
+ {
+ Cost = dataTypes.ReadNextVarInt(data);
+ }
+
+ public override Queue Serialize()
+ {
+ var data = new List();
+ data.AddRange(DataTypes.GetVarInt(Cost));
+ return new Queue(data);
+ }
+}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/StoredEnchantmentsComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/StoredEnchantmentsComponent1206.cs
new file mode 100644
index 00000000..05f5e2d8
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/StoredEnchantmentsComponent1206.cs
@@ -0,0 +1,9 @@
+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 StoredEnchantmentsComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : EnchantmentsComponent1206(dataTypes, itemPalette, subComponentRegistry);
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/ToolComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/ToolComponent1206.cs
new file mode 100644
index 00000000..6a04585b
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/ToolComponent1206.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Components.Subcomponents;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Components.Subcomponents._1_20_6;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
+
+namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
+
+public class ToolComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
+{
+ public int NumberOfRules { get; set; }
+ public List Rules { get; set; } = new();
+ public float DefaultMiningSpeed { get; set; }
+ public int DamagePerBlock { get; set; }
+
+ public override void Parse(Queue data)
+ {
+ NumberOfRules = dataTypes.ReadNextVarInt(data);
+
+ for (var i = 0; i < NumberOfRules; i++)
+ Rules.Add((RuleSubComponent1206)subComponentRegistry.ParseSubComponent(SubComponents.Rule, data));
+
+ DefaultMiningSpeed = dataTypes.ReadNextFloat(data);
+ DamagePerBlock = dataTypes.ReadNextVarInt(data);
+ }
+
+ public override Queue Serialize()
+ {
+ var data = new List();
+ data.AddRange(DataTypes.GetVarInt(NumberOfRules));
+
+ if(Rules.Count != NumberOfRules)
+ throw new ArgumentNullException($"Can not serialize a ToolComponent1206 when the Rules count != NumberOfRules!");
+
+ foreach (var rule in Rules)
+ data.AddRange(rule.Serialize());
+
+ data.AddRange(DataTypes.GetFloat(DefaultMiningSpeed));
+ data.AddRange(DataTypes.GetVarInt(DamagePerBlock));
+ return new Queue(data);
+ }
+}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/UnbreakableComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/UnbreakableComponent1206.cs
index a3dfd786..39c19014 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/UnbreakableComponent1206.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/UnbreakableComponent1206.cs
@@ -1,9 +1,11 @@
using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
-public class UnbrekableComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : StructuredComponent(dataTypes, subComponentRegistry)
+public class UnbrekableComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public bool Unbrekable { get; set; }
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/EmptyComponent.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/EmptyComponent.cs
index 0cc40762..8b49c908 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/EmptyComponent.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/EmptyComponent.cs
@@ -1,9 +1,10 @@
using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components;
-public class EmptyComponent(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : StructuredComponent(dataTypes, subComponentRegistry)
+public class EmptyComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry) : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public override void Parse(Queue data)
{
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/Subcomponents/1_20_6/DetailsSubComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/Subcomponents/1_20_6/DetailsSubComponent1206.cs
new file mode 100644
index 00000000..289d432c
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/Subcomponents/1_20_6/DetailsSubComponent1206.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
+
+namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components.Subcomponents._1_20_6;
+
+public class DetailsSubComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : SubComponent(dataTypes, subComponentRegistry)
+{
+ public int Amplifier { get; set; }
+ public int Duration { get; set; }
+ public bool Ambient { get; set; }
+ public bool ShowParticles { get; set; }
+ public bool ShowIcon { get; set; }
+ public bool HasHiddenEffects { get; set; }
+ public DetailsSubComponent1206? Detail { get; set; }
+
+ protected override void Parse(Queue data)
+ {
+ Amplifier = dataTypes.ReadNextVarInt(data);
+ Duration = dataTypes.ReadNextVarInt(data);
+ Ambient = dataTypes.ReadNextBool(data);
+ ShowParticles = dataTypes.ReadNextBool(data);
+ ShowIcon = dataTypes.ReadNextBool(data);
+ HasHiddenEffects = dataTypes.ReadNextBool(data);
+
+ if(HasHiddenEffects)
+ Detail = (DetailsSubComponent1206)subComponentRegistry.ParseSubComponent(SubComponents.Details, data);
+ }
+
+ public override Queue Serialize()
+ {
+ var data = new List();
+ data.AddRange(DataTypes.GetVarInt(Amplifier));
+ data.AddRange(DataTypes.GetVarInt(Duration));
+ data.AddRange(DataTypes.GetBool(Ambient));
+ data.AddRange(DataTypes.GetBool(ShowParticles));
+ data.AddRange(DataTypes.GetBool(ShowIcon));
+ data.AddRange(DataTypes.GetBool(HasHiddenEffects));
+
+ if (HasHiddenEffects)
+ {
+ if(Detail is null)
+ throw new ArgumentNullException($"Can not serialize a DetailSubComponent1206 when the Detail is empty but HasHiddenEffects is true!");
+
+ data.AddRange(Detail.Serialize());
+ }
+
+ return new Queue(data);
+ }
+}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/Subcomponents/1_20_6/EffectSubComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/Subcomponents/1_20_6/EffectSubComponent1206.cs
new file mode 100644
index 00000000..b7cd1117
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/Subcomponents/1_20_6/EffectSubComponent1206.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
+
+namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components.Subcomponents._1_20_6;
+
+public class EffectSubComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : SubComponent(dataTypes, subComponentRegistry)
+{
+ public PotionEffectSubComponent1206 TypeId { get; set; }
+ public float Probability { get; set; }
+
+ protected override void Parse(Queue data)
+ {
+ TypeId = (PotionEffectSubComponent1206)subComponentRegistry.ParseSubComponent(SubComponents.PotionEffect, data);
+ Probability = dataTypes.ReadNextFloat(data);
+ }
+
+ public override Queue Serialize()
+ {
+ var data = new List();
+ data.AddRange(TypeId.Serialize());
+ data.AddRange(DataTypes.GetFloat(Probability));
+ return new Queue(data);
+ }
+}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/Subcomponents/1_20_6/PotionEffectSubComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/Subcomponents/1_20_6/PotionEffectSubComponent1206.cs
new file mode 100644
index 00000000..c325e313
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/Subcomponents/1_20_6/PotionEffectSubComponent1206.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
+
+namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components.Subcomponents._1_20_6;
+
+public class PotionEffectSubComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : SubComponent(dataTypes, subComponentRegistry)
+{
+ public int TypeId { get; set; }
+ public DetailsSubComponent1206 Details { get; set; }
+
+ protected override void Parse(Queue data)
+ {
+ TypeId = dataTypes.ReadNextVarInt(data);
+ Details = (DetailsSubComponent1206)subComponentRegistry.ParseSubComponent(SubComponents.Details, data);
+ }
+
+ public override Queue Serialize()
+ {
+ var data = new List();
+ data.AddRange(DataTypes.GetVarInt(TypeId));
+ data.AddRange(Details.Serialize());
+ return new Queue(data);
+ }
+}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/Subcomponents/1_20_6/RuleSubComponent1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/Subcomponents/1_20_6/RuleSubComponent1206.cs
new file mode 100644
index 00000000..e5830f4d
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/Subcomponents/1_20_6/RuleSubComponent1206.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
+
+namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components.Subcomponents._1_20_6;
+
+public class RuleSubComponent1206(DataTypes dataTypes, SubComponentRegistry subComponentRegistry) : SubComponent(dataTypes, subComponentRegistry)
+{
+ public BlockSetSubcomponent1206 Blocks { get; set; }
+ public bool HasSpeed { get; set; }
+ public float Speed { get; set; }
+ public bool HasCorrectDropForBlocks { get; set; }
+ public bool CorrectDropForBlocks { get; set; }
+
+ protected override void Parse(Queue data)
+ {
+ Blocks = (BlockSetSubcomponent1206)subComponentRegistry.ParseSubComponent(SubComponents.BlockSet, data);
+ HasSpeed = dataTypes.ReadNextBool(data);
+
+ if(HasSpeed)
+ Speed = dataTypes.ReadNextFloat(data);
+
+ HasCorrectDropForBlocks = dataTypes.ReadNextBool(data);
+
+ if(HasCorrectDropForBlocks)
+ CorrectDropForBlocks = dataTypes.ReadNextBool(data);
+ }
+
+ public override Queue Serialize()
+ {
+ var data = new List();
+ data.AddRange(Blocks.Serialize());
+ data.AddRange(DataTypes.GetBool(HasSpeed));
+ if(HasSpeed)
+ data.AddRange(DataTypes.GetFloat(Speed));
+
+ data.AddRange(DataTypes.GetBool(HasCorrectDropForBlocks));
+ if(HasCorrectDropForBlocks)
+ data.AddRange(DataTypes.GetBool(CorrectDropForBlocks));
+
+ return new Queue(data);
+ }
+}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/Subcomponents/SubComponents.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/Subcomponents/SubComponents.cs
index 9de0e9ad..1c4e8d8d 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/Subcomponents/SubComponents.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/Subcomponents/SubComponents.cs
@@ -6,4 +6,8 @@ public class SubComponents
public const string BlockSet = "BlockSet";
public const string Property = "Property";
public const string Attribute = "Attribute";
+ public const string Effect = "Effect";
+ public const string PotionEffect = "PotionEffect";
+ public const string Details = "Details";
+ public const string Rule = "Rule";
}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Core/StructuredComponent.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Core/StructuredComponent.cs
index 01995dc2..7465740b 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Core/StructuredComponent.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Core/StructuredComponent.cs
@@ -1,11 +1,13 @@
using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
-public abstract class StructuredComponent(DataTypes dataTypes, SubComponentRegistry subComponentRegistry)
+public abstract class StructuredComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
{
protected DataTypes DataTypes { get; private set; } = dataTypes;
protected SubComponentRegistry SubComponentRegistry { get; private set; } = subComponentRegistry;
+ protected ItemPalette ItemPalette { get; private set; } = itemPalette;
public abstract void Parse(Queue data);
public abstract Queue Serialize();
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Core/StructuredComponentRegistry.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Core/StructuredComponentRegistry.cs
index 4dffe457..11c48e1f 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Core/StructuredComponentRegistry.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Core/StructuredComponentRegistry.cs
@@ -1,9 +1,10 @@
using System;
using System.Collections.Generic;
+using MinecraftClient.Inventory.ItemPalettes;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
-public abstract class StructuredComponentRegistry(SubComponentRegistry subComponentRegistry, DataTypes dataTypes)
+public abstract class StructuredComponentRegistry(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
{
private Dictionary ComponentParsers { get; } = new();
private Dictionary IdToComponent { get; } = new();
@@ -32,7 +33,7 @@ public abstract class StructuredComponentRegistry(SubComponentRegistry subCompon
if (ComponentParsers.TryGetValue(name, out var type))
{
var component =
- Activator.CreateInstance(type, dataTypes, subComponentRegistry) as StructuredComponent
+ Activator.CreateInstance(type, dataTypes, itemPalette, subComponentRegistry) as StructuredComponent
?? throw new InvalidOperationException($"Could not instantiate a parser for a structured component type {name}");
component.Parse(data);
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Registries/StructuredComponentsRegistry1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Registries/StructuredComponentsRegistry1206.cs
index da70c454..586f8870 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Registries/StructuredComponentsRegistry1206.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Registries/StructuredComponentsRegistry1206.cs
@@ -1,3 +1,4 @@
+using MinecraftClient.Inventory.ItemPalettes;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
@@ -5,8 +6,8 @@ namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Registries;
public class StructuredComponentsRegistry1206 : StructuredComponentRegistry
{
- public StructuredComponentsRegistry1206(SubComponentRegistry subComponentRegistry, DataTypes dataTypes) : base(
- subComponentRegistry, dataTypes)
+ public StructuredComponentsRegistry1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
+ : base(dataTypes, itemPalette, subComponentRegistry)
{
RegisterComponent(0, "minecraft:custom_data");
RegisterComponent(1, "minecraft:max_stack_size");
@@ -24,5 +25,22 @@ public class StructuredComponentsRegistry1206 : StructuredComponentRegistry
RegisterComponent(13, "minecraft:custom_model_data");
RegisterComponent(14, "minecraft:hide_additional_tooltip");
RegisterComponent(15, "minecraft:hide_tooltip");
+ RegisterComponent(16, "minecraft:repair_cost");
+ RegisterComponent(17, "minecraft:creative_slot_lock");
+ RegisterComponent(18, "minecraft:enchantment_glint_override");
+ RegisterComponent(19, "minecraft:intangible_projectile");
+ RegisterComponent(20, "minecraft:food");
+ RegisterComponent(21, "minecraft:fire_resistant");
+ RegisterComponent(22, "minecraft:tool");
+ RegisterComponent(23, "minecraft:stored_enchantments");
+ RegisterComponent(24, "minecraft:dyed_color");
+ RegisterComponent(25, "minecraft:map_color");
+ RegisterComponent(26, "minecraft:map_id");
+ RegisterComponent(27, "minecraft:map_decorations");
+ RegisterComponent(28, "minecraft:map_post_processing");
+ RegisterComponent(29, "minecraft:charged_projectiles");
+ RegisterComponent(30, "minecraft:bundle_contents");
+ RegisterComponent(31, "minecraft:potion_contents");
+
}
}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/Registries/Subcomponents/SubComponentRegistry1206.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/Registries/Subcomponents/SubComponentRegistry1206.cs
index b2428185..91fa60ea 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/Registries/Subcomponents/SubComponentRegistry1206.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/Registries/Subcomponents/SubComponentRegistry1206.cs
@@ -12,5 +12,9 @@ public class SubComponentRegistry1206 : SubComponentRegistry
RegisterSubComponent(SubComponents.BlockSet);
RegisterSubComponent(SubComponents.Property);
RegisterSubComponent(SubComponents.Attribute);
+ RegisterSubComponent(SubComponents.Effect);
+ RegisterSubComponent(SubComponents.PotionEffect);
+ RegisterSubComponent(SubComponents.Details);
+ RegisterSubComponent(SubComponents.Rule);
}
}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/StructuredComponents/StructuredComponentsHandler.cs b/MinecraftClient/Protocol/Handlers/StructuredComponents/StructuredComponentsHandler.cs
index f22405b1..95502463 100644
--- a/MinecraftClient/Protocol/Handlers/StructuredComponents/StructuredComponentsHandler.cs
+++ b/MinecraftClient/Protocol/Handlers/StructuredComponents/StructuredComponentsHandler.cs
@@ -13,7 +13,8 @@ public class StructuredComponentsHandler
public StructuredComponentsHandler(
int protocolVersion,
- DataTypes dataTypes)
+ DataTypes dataTypes,
+ ItemPalette itemPalette)
{
// Get the appropriate subcomponent registry type based on the protocol version and then instantiate it
var subcomponentRegistryType = protocolVersion switch
@@ -32,7 +33,7 @@ public class StructuredComponentsHandler
_ => throw new NotSupportedException($"Protocol version {protocolVersion} is not supported for structured component registries!")
};
- ComponentRegistry = Activator.CreateInstance(registryType, subcomponentRegistry, dataTypes) as StructuredComponentRegistry
+ ComponentRegistry = Activator.CreateInstance(registryType, dataTypes, itemPalette, subcomponentRegistry) as StructuredComponentRegistry
?? throw new InvalidOperationException($"Failed to instantiate a component registry for type {nameof(registryType)}");
}