feat: add version routing, structured components, and metadata for MC 1.21.11
- Add MC_1_21_11_Version constant (protocol 774)
- Create StructuredComponentsRegistry12111 with 104 components (8 new:
use_effects, minimum_attack_charge, damage_type, attack_range,
piercing_weapon, kinetic_weapon, swing_animation, zombie_nautilus/variant)
- Add 6 new component classes for 1.21.11 wire formats
- Add RegistryEitherHolderComponent for holderRegistry-backed EitherHolder
- Add ZombieNautilusVariant and HumanoidArm cases in DataTypes.ReadNextMetadata
- Update all version routing in Protocol18, PacketType18Handler,
EntityMetadataPalette, StructuredComponentsHandler, and ProtocolHandler
- Bump MCHighestVersion to 1.21.11
Made-with: Cursor
2026-03-22 00:56:04 +08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using MinecraftClient.Inventory.ItemPalettes;
|
2026-06-11 21:33:48 +02:00
|
|
|
using MinecraftClient.Protocol.Handlers.StructuredComponents.Components;
|
feat: add version routing, structured components, and metadata for MC 1.21.11
- Add MC_1_21_11_Version constant (protocol 774)
- Create StructuredComponentsRegistry12111 with 104 components (8 new:
use_effects, minimum_attack_charge, damage_type, attack_range,
piercing_weapon, kinetic_weapon, swing_animation, zombie_nautilus/variant)
- Add 6 new component classes for 1.21.11 wire formats
- Add RegistryEitherHolderComponent for holderRegistry-backed EitherHolder
- Add ZombieNautilusVariant and HumanoidArm cases in DataTypes.ReadNextMetadata
- Update all version routing in Protocol18, PacketType18Handler,
EntityMetadataPalette, StructuredComponentsHandler, and ProtocolHandler
- Bump MCHighestVersion to 1.21.11
Made-with: Cursor
2026-03-22 00:56:04 +08:00
|
|
|
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|
|
|
|
|
|
|
|
|
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_21_11;
|
|
|
|
|
|
|
|
|
|
public class KineticWeaponComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
|
|
|
|
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
|
|
|
|
{
|
2026-06-11 21:33:48 +02:00
|
|
|
public int ContactCooldownTicks { get; set; }
|
|
|
|
|
public int DelayTicks { get; set; }
|
|
|
|
|
public KineticWeaponConditionData? DismountConditions { get; set; }
|
|
|
|
|
public KineticWeaponConditionData? KnockbackConditions { get; set; }
|
|
|
|
|
public KineticWeaponConditionData? DamageConditions { get; set; }
|
|
|
|
|
public float ForwardMovement { get; set; }
|
|
|
|
|
public float DamageMultiplier { get; set; }
|
|
|
|
|
public SoundEventHolderData? Sound { get; set; }
|
|
|
|
|
public SoundEventHolderData? HitSound { get; set; }
|
|
|
|
|
|
feat: add version routing, structured components, and metadata for MC 1.21.11
- Add MC_1_21_11_Version constant (protocol 774)
- Create StructuredComponentsRegistry12111 with 104 components (8 new:
use_effects, minimum_attack_charge, damage_type, attack_range,
piercing_weapon, kinetic_weapon, swing_animation, zombie_nautilus/variant)
- Add 6 new component classes for 1.21.11 wire formats
- Add RegistryEitherHolderComponent for holderRegistry-backed EitherHolder
- Add ZombieNautilusVariant and HumanoidArm cases in DataTypes.ReadNextMetadata
- Update all version routing in Protocol18, PacketType18Handler,
EntityMetadataPalette, StructuredComponentsHandler, and ProtocolHandler
- Bump MCHighestVersion to 1.21.11
Made-with: Cursor
2026-03-22 00:56:04 +08:00
|
|
|
public override void Parse(Queue<byte> data)
|
|
|
|
|
{
|
2026-06-11 21:33:48 +02:00
|
|
|
ContactCooldownTicks = DataTypes.ReadNextVarInt(data);
|
|
|
|
|
DelayTicks = DataTypes.ReadNextVarInt(data);
|
|
|
|
|
DismountConditions = ReadOptionalCondition(data);
|
|
|
|
|
KnockbackConditions = ReadOptionalCondition(data);
|
|
|
|
|
DamageConditions = ReadOptionalCondition(data);
|
|
|
|
|
ForwardMovement = DataTypes.ReadNextFloat(data);
|
|
|
|
|
DamageMultiplier = DataTypes.ReadNextFloat(data);
|
|
|
|
|
Sound = StructuredComponentCodecHelpers.ReadOptionalSoundEventHolder(DataTypes, data);
|
|
|
|
|
HitSound = StructuredComponentCodecHelpers.ReadOptionalSoundEventHolder(DataTypes, data);
|
feat: add version routing, structured components, and metadata for MC 1.21.11
- Add MC_1_21_11_Version constant (protocol 774)
- Create StructuredComponentsRegistry12111 with 104 components (8 new:
use_effects, minimum_attack_charge, damage_type, attack_range,
piercing_weapon, kinetic_weapon, swing_animation, zombie_nautilus/variant)
- Add 6 new component classes for 1.21.11 wire formats
- Add RegistryEitherHolderComponent for holderRegistry-backed EitherHolder
- Add ZombieNautilusVariant and HumanoidArm cases in DataTypes.ReadNextMetadata
- Update all version routing in Protocol18, PacketType18Handler,
EntityMetadataPalette, StructuredComponentsHandler, and ProtocolHandler
- Bump MCHighestVersion to 1.21.11
Made-with: Cursor
2026-03-22 00:56:04 +08:00
|
|
|
}
|
|
|
|
|
|
2026-06-11 21:33:48 +02:00
|
|
|
private KineticWeaponConditionData? ReadOptionalCondition(Queue<byte> data)
|
feat: add version routing, structured components, and metadata for MC 1.21.11
- Add MC_1_21_11_Version constant (protocol 774)
- Create StructuredComponentsRegistry12111 with 104 components (8 new:
use_effects, minimum_attack_charge, damage_type, attack_range,
piercing_weapon, kinetic_weapon, swing_animation, zombie_nautilus/variant)
- Add 6 new component classes for 1.21.11 wire formats
- Add RegistryEitherHolderComponent for holderRegistry-backed EitherHolder
- Add ZombieNautilusVariant and HumanoidArm cases in DataTypes.ReadNextMetadata
- Update all version routing in Protocol18, PacketType18Handler,
EntityMetadataPalette, StructuredComponentsHandler, and ProtocolHandler
- Bump MCHighestVersion to 1.21.11
Made-with: Cursor
2026-03-22 00:56:04 +08:00
|
|
|
{
|
2026-06-11 21:33:48 +02:00
|
|
|
if (!DataTypes.ReadNextBool(data))
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
return new KineticWeaponConditionData(
|
|
|
|
|
DataTypes.ReadNextVarInt(data),
|
|
|
|
|
DataTypes.ReadNextFloat(data),
|
|
|
|
|
DataTypes.ReadNextFloat(data));
|
feat: add version routing, structured components, and metadata for MC 1.21.11
- Add MC_1_21_11_Version constant (protocol 774)
- Create StructuredComponentsRegistry12111 with 104 components (8 new:
use_effects, minimum_attack_charge, damage_type, attack_range,
piercing_weapon, kinetic_weapon, swing_animation, zombie_nautilus/variant)
- Add 6 new component classes for 1.21.11 wire formats
- Add RegistryEitherHolderComponent for holderRegistry-backed EitherHolder
- Add ZombieNautilusVariant and HumanoidArm cases in DataTypes.ReadNextMetadata
- Update all version routing in Protocol18, PacketType18Handler,
EntityMetadataPalette, StructuredComponentsHandler, and ProtocolHandler
- Bump MCHighestVersion to 1.21.11
Made-with: Cursor
2026-03-22 00:56:04 +08:00
|
|
|
}
|
|
|
|
|
|
2026-06-11 21:33:48 +02:00
|
|
|
private void WriteOptionalCondition(List<byte> data, KineticWeaponConditionData? condition)
|
feat: add version routing, structured components, and metadata for MC 1.21.11
- Add MC_1_21_11_Version constant (protocol 774)
- Create StructuredComponentsRegistry12111 with 104 components (8 new:
use_effects, minimum_attack_charge, damage_type, attack_range,
piercing_weapon, kinetic_weapon, swing_animation, zombie_nautilus/variant)
- Add 6 new component classes for 1.21.11 wire formats
- Add RegistryEitherHolderComponent for holderRegistry-backed EitherHolder
- Add ZombieNautilusVariant and HumanoidArm cases in DataTypes.ReadNextMetadata
- Update all version routing in Protocol18, PacketType18Handler,
EntityMetadataPalette, StructuredComponentsHandler, and ProtocolHandler
- Bump MCHighestVersion to 1.21.11
Made-with: Cursor
2026-03-22 00:56:04 +08:00
|
|
|
{
|
2026-06-11 21:33:48 +02:00
|
|
|
data.AddRange(DataTypes.GetBool(condition is not null));
|
|
|
|
|
if (condition is null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
data.AddRange(DataTypes.GetVarInt(condition.MaxDurationTicks));
|
|
|
|
|
data.AddRange(DataTypes.GetFloat(condition.MinSpeed));
|
|
|
|
|
data.AddRange(DataTypes.GetFloat(condition.MinRelativeSpeed));
|
feat: add version routing, structured components, and metadata for MC 1.21.11
- Add MC_1_21_11_Version constant (protocol 774)
- Create StructuredComponentsRegistry12111 with 104 components (8 new:
use_effects, minimum_attack_charge, damage_type, attack_range,
piercing_weapon, kinetic_weapon, swing_animation, zombie_nautilus/variant)
- Add 6 new component classes for 1.21.11 wire formats
- Add RegistryEitherHolderComponent for holderRegistry-backed EitherHolder
- Add ZombieNautilusVariant and HumanoidArm cases in DataTypes.ReadNextMetadata
- Update all version routing in Protocol18, PacketType18Handler,
EntityMetadataPalette, StructuredComponentsHandler, and ProtocolHandler
- Bump MCHighestVersion to 1.21.11
Made-with: Cursor
2026-03-22 00:56:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override Queue<byte> Serialize()
|
|
|
|
|
{
|
2026-06-11 21:33:48 +02:00
|
|
|
var data = new List<byte>();
|
|
|
|
|
data.AddRange(DataTypes.GetVarInt(ContactCooldownTicks));
|
|
|
|
|
data.AddRange(DataTypes.GetVarInt(DelayTicks));
|
|
|
|
|
WriteOptionalCondition(data, DismountConditions);
|
|
|
|
|
WriteOptionalCondition(data, KnockbackConditions);
|
|
|
|
|
WriteOptionalCondition(data, DamageConditions);
|
|
|
|
|
data.AddRange(DataTypes.GetFloat(ForwardMovement));
|
|
|
|
|
data.AddRange(DataTypes.GetFloat(DamageMultiplier));
|
|
|
|
|
StructuredComponentCodecHelpers.WriteOptionalSoundEventHolder(DataTypes, data, Sound);
|
|
|
|
|
StructuredComponentCodecHelpers.WriteOptionalSoundEventHolder(DataTypes, data, HitSound);
|
|
|
|
|
return new Queue<byte>(data);
|
feat: add version routing, structured components, and metadata for MC 1.21.11
- Add MC_1_21_11_Version constant (protocol 774)
- Create StructuredComponentsRegistry12111 with 104 components (8 new:
use_effects, minimum_attack_charge, damage_type, attack_range,
piercing_weapon, kinetic_weapon, swing_animation, zombie_nautilus/variant)
- Add 6 new component classes for 1.21.11 wire formats
- Add RegistryEitherHolderComponent for holderRegistry-backed EitherHolder
- Add ZombieNautilusVariant and HumanoidArm cases in DataTypes.ReadNextMetadata
- Update all version routing in Protocol18, PacketType18Handler,
EntityMetadataPalette, StructuredComponentsHandler, and ProtocolHandler
- Bump MCHighestVersion to 1.21.11
Made-with: Cursor
2026-03-22 00:56:04 +08:00
|
|
|
}
|
|
|
|
|
}
|
2026-06-11 21:33:48 +02:00
|
|
|
|
|
|
|
|
public sealed record KineticWeaponConditionData(int MaxDurationTicks, float MinSpeed, float MinRelativeSpeed);
|