Formatted the code and removed logs from Auto Attack

This commit is contained in:
Anon 2026-06-04 11:42:41 +02:00
parent a4ff7ae438
commit c6ca3dc13d
117 changed files with 602 additions and 585 deletions

View file

@ -6,13 +6,13 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class AttributeModifiersComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class AttributeModifiersComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int NumberOfAttributes { get; set; }
public List<SubComponent> Attributes { get; set; } = new();
public bool ShowInTooltip { get; set; }
public override void Parse(Queue<byte> data)
{
NumberOfAttributes = DataTypes.ReadNextVarInt(data);
@ -27,13 +27,13 @@ public class AttributeModifiersComponent(DataTypes dataTypes, ItemPalette itemPa
{
var data = new List<byte>();
data.AddRange(DataTypes.GetVarInt(NumberOfAttributes));
if(Attributes.Count != NumberOfAttributes)
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());
data.AddRange(DataTypes.GetBool(ShowInTooltip));
return new Queue<byte>(data);
}

View file

@ -5,12 +5,12 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class BannerPatternsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class BannerPatternsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int NumberOfLayers { get; set; }
public List<BannerLayer> Layers { get; set; } = [];
public override void Parse(Queue<byte> data)
{
NumberOfLayers = DataTypes.ReadNextVarInt(data);
@ -44,17 +44,17 @@ public class BannerPatternsComponent(DataTypes dataTypes, ItemPalette itemPalett
if (bannerLayer.PatternType == 0)
{
if(string.IsNullOrEmpty(bannerLayer.AssetId) || string.IsNullOrEmpty(bannerLayer.TranslationKey))
if (string.IsNullOrEmpty(bannerLayer.AssetId) || string.IsNullOrEmpty(bannerLayer.TranslationKey))
throw new Exception("Can't serialize BannerPatternsComponent because AssetId or TranslationKey is null/empty!");
data.AddRange(DataTypes.GetString(bannerLayer.AssetId));
data.AddRange(DataTypes.GetString(bannerLayer.TranslationKey));
}
data.AddRange(DataTypes.GetVarInt(bannerLayer.DyeColor));
}
}
return new Queue<byte>(data);
}
}

View file

@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class BaseColorComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class BaseColorComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int DyeColor { get; set; }
public override void Parse(Queue<byte> data)
{
DyeColor = DataTypes.ReadNextVarInt(data);

View file

@ -6,12 +6,12 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class BeesComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class BeesComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int NumberOfBees { get; set; }
public List<Bee> Bees { get; set; } = [];
public override void Parse(Queue<byte> data)
{
NumberOfBees = DataTypes.ReadNextVarInt(data);
@ -30,7 +30,7 @@ public class BeesComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComp
{
if (NumberOfBees != Bees.Count)
throw new Exception("Can't serialize the BeeComponent because NumberOfBees and Bees.Count differ!");
foreach (var bee in Bees)
{
data.AddRange(DataTypes.GetNbt(bee.EntityDataNbt));

View file

@ -4,15 +4,15 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class BlockStateComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class BlockStateComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public List<(string, string)> Properties { get; set; } = [];
public override void Parse(Queue<byte> data)
{
var count = DataTypes.ReadNextVarInt(data);
for(var i = 0; i < count; i++)
for (var i = 0; i < count; i++)
Properties.Add((DataTypes.ReadNextString(data), DataTypes.ReadNextString(data)));
}
@ -25,7 +25,7 @@ public class BlockStateComponent(DataTypes dataTypes, ItemPalette itemPalette, S
data.AddRange(DataTypes.GetString(key));
data.AddRange(DataTypes.GetString(value));
}
return new Queue<byte>(data);
}
}

View file

@ -5,7 +5,7 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class BundleContentsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class BundleContentsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public List<Item> Items { get; set; } = [];

View file

@ -7,13 +7,13 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class CanBreakComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class CanBreakComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int NumberOfPredicates { get; set; }
public List<BlockPredicateSubcomponent> BlockPredicates { get; set; } = new();
public bool ShowInTooltip { get; set; }
public override void Parse(Queue<byte> data)
{
NumberOfPredicates = DataTypes.ReadNextVarInt(data);
@ -28,13 +28,13 @@ public class CanBreakComponent(DataTypes dataTypes, ItemPalette itemPalette, Sub
{
var data = new List<byte>();
data.AddRange(DataTypes.GetVarInt(NumberOfPredicates));
if(NumberOfPredicates > 0 && BlockPredicates.Count == 0)
if (NumberOfPredicates > 0 && BlockPredicates.Count == 0)
throw new ArgumentNullException($"Can not serialize a CanBreakComponent when the BlockPredicates is empty but NumberOfPredicates is > 0!");
foreach (var blockPredicate in BlockPredicates)
data.AddRange(blockPredicate.Serialize());
data.AddRange(DataTypes.GetBool(ShowInTooltip));
return new Queue<byte>(data);
}

View file

@ -7,13 +7,13 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class CanPlaceOnComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class CanPlaceOnComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int NumberOfPredicates { get; set; }
public List<BlockPredicateSubcomponent> BlockPredicates { get; set; } = new();
public bool ShowInTooltip { get; set; }
public override void Parse(Queue<byte> data)
{
NumberOfPredicates = DataTypes.ReadNextVarInt(data);
@ -28,13 +28,13 @@ public class CanPlaceOnComponent(DataTypes dataTypes, ItemPalette itemPalette, S
{
var data = new List<byte>();
data.AddRange(DataTypes.GetVarInt(NumberOfPredicates));
if(NumberOfPredicates > 0 && BlockPredicates.Count == 0)
if (NumberOfPredicates > 0 && BlockPredicates.Count == 0)
throw new ArgumentNullException($"Can not serialize a CanPlaceOnComponent when the BlockPredicates is empty but NumberOfPredicates is > 0!");
foreach (var blockPredicate in BlockPredicates)
data.AddRange(blockPredicate.Serialize());
data.AddRange(DataTypes.GetBool(ShowInTooltip));
return new Queue<byte>(data);
}

View file

@ -5,7 +5,7 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class ChargedProjectilesComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class ChargedProjectilesComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public List<Item> Items { get; set; } = [];

View file

@ -5,11 +5,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class ContainerComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
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);
@ -23,7 +23,7 @@ public class ContainerComponent(DataTypes dataTypes, ItemPalette itemPalette, Su
data.AddRange(DataTypes.GetVarInt(Items.Count));
foreach (var item in Items)
data.AddRange(DataTypes.GetItemSlot(item, ItemPalette));
return new Queue<byte>(data);
}
}

View file

@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class ContainerLootComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class ContainerLootComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public Dictionary<string, object>? Nbt { get; set; }
public override void Parse(Queue<byte> data)
{
Nbt = DataTypes.ReadNextNbt(data);

View file

@ -4,5 +4,5 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class CreativeSlotLockComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class CreativeSlotLockComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: EmptyComponent(dataTypes, itemPalette, subComponentRegistry);

View file

@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class CustomDataComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class CustomDataComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public Dictionary<string, object>? Nbt { get; set; } = new();
public override void Parse(Queue<byte> data)
{
Nbt = DataTypes.ReadNextNbt(data);

View file

@ -10,7 +10,7 @@ public class CustomModelDataComponent(DataTypes dataTypes, ItemPalette itemPalet
public List<bool> Flags { get; set; } = [];
public List<string> Strings { get; set; } = [];
public List<int> Colors { get; set; } = [];
public override void Parse(Queue<byte> data)
{
Floats = ReadList(data, static (dataTypes, componentData) => dataTypes.ReadNextFloat(componentData));

View file

@ -5,12 +5,12 @@ using MinecraftClient.Protocol.Message;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class CustomNameComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class CustomNameComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public string CustomName { get; set; } = string.Empty;
public Dictionary<string, object>? CustomNameNbt { get; set; }
public override void Parse(Queue<byte> data)
{
CustomNameNbt = DataTypes.ReadNextNbt(data);

View file

@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class DamageComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class DamageComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int Damage { get; set; }
public override void Parse(Queue<byte> data)
{
Damage = DataTypes.ReadNextVarInt(data);

View file

@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class DebugStickStateComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class DebugStickStateComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public Dictionary<string, object>? Nbt { get; set; }
public override void Parse(Queue<byte> data)
{
Nbt = DataTypes.ReadNextNbt(data);

View file

@ -4,12 +4,12 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class DyeColorComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class DyeColorComponent(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<byte> data)
{
Color = DataTypes.ReadNextInt(data);

View file

@ -8,7 +8,7 @@ public class EnchantmentGlintOverrideComponent(DataTypes dataTypes, ItemPalette
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public bool HasGlint { get; set; }
public override void Parse(Queue<byte> data)
{
HasGlint = DataTypes.ReadNextBool(data);

View file

@ -5,7 +5,7 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class EnchantmentsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class EnchantmentsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int NumberOfEnchantments { get; set; }

View file

@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class EntityDataComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class EntityDataComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public Dictionary<string, object>? Nbt { get; set; }
public override void Parse(Queue<byte> data)
{
Nbt = DataTypes.ReadNextNbt(data);
@ -22,8 +22,10 @@ public class EntityDataComponent(DataTypes dataTypes, ItemPalette itemPalette, S
}
}
public class BucketEntityDataComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: EntityDataComponent(dataTypes, itemPalette, subComponentRegistry) {}
public class BucketEntityDataComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: EntityDataComponent(dataTypes, itemPalette, subComponentRegistry)
{ }
public class BlockEntityDataComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: EntityDataComponent(dataTypes, itemPalette, subComponentRegistry) {}
public class BlockEntityDataComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: EntityDataComponent(dataTypes, itemPalette, subComponentRegistry)
{ }

View file

@ -3,5 +3,5 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class FireResistantComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class FireResistantComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: EmptyComponent(dataTypes, itemPalette, subComponentRegistry);

View file

@ -8,11 +8,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class FireworkExplosionComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class FireworkExplosionComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public FireworkExplosionSubComponent? FireworkExplosionSubComponent { get; set; }
public override void Parse(Queue<byte> data)
{
FireworkExplosionSubComponent = (FireworkExplosionSubComponent)SubComponentRegistry.ParseSubComponent(SubComponents.FireworkExplosion, data);

View file

@ -9,14 +9,14 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class FireworksComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class FireworksComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int FlightDuration { get; set; }
public int NumberOfExplosions { get; set; }
public List<FireworkExplosionSubComponent> Explosions { get; set; } = [];
public override void Parse(Queue<byte> data)
{
FlightDuration = DataTypes.ReadNextVarInt(data);
@ -24,7 +24,7 @@ public class FireworksComponent(DataTypes dataTypes, ItemPalette itemPalette, Su
if (NumberOfExplosions > 0)
{
for(var i = 0; i < NumberOfExplosions; i++)
for (var i = 0; i < NumberOfExplosions; i++)
Explosions.Add(
(FireworkExplosionSubComponent)SubComponentRegistry.ParseSubComponent(SubComponents.FireworkExplosion,
data));
@ -40,8 +40,8 @@ public class FireworksComponent(DataTypes dataTypes, ItemPalette itemPalette, Su
{
if (NumberOfExplosions != Explosions.Count)
throw new Exception("Can't serialize FireworksComponent because NumberOfExplosions and the lenght of Explosions differ!");
foreach(var explosion in Explosions)
foreach (var explosion in Explosions)
data.AddRange(explosion.Serialize().ToList());
}
return new Queue<byte>(data);

View file

@ -7,7 +7,7 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class FoodComponentComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class FoodComponentComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int Nutrition { get; set; }
@ -15,7 +15,7 @@ public class FoodComponentComponent(DataTypes dataTypes, ItemPalette itemPalette
public bool CanAlwaysEat { get; set; }
public float SecondsToEat { get; set; }
public List<EffectSubComponent> Effects { get; set; } = new();
public override void Parse(Queue<byte> data)
{
Nutrition = DataTypes.ReadNextVarInt(data);
@ -23,8 +23,8 @@ public class FoodComponentComponent(DataTypes dataTypes, ItemPalette itemPalette
CanAlwaysEat = DataTypes.ReadNextBool(data);
SecondsToEat = DataTypes.ReadNextFloat(data);
var numberOfEffects = DataTypes.ReadNextVarInt(data);
for(var i = 0; i < numberOfEffects; i++)
for (var i = 0; i < numberOfEffects; i++)
Effects.Add((EffectSubComponent)SubComponentRegistry.ParseSubComponent(SubComponents.Effect, data));
}
@ -37,9 +37,9 @@ public class FoodComponentComponent(DataTypes dataTypes, ItemPalette itemPalette
data.AddRange(DataTypes.GetFloat(SecondsToEat));
data.AddRange(DataTypes.GetVarInt(Effects.Count));
foreach(var effect in Effects)
foreach (var effect in Effects)
data.AddRange(effect.Serialize());
return new Queue<byte>(data);
}
}

View file

@ -3,5 +3,5 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class HideAdditionalTooltipComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class HideAdditionalTooltipComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: EmptyComponent(dataTypes, itemPalette, subComponentRegistry);

View file

@ -3,5 +3,5 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class HideTooltipComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class HideTooltipComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: EmptyComponent(dataTypes, itemPalette, subComponentRegistry);

View file

@ -4,7 +4,7 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class InstrumentComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class InstrumentComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
// holder ID: 0 = inline instrument data, N>0 = registry reference (id = N-1)
@ -20,7 +20,7 @@ public class InstrumentComponent(DataTypes dataTypes, ItemPalette itemPalette, S
public int UseDuration { get; set; }
public float Range { get; set; }
public override void Parse(Queue<byte> data)
{
InstrumentHolderId = DataTypes.ReadNextVarInt(data);

View file

@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class IntangibleProjectileComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class IntangibleProjectileComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public Dictionary<string, object>? Nbt { get; set; } = new();
public override void Parse(Queue<byte> data)
{
Nbt = DataTypes.ReadNextNbt(data);

View file

@ -5,12 +5,12 @@ using MinecraftClient.Protocol.Message;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class ItemNameComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class ItemNameComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public string ItemName { get; set; } = string.Empty;
public Dictionary<string, object>? ItemNameNbt { get; set; }
public override void Parse(Queue<byte> data)
{
ItemNameNbt = DataTypes.ReadNextNbt(data);

View file

@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class LockComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class LockComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public Dictionary<string, object>? Nbt { get; set; }
public override void Parse(Queue<byte> data)
{
Nbt = DataTypes.ReadNextNbt(data);

View file

@ -5,14 +5,14 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class LodestoneTrackerComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class LodestoneTrackerComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public bool HasGlobalPosition { get; set; }
public string Dimension { get; set; } = null!;
public Location Position { get; set; }
public bool Tracked { get; set; }
public override void Parse(Queue<byte> data)
{
HasGlobalPosition = DataTypes.ReadNextBool(data);
@ -22,7 +22,7 @@ public class LodestoneTrackerComponent(DataTypes dataTypes, ItemPalette itemPale
Dimension = DataTypes.ReadNextString(data);
Position = DataTypes.ReadNextLocation(data);
}
Tracked = DataTypes.ReadNextBool(data);
}
@ -36,7 +36,7 @@ public class LodestoneTrackerComponent(DataTypes dataTypes, ItemPalette itemPale
data.AddRange(DataTypes.GetString(Dimension));
data.AddRange(DataTypes.GetLocation(Position));
}
data.AddRange(DataTypes.GetBool(Tracked));
return new Queue<byte>(data);
}

View file

@ -5,19 +5,19 @@ using MinecraftClient.Protocol.Message;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class LoreNameComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class LoreNameComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int NumberOfLines { get; set; }
public List<string> Lines { get; set; } = [];
public List<Dictionary<string, object>> LinesNbt { get; set; } = [];
public override void Parse(Queue<byte> data)
{
NumberOfLines = DataTypes.ReadNextVarInt(data);
if (NumberOfLines <= 0) return;
for (var i = 0; i < NumberOfLines; i++)
{
var lineNbt = DataTypes.ReadNextNbt(data);

View file

@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class MapColorComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class MapColorComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int Id { get; set; }
public override void Parse(Queue<byte> data)
{
Id = DataTypes.ReadNextInt(data);

View file

@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class MapDecorationsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class MapDecorationsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public Dictionary<string, object>? Nbt { get; set; } = new();
public override void Parse(Queue<byte> data)
{
Nbt = DataTypes.ReadNextNbt(data);

View file

@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class MapIdComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class MapIdComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int Id { get; set; }
public override void Parse(Queue<byte> data)
{
Id = DataTypes.ReadNextVarInt(data);

View file

@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class MapPostProcessingComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class MapPostProcessingComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int Type { get; set; }
public override void Parse(Queue<byte> data)
{
Type = DataTypes.ReadNextVarInt(data);

View file

@ -8,7 +8,7 @@ public class MaxDamageComponent(DataTypes dataTypes, ItemPalette itemPalette, Su
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int MaxDamage { get; set; }
public override void Parse(Queue<byte> data)
{
MaxDamage = DataTypes.ReadNextVarInt(data);

View file

@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class MaxStackSizeComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class MaxStackSizeComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int MaxStackSize { get; set; }
public override void Parse(Queue<byte> data)
{
MaxStackSize = DataTypes.ReadNextVarInt(data);

View file

@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class NoteBlockSoundComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class NoteBlockSoundComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public string Identifier { get; set; } = null!;
public override void Parse(Queue<byte> data)
{
Identifier = DataTypes.ReadNextString(data);

View file

@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class OmniousBottleAmplifierComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class OmniousBottleAmplifierComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int Amplifier { get; set; }
public override void Parse(Queue<byte> data)
{
Amplifier = DataTypes.ReadNextVarInt(data);

View file

@ -4,15 +4,15 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class PotDecorationsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class PotDecorationsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public List<int> Items { get; set; } = [];
public override void Parse(Queue<byte> data)
{
var count = DataTypes.ReadNextVarInt(data);
for(var i = 0; i < count; i++)
for (var i = 0; i < count; i++)
Items.Add(DataTypes.ReadNextVarInt(data));
}

View file

@ -6,7 +6,7 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class PotionContentsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class PotionContentsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public bool HasPotionId { get; set; }
@ -14,7 +14,7 @@ public class PotionContentsComponent(DataTypes dataTypes, ItemPalette itemPalett
public bool HasCustomColor { get; set; }
public int CustomColor { get; set; }
public List<PotionEffectSubComponent> Effects { get; set; } = new();
public override void Parse(Queue<byte> data)
{
HasPotionId = DataTypes.ReadNextBool(data);
@ -44,7 +44,7 @@ public class PotionContentsComponent(DataTypes dataTypes, ItemPalette itemPalett
data.AddRange(DataTypes.GetVarInt(Effects.Count));
foreach (var effect in Effects)
data.AddRange(effect.Serialize());
return new Queue<byte>(data);
}
}

View file

@ -18,7 +18,7 @@ public class ProfileComponent(DataTypes dataTypes, ItemPalette itemPalette, SubC
public string? CapeAssetId { get; set; }
public string? ElytraAssetId { get; set; }
public ProfileSkinModel? Model { get; set; }
public override void Parse(Queue<byte> data)
{
ResetState();

View file

@ -5,11 +5,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class RarityComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class RarityComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public ItemRarity Rarity { get; set; }
public override void Parse(Queue<byte> data)
{
Rarity = (ItemRarity)DataTypes.ReadNextVarInt(data);

View file

@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class RecipesComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class RecipesComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public Dictionary<string, object>? Nbt { get; set; }
public override void Parse(Queue<byte> data)
{
Nbt = DataTypes.ReadNextNbt(data);

View file

@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class RepairCostComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class RepairCostComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int Cost { get; set; }
public override void Parse(Queue<byte> data)
{
Cost = DataTypes.ReadNextVarInt(data);

View file

@ -5,5 +5,5 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class StoredEnchantmentsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class StoredEnchantmentsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: EnchantmentsComponent(dataTypes, itemPalette, subComponentRegistry);

View file

@ -7,7 +7,7 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class SuspiciousStewEffectsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class SuspiciousStewEffectsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int NumberOfEffects { get; set; }
@ -28,7 +28,7 @@ public class SuspiciousStewEffectsComponent(DataTypes dataTypes, ItemPalette ite
if (NumberOfEffects != Effects.Count)
throw new InvalidOperationException("Can not serialize SuspiciousStewEffectsComponent1206 because umberOfEffects != Effects.Count!");
foreach (var effect in Effects)
{
data.AddRange(DataTypes.GetVarInt(effect.TypeId));

View file

@ -7,14 +7,14 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class ToolComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class ToolComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public int NumberOfRules { get; set; }
public List<RuleSubComponent> Rules { get; set; } = new();
public float DefaultMiningSpeed { get; set; }
public int DamagePerBlock { get; set; }
public override void Parse(Queue<byte> data)
{
NumberOfRules = DataTypes.ReadNextVarInt(data);
@ -30,13 +30,13 @@ public class ToolComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComp
{
var data = new List<byte>();
data.AddRange(DataTypes.GetVarInt(NumberOfRules));
if(Rules.Count != 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<byte>(data);

View file

@ -24,7 +24,7 @@ public class TrimComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComp
public string TrimPatternTypeDescription { get; set; } = null!;
public bool Decal { get; set; }
public bool ShowInTooltip { get; set; }
public override void Parse(Queue<byte> data)
{
TrimMaterialType = DataTypes.ReadNextVarInt(data);
@ -73,16 +73,16 @@ public class TrimComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComp
{
if (string.IsNullOrEmpty(AssetName))
throw new NullReferenceException("Can't serialize the TrimComponent because the Asset Name is null!");
data.AddRange(DataTypes.GetString(AssetName));
data.AddRange(DataTypes.GetVarInt(Ingredient));
data.AddRange(DataTypes.GetFloat(ItemModelIndex));
data.AddRange(DataTypes.GetVarInt(NumberOfOverrides));
if (NumberOfOverrides > 0)
{
if(NumberOfOverrides != Overrides?.Count)
if (NumberOfOverrides != Overrides?.Count)
throw new NullReferenceException("Can't serialize the TrimComponent because value of NumberOfOverrides and the size of Overrides don't match!");
foreach (var (armorMaterialType, assetName) in Overrides)
{
data.AddRange(DataTypes.GetVarInt(armorMaterialType));
@ -97,15 +97,15 @@ public class TrimComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComp
{
if (string.IsNullOrEmpty(TrimPatternTypeAssetName))
throw new NullReferenceException("Can't serialize the TrimComponent because the TrimPatternTypeAssetName is null!");
data.AddRange(DataTypes.GetString(TrimPatternTypeAssetName));
data.AddRange(DataTypes.GetVarInt(TemplateItem));
data.AddRange(DataTypes.GetNbt(TrimPatternTypeDescriptionNbt));
data.AddRange(DataTypes.GetBool(Decal));
}
data.AddRange(DataTypes.GetBool(ShowInTooltip));
return new Queue<byte>(data);
}
}

View file

@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class UnbrekableComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
public class UnbrekableComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public bool Unbrekable { get; set; }
public override void Parse(Queue<byte> data)
{
Unbrekable = DataTypes.ReadNextBool(data);

View file

@ -9,7 +9,7 @@ namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_2
public class WritableBlookContentComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry) : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public List<BookPage> Pages { get; set; } = [];
public override void Parse(Queue<byte> data)
{
var count = DataTypes.ReadNextVarInt(data);
@ -19,10 +19,10 @@ public class WritableBlookContentComponent(DataTypes dataTypes, ItemPalette item
var rawContent = DataTypes.ReadNextString(data);
var hasFilteredContent = DataTypes.ReadNextBool(data);
var filteredContent = null as string;
if(hasFilteredContent)
if (hasFilteredContent)
filteredContent = DataTypes.ReadNextString(data);
Pages.Add(new BookPage(rawContent, hasFilteredContent, filteredContent));
}
}
@ -30,7 +30,7 @@ public class WritableBlookContentComponent(DataTypes dataTypes, ItemPalette item
public override Queue<byte> Serialize()
{
var data = new List<byte>();
data.AddRange(DataTypes.GetVarInt(Pages.Count));
foreach (var page in Pages)
@ -40,9 +40,9 @@ public class WritableBlookContentComponent(DataTypes dataTypes, ItemPalette item
if (page.HasFilteredContent)
{
if(page.FilteredContent is null)
if (page.FilteredContent is null)
throw new InvalidOperationException("Can not serialize WritableBlookContentComponent because page.HasFilteredContent = true, but FilteredContent is null!");
data.AddRange(DataTypes.GetString(page.FilteredContent));
}
}

View file

@ -17,7 +17,7 @@ public class WrittenBlookContentComponent(DataTypes dataTypes, ItemPalette itemP
public int NumberOfPages { get; set; }
public List<BookPage> Pages { get; set; } = [];
public bool Resolved { get; set; }
public override void Parse(Queue<byte> data)
{
RawTitle = DataTypes.ReadNextString(data);
@ -25,7 +25,7 @@ public class WrittenBlookContentComponent(DataTypes dataTypes, ItemPalette itemP
if (HasFilteredTitle)
FilteredTitle = DataTypes.ReadNextString(data);
Author = DataTypes.ReadNextString(data);
Generation = DataTypes.ReadNextVarInt(data);
NumberOfPages = DataTypes.ReadNextVarInt(data);
@ -37,13 +37,13 @@ public class WrittenBlookContentComponent(DataTypes dataTypes, ItemPalette itemP
var hasFilteredContent = DataTypes.ReadNextBool(data);
Dictionary<string, object>? filteredContentNbt = null;
string? filteredContent = null;
if (hasFilteredContent)
{
filteredContentNbt = DataTypes.ReadNextNbt(data);
filteredContent = ChatParser.ParseText(filteredContentNbt);
}
Pages.Add(new BookPage(rawContent, hasFilteredContent, filteredContent, rawContentNbt, filteredContentNbt));
}
@ -53,18 +53,18 @@ public class WrittenBlookContentComponent(DataTypes dataTypes, ItemPalette itemP
public override Queue<byte> Serialize()
{
var data = new List<byte>();
data.AddRange(DataTypes.GetString(RawTitle));
data.AddRange(DataTypes.GetBool(HasFilteredTitle));
if (HasFilteredTitle)
{
if(FilteredTitle is null)
if (FilteredTitle is null)
throw new InvalidOperationException("Can not serialize WrittenBookContentComponent because HasFilteredTitle is true but FilteredTitle is null!");
data.AddRange(DataTypes.GetString(FilteredTitle));
}
data.AddRange(DataTypes.GetString(Author));
data.AddRange(DataTypes.GetVarInt(Generation));
data.AddRange(DataTypes.GetVarInt(Pages.Count));