mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
start updating to 22w42a
This commit is contained in:
parent
3869fd622f
commit
233d7ebce4
17 changed files with 222 additions and 1009 deletions
|
@ -7,7 +7,7 @@ A collection of Rust crates for making Minecraft bots, clients, and tools.
|
|||
</p>
|
||||
|
||||
<!-- The line below is automatically read and updated by the migrate script, so don't change it manually. -->
|
||||
*Currently supported Minecraft version: `1.19.2`.*
|
||||
*Currently supported Minecraft version: `22w42a`.*
|
||||
|
||||
## ⚠️ Azalea is still very unfinished, though some crates are in a somewhat useable state
|
||||
|
||||
|
|
|
@ -352,115 +352,7 @@ make_block_states! {
|
|||
_7,
|
||||
},
|
||||
"lit" => bool,
|
||||
"rotation" => OakSignRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => SpruceSignRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => BirchSignRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => AcaciaSignRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => JungleSignRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => DarkOakSignRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => MangroveSignRotation {
|
||||
"rotation" => _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15 {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
|
@ -656,114 +548,6 @@ make_block_states! {
|
|||
_6,
|
||||
_7,
|
||||
},
|
||||
"rotation" => SkeletonSkullRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => WitherSkeletonSkullRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => ZombieHeadRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => PlayerHeadRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => CreeperHeadRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => DragonHeadRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"power" => LightWeightedPressurePlatePower {
|
||||
_0,
|
||||
_1,
|
||||
|
@ -854,294 +638,6 @@ make_block_states! {
|
|||
Bottom,
|
||||
Double,
|
||||
},
|
||||
"rotation" => WhiteBannerRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => OrangeBannerRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => MagentaBannerRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => LightBlueBannerRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => YellowBannerRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => LimeBannerRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => PinkBannerRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => GrayBannerRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => LightGrayBannerRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => CyanBannerRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => PurpleBannerRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => BlueBannerRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => BrownBannerRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => GreenBannerRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => RedBannerRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => BlackBannerRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"age" => ChorusFlowerAge {
|
||||
_0,
|
||||
_1,
|
||||
|
@ -1302,42 +798,6 @@ make_block_states! {
|
|||
_24,
|
||||
_25,
|
||||
},
|
||||
"rotation" => CrimsonSignRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"rotation" => WarpedSignRotation {
|
||||
_0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
_5,
|
||||
_6,
|
||||
_7,
|
||||
_8,
|
||||
_9,
|
||||
_10,
|
||||
_11,
|
||||
_12,
|
||||
_13,
|
||||
_14,
|
||||
_15,
|
||||
},
|
||||
"mode" => Mode {
|
||||
Save,
|
||||
Load,
|
||||
|
@ -2010,31 +1470,31 @@ make_block_states! {
|
|||
lit: false,
|
||||
},
|
||||
oak_sign => BlockBehavior::default(), {
|
||||
rotation: OakSignRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
waterlogged: false,
|
||||
},
|
||||
spruce_sign => BlockBehavior::default(), {
|
||||
rotation: SpruceSignRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
waterlogged: false,
|
||||
},
|
||||
birch_sign => BlockBehavior::default(), {
|
||||
rotation: BirchSignRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
waterlogged: false,
|
||||
},
|
||||
acacia_sign => BlockBehavior::default(), {
|
||||
rotation: AcaciaSignRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
waterlogged: false,
|
||||
},
|
||||
jungle_sign => BlockBehavior::default(), {
|
||||
rotation: JungleSignRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
waterlogged: false,
|
||||
},
|
||||
dark_oak_sign => BlockBehavior::default(), {
|
||||
rotation: DarkOakSignRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
waterlogged: false,
|
||||
},
|
||||
mangrove_sign => BlockBehavior::default(), {
|
||||
rotation: MangroveSignRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
waterlogged: false,
|
||||
},
|
||||
oak_door => BlockBehavior::default(), {
|
||||
|
@ -2550,37 +2010,37 @@ make_block_states! {
|
|||
powered: false,
|
||||
},
|
||||
skeleton_skull => BlockBehavior::default(), {
|
||||
rotation: SkeletonSkullRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
skeleton_wall_skull => BlockBehavior::default(), {
|
||||
facing: FacingCardinal::North,
|
||||
},
|
||||
wither_skeleton_skull => BlockBehavior::default(), {
|
||||
rotation: WitherSkeletonSkullRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
wither_skeleton_wall_skull => BlockBehavior::default(), {
|
||||
facing: FacingCardinal::North,
|
||||
},
|
||||
zombie_head => BlockBehavior::default(), {
|
||||
rotation: ZombieHeadRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
zombie_wall_head => BlockBehavior::default(), {
|
||||
facing: FacingCardinal::North,
|
||||
},
|
||||
player_head => BlockBehavior::default(), {
|
||||
rotation: PlayerHeadRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
player_wall_head => BlockBehavior::default(), {
|
||||
facing: FacingCardinal::North,
|
||||
},
|
||||
creeper_head => BlockBehavior::default(), {
|
||||
rotation: CreeperHeadRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
creeper_wall_head => BlockBehavior::default(), {
|
||||
facing: FacingCardinal::North,
|
||||
},
|
||||
dragon_head => BlockBehavior::default(), {
|
||||
rotation: DragonHeadRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
dragon_wall_head => BlockBehavior::default(), {
|
||||
facing: FacingCardinal::North,
|
||||
|
@ -2874,52 +2334,52 @@ make_block_states! {
|
|||
half: Half::Lower,
|
||||
},
|
||||
white_banner => BlockBehavior::default(), {
|
||||
rotation: WhiteBannerRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
orange_banner => BlockBehavior::default(), {
|
||||
rotation: OrangeBannerRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
magenta_banner => BlockBehavior::default(), {
|
||||
rotation: MagentaBannerRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
light_blue_banner => BlockBehavior::default(), {
|
||||
rotation: LightBlueBannerRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
yellow_banner => BlockBehavior::default(), {
|
||||
rotation: YellowBannerRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
lime_banner => BlockBehavior::default(), {
|
||||
rotation: LimeBannerRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
pink_banner => BlockBehavior::default(), {
|
||||
rotation: PinkBannerRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
gray_banner => BlockBehavior::default(), {
|
||||
rotation: GrayBannerRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
light_gray_banner => BlockBehavior::default(), {
|
||||
rotation: LightGrayBannerRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
cyan_banner => BlockBehavior::default(), {
|
||||
rotation: CyanBannerRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
purple_banner => BlockBehavior::default(), {
|
||||
rotation: PurpleBannerRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
blue_banner => BlockBehavior::default(), {
|
||||
rotation: BlueBannerRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
brown_banner => BlockBehavior::default(), {
|
||||
rotation: BrownBannerRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
green_banner => BlockBehavior::default(), {
|
||||
rotation: GreenBannerRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
red_banner => BlockBehavior::default(), {
|
||||
rotation: RedBannerRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
black_banner => BlockBehavior::default(), {
|
||||
rotation: BlackBannerRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
},
|
||||
white_wall_banner => BlockBehavior::default(), {
|
||||
facing: FacingCardinal::North,
|
||||
|
@ -3945,11 +3405,11 @@ make_block_states! {
|
|||
powered: false,
|
||||
},
|
||||
crimson_sign => BlockBehavior::default(), {
|
||||
rotation: CrimsonSignRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
waterlogged: false,
|
||||
},
|
||||
warped_sign => BlockBehavior::default(), {
|
||||
rotation: WarpedSignRotation::_0,
|
||||
rotation: _0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15::_0,
|
||||
waterlogged: false,
|
||||
},
|
||||
crimson_wall_sign => BlockBehavior::default(), {
|
||||
|
|
|
@ -1,8 +1,41 @@
|
|||
use azalea_buf::McBuf;
|
||||
use azalea_buf::{McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
|
||||
use azalea_crypto::MessageSignature;
|
||||
use azalea_protocol_macros::ClientboundGamePacket;
|
||||
use std::io::{Cursor, Write};
|
||||
|
||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
||||
pub struct ClientboundDeleteChatPacket {
|
||||
pub message_signature: MessageSignature,
|
||||
pub signature_or_id: SignatureOrId,
|
||||
}
|
||||
|
||||
/// Messages can be deleted by either their signature or message id.
|
||||
pub enum SignatureOrId {
|
||||
Signature(MessageSignature),
|
||||
Id(u32),
|
||||
}
|
||||
|
||||
impl McBufReadable for SignatureOrId {
|
||||
fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, azalea_buf::BufReadError> {
|
||||
let id = u32::var_read_from(buf)?;
|
||||
if id == 0 {
|
||||
let full_signature = MessageSignature::read_from(buf)?;
|
||||
Ok(SignatureOrId::Signature(full_signature))
|
||||
} else {
|
||||
Ok(SignatureOrId::Id(id - 1))
|
||||
}
|
||||
}
|
||||
}
|
||||
impl McBufWritable for SignatureOrId {
|
||||
fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
|
||||
match self {
|
||||
SignatureOrId::Signature(full_signature) => {
|
||||
0u32.var_write_into(buf);
|
||||
full_signature.write_into(buf);
|
||||
}
|
||||
SignatureOrId::Id(id) => {
|
||||
(id + 1).var_write_into(buf);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
use azalea_buf::McBuf;
|
||||
use azalea_chat::component::Component;
|
||||
use azalea_protocol_macros::ClientboundGamePacket;
|
||||
|
||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
||||
pub struct ClientboundDisguisedChatPacket {
|
||||
pub message: Component,
|
||||
// TODO: {'field': 'b.a', 'operation': 'write', 'type': 'varint'}
|
||||
// TODO: {'field': 'b.b', 'operation': 'write', 'type': 'chatcomponent'}
|
||||
pub chat_type: Option<Component>,
|
||||
}
|
|
@ -1,118 +1,17 @@
|
|||
use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
|
||||
use azalea_core::BlockPos;
|
||||
use azalea_buf::McBuf;
|
||||
use azalea_protocol_macros::ClientboundGamePacket;
|
||||
use std::io::{Cursor, Write};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, ClientboundGamePacket)]
|
||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
||||
pub struct ClientboundExplodePacket {
|
||||
pub x: f32,
|
||||
pub y: f32,
|
||||
pub z: f32,
|
||||
pub x: f64,
|
||||
pub y: f64,
|
||||
pub z: f64,
|
||||
pub power: f32,
|
||||
pub to_blow: Vec<BlockPos>,
|
||||
// TODO: {'operation': 'store', 'type': 'int', 'value': 'anp.b(this.a)', 'var': 'var2'}
|
||||
// TODO: {'operation': 'store', 'type': 'int', 'value': 'anp.b(this.b)', 'var': 'var3'}
|
||||
// TODO: {'operation': 'store', 'type': 'int', 'value': 'anp.b(this.c)', 'var': 'var4'}
|
||||
pub to_blow: todo!(),
|
||||
pub knockback_x: f32,
|
||||
pub knockback_y: f32,
|
||||
pub knockback_z: f32,
|
||||
}
|
||||
|
||||
impl McBufReadable for ClientboundExplodePacket {
|
||||
fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
|
||||
let x = f32::read_from(buf)?;
|
||||
let y = f32::read_from(buf)?;
|
||||
let z = f32::read_from(buf)?;
|
||||
let power = f32::read_from(buf)?;
|
||||
|
||||
let x_floor = x.floor() as i32;
|
||||
let y_floor = y.floor() as i32;
|
||||
let z_floor = z.floor() as i32;
|
||||
|
||||
let to_blow_len = u32::var_read_from(buf)?;
|
||||
let mut to_blow = Vec::with_capacity(to_blow_len as usize);
|
||||
for _ in 0..to_blow_len {
|
||||
// the bytes are offsets from the main x y z
|
||||
let x = x_floor + i8::read_from(buf)? as i32;
|
||||
let y = y_floor + i8::read_from(buf)? as i32;
|
||||
let z = z_floor + i8::read_from(buf)? as i32;
|
||||
to_blow.push(BlockPos { x, y, z });
|
||||
}
|
||||
|
||||
let knockback_x = f32::read_from(buf)?;
|
||||
let knockback_y = f32::read_from(buf)?;
|
||||
let knockback_z = f32::read_from(buf)?;
|
||||
|
||||
Ok(Self {
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
power,
|
||||
to_blow,
|
||||
knockback_x,
|
||||
knockback_y,
|
||||
knockback_z,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl McBufWritable for ClientboundExplodePacket {
|
||||
fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
|
||||
self.x.write_into(buf)?;
|
||||
self.y.write_into(buf)?;
|
||||
self.z.write_into(buf)?;
|
||||
self.power.write_into(buf)?;
|
||||
|
||||
let to_blow_len = self.to_blow.len() as u32;
|
||||
to_blow_len.var_write_into(buf)?;
|
||||
|
||||
let x_floor = self.x.floor() as i32;
|
||||
let y_floor = self.y.floor() as i32;
|
||||
let z_floor = self.z.floor() as i32;
|
||||
|
||||
for pos in &self.to_blow {
|
||||
let x = (pos.x - x_floor) as i8;
|
||||
let y = (pos.y - y_floor) as i8;
|
||||
let z = (pos.z - z_floor) as i8;
|
||||
x.write_into(buf)?;
|
||||
y.write_into(buf)?;
|
||||
z.write_into(buf)?;
|
||||
}
|
||||
|
||||
self.knockback_x.write_into(buf)?;
|
||||
self.knockback_y.write_into(buf)?;
|
||||
self.knockback_z.write_into(buf)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_read_write() {
|
||||
let packet = ClientboundExplodePacket {
|
||||
x: 123_456.0,
|
||||
y: 789_012.0,
|
||||
z: 345_678.0,
|
||||
power: 1_000.0,
|
||||
to_blow: vec![
|
||||
BlockPos {
|
||||
x: 123_456 + 1,
|
||||
y: 789_012 + 2,
|
||||
z: 345_678 - 127,
|
||||
},
|
||||
BlockPos {
|
||||
x: 123_456 + 4,
|
||||
y: 789_012 - 5,
|
||||
z: 345_678 + 6,
|
||||
},
|
||||
],
|
||||
knockback_x: 1_000.0,
|
||||
knockback_y: 2_000.0,
|
||||
knockback_z: 3_000.0,
|
||||
};
|
||||
let mut buf = Vec::new();
|
||||
packet.write_into(&mut buf).unwrap();
|
||||
let packet2 = ClientboundExplodePacket::read_from(&mut Cursor::new(&buf)).unwrap();
|
||||
assert_eq!(packet, packet2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,161 +1,22 @@
|
|||
use azalea_buf::McBuf;
|
||||
use azalea_chat::{
|
||||
component::Component,
|
||||
translatable_component::{StringOrComponent, TranslatableComponent},
|
||||
};
|
||||
use azalea_core::BitSet;
|
||||
use azalea_crypto::{MessageSignature, SignedMessageHeader};
|
||||
use azalea_chat::component::Component;
|
||||
use azalea_protocol_macros::ClientboundGamePacket;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
||||
pub struct ClientboundPlayerChatPacket {
|
||||
pub message: PlayerChatMessage,
|
||||
pub chat_type: ChatTypeBound,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, McBuf, PartialEq, Eq)]
|
||||
pub enum ChatType {
|
||||
Chat = 0,
|
||||
SayCommand = 1,
|
||||
MsgCommandIncoming = 2,
|
||||
MsgCommandOutgoing = 3,
|
||||
TeamMsgCommandIncoming = 4,
|
||||
TeamMsgCommandOutgoing = 5,
|
||||
EmoteCommand = 6,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, McBuf)]
|
||||
pub struct ChatTypeBound {
|
||||
pub chat_type: ChatType,
|
||||
pub name: Component,
|
||||
pub target_name: Option<Component>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, McBuf)]
|
||||
pub struct PlayerChatMessage {
|
||||
pub signed_header: SignedMessageHeader,
|
||||
pub header_signature: MessageSignature,
|
||||
pub signed_body: SignedMessageBody,
|
||||
pub sender: Uuid,
|
||||
#[var]
|
||||
pub index: u32,
|
||||
pub signature: Option<Vec<u8>>,
|
||||
// TODO: {'field': 'd.a', 'operation': 'write', 'type': 'string'}
|
||||
// TODO: {'field': 'd.b.toEpochMilli()', 'operation': 'write', 'type': 'long'}
|
||||
// TODO: {'field': 'd.c', 'operation': 'write', 'type': 'long'}
|
||||
pub body: todo!(),
|
||||
pub unsigned_content: Option<Component>,
|
||||
pub filter_mask: FilterMask,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, McBuf)]
|
||||
pub struct SignedMessageBody {
|
||||
pub content: ChatMessageContent,
|
||||
pub timestamp: u64,
|
||||
pub salt: u64,
|
||||
pub last_seen: Vec<LastSeenMessagesEntry>,
|
||||
}
|
||||
|
||||
impl PlayerChatMessage {
|
||||
/// Returns the content of the message. If you want to get the Component
|
||||
/// for the whole message including the sender part, use
|
||||
/// [`ClientboundPlayerChatPacket::message`].
|
||||
pub fn content(&self, only_secure_chat: bool) -> Component {
|
||||
if only_secure_chat {
|
||||
return self
|
||||
.signed_body
|
||||
.content
|
||||
.decorated
|
||||
.clone()
|
||||
.unwrap_or_else(|| Component::from(self.signed_body.content.plain.clone()));
|
||||
}
|
||||
self.unsigned_content
|
||||
.clone()
|
||||
.unwrap_or_else(|| self.content(true))
|
||||
}
|
||||
}
|
||||
|
||||
impl ClientboundPlayerChatPacket {
|
||||
/// Get the full message, including the sender part.
|
||||
pub fn message(&self, only_secure_chat: bool) -> Component {
|
||||
let sender = self.chat_type.name.clone();
|
||||
let content = self.message.content(only_secure_chat);
|
||||
let target = self.chat_type.target_name.clone();
|
||||
|
||||
let translation_key = self.chat_type.chat_type.chat_translation_key();
|
||||
|
||||
let mut args = vec![
|
||||
StringOrComponent::Component(sender),
|
||||
StringOrComponent::Component(content),
|
||||
];
|
||||
if let Some(target) = target {
|
||||
args.push(StringOrComponent::Component(target));
|
||||
}
|
||||
|
||||
let component = TranslatableComponent::new(translation_key.to_string(), args);
|
||||
|
||||
Component::Translatable(component)
|
||||
}
|
||||
}
|
||||
|
||||
impl ChatType {
|
||||
pub fn chat_translation_key(&self) -> &'static str {
|
||||
match self {
|
||||
ChatType::Chat => "chat.type.text",
|
||||
ChatType::SayCommand => "chat.type.announcement",
|
||||
ChatType::MsgCommandIncoming => "commands.message.display.incoming",
|
||||
ChatType::MsgCommandOutgoing => "commands.message.display.outgoing",
|
||||
ChatType::TeamMsgCommandIncoming => "chat.type.team.text",
|
||||
ChatType::TeamMsgCommandOutgoing => "chat.type.team.sent",
|
||||
ChatType::EmoteCommand => "chat.type.emote",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn narrator_translation_key(&self) -> &'static str {
|
||||
match self {
|
||||
ChatType::Chat => "chat.type.text.narrate",
|
||||
ChatType::SayCommand => "chat.type.text.narrate",
|
||||
ChatType::MsgCommandIncoming => "chat.type.text.narrate",
|
||||
ChatType::MsgCommandOutgoing => "chat.type.text.narrate",
|
||||
ChatType::TeamMsgCommandIncoming => "chat.type.text.narrate",
|
||||
ChatType::TeamMsgCommandOutgoing => "chat.type.text.narrate",
|
||||
ChatType::EmoteCommand => "chat.type.emote",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, McBuf)]
|
||||
pub struct LastSeenMessagesEntry {
|
||||
pub profile_id: Uuid,
|
||||
pub last_signature: MessageSignature,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, McBuf, Default)]
|
||||
pub struct LastSeenMessagesUpdate {
|
||||
pub last_seen: Vec<LastSeenMessagesEntry>,
|
||||
pub last_received: Option<LastSeenMessagesEntry>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, McBuf)]
|
||||
pub struct ChatMessageContent {
|
||||
pub plain: String,
|
||||
/// Only sent if the decorated message is different than the plain.
|
||||
pub decorated: Option<Component>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, McBuf)]
|
||||
pub enum FilterMask {
|
||||
PassThrough,
|
||||
FullyFiltered,
|
||||
PartiallyFiltered(BitSet),
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use azalea_buf::McBufReadable;
|
||||
use std::io::Cursor;
|
||||
|
||||
#[test]
|
||||
fn test_chat_type() {
|
||||
let chat_type_enum = ChatType::read_from(&mut Cursor::new(&[0x06])).unwrap();
|
||||
assert_eq!(chat_type_enum, ChatType::EmoteCommand);
|
||||
assert_eq!(
|
||||
ChatType::read_from(&mut Cursor::new(&[0x07])).unwrap(),
|
||||
ChatType::Chat
|
||||
);
|
||||
}
|
||||
// TODO: {'field': 'f.f', 'operation': 'write', 'type': 'enum'}
|
||||
// TODO: {'condition': 'f.f == sl$a.c', 'instructions': [{'field': 'f.e.toLongArray().length', 'operation': 'write', 'type': 'varint'}, {'field': 'f.e.toLongArray()', 'operation': 'write', 'type': 'long[]'}], 'operation': 'if'}
|
||||
// TODO: {'field': 'g.a', 'operation': 'write', 'type': 'varint'}
|
||||
// TODO: {'field': 'g.b', 'operation': 'write', 'type': 'chatcomponent'}
|
||||
pub chat_type: Option<Component>,
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
use azalea_buf::McBuf;
|
||||
use azalea_protocol_macros::ClientboundGamePacket;
|
||||
|
||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
||||
pub struct ClientboundPlayerInfoRemovePacket {
|
||||
pub profile_ids: Vec<Uuid>,
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
use azalea_buf::McBuf;
|
||||
use azalea_protocol_macros::ClientboundGamePacket;
|
||||
|
||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
||||
pub struct ClientboundPlayerInfoUpdatePacket {}
|
|
@ -6,6 +6,5 @@ use azalea_protocol_macros::ClientboundGamePacket;
|
|||
pub struct ClientboundServerDataPacket {
|
||||
pub motd: Option<Component>,
|
||||
pub icon_base64: Option<String>,
|
||||
pub previews_chat: bool,
|
||||
pub enforces_secure_chat: bool,
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
use azalea_buf::McBuf;
|
||||
use azalea_protocol_macros::ClientboundGamePacket;
|
||||
|
||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
||||
pub struct ClientboundUpdateEnabledFeaturesPacket {
|
||||
pub features: Vec<ResourceLocation>,
|
||||
}
|
|
@ -10,9 +10,6 @@ pub mod clientbound_block_event_packet;
|
|||
pub mod clientbound_block_update_packet;
|
||||
pub mod clientbound_boss_event_packet;
|
||||
pub mod clientbound_change_difficulty_packet;
|
||||
pub mod clientbound_chat_preview_packet;
|
||||
pub mod clientbound_command_suggestions_packet;
|
||||
pub mod clientbound_commands_packet;
|
||||
pub mod clientbound_container_set_content_packet;
|
||||
pub mod clientbound_container_set_data_packet;
|
||||
pub mod clientbound_container_set_slot_packet;
|
||||
|
@ -22,6 +19,7 @@ pub mod clientbound_custom_payload_packet;
|
|||
pub mod clientbound_custom_sound_packet;
|
||||
pub mod clientbound_delete_chat_packet;
|
||||
pub mod clientbound_disconnect_packet;
|
||||
pub mod clientbound_disguised_chat_packet;
|
||||
pub mod clientbound_entity_event_packet;
|
||||
pub mod clientbound_entity_velocity_packet;
|
||||
pub mod clientbound_explode_packet;
|
||||
|
@ -47,12 +45,10 @@ pub mod clientbound_open_sign_editor_packet;
|
|||
pub mod clientbound_ping_packet;
|
||||
pub mod clientbound_place_ghost_recipe_packet;
|
||||
pub mod clientbound_player_abilities_packet;
|
||||
pub mod clientbound_player_chat_header_packet;
|
||||
pub mod clientbound_player_chat_packet;
|
||||
pub mod clientbound_player_combat_end_packet;
|
||||
pub mod clientbound_player_combat_enter_packet;
|
||||
pub mod clientbound_player_combat_kill_packet;
|
||||
pub mod clientbound_player_info_packet;
|
||||
pub mod clientbound_player_info_remove_packet;
|
||||
pub mod clientbound_player_info_update_packet;
|
||||
pub mod clientbound_player_look_at_packet;
|
||||
pub mod clientbound_player_position_packet;
|
||||
pub mod clientbound_recipe_packet;
|
||||
|
@ -75,10 +71,6 @@ pub mod clientbound_set_carried_item_packet;
|
|||
pub mod clientbound_set_chunk_cache_center_packet;
|
||||
pub mod clientbound_set_chunk_cache_radius_packet;
|
||||
pub mod clientbound_set_default_spawn_position_packet;
|
||||
pub mod clientbound_set_display_chat_preview_packet;
|
||||
pub mod clientbound_set_display_objective_packet;
|
||||
pub mod clientbound_set_entity_data_packet;
|
||||
pub mod clientbound_set_entity_link_packet;
|
||||
pub mod clientbound_set_entity_motion_packet;
|
||||
pub mod clientbound_set_equipment_packet;
|
||||
pub mod clientbound_set_experience_packet;
|
||||
|
@ -102,6 +94,7 @@ pub mod clientbound_take_item_entity_packet;
|
|||
pub mod clientbound_teleport_entity_packet;
|
||||
pub mod clientbound_update_advancements_packet;
|
||||
pub mod clientbound_update_attributes_packet;
|
||||
pub mod clientbound_update_enabled_features_packet;
|
||||
pub mod clientbound_update_mob_effect_packet;
|
||||
pub mod clientbound_update_recipes_packet;
|
||||
pub mod clientbound_update_tags_packet;
|
||||
|
@ -112,10 +105,6 @@ pub mod serverbound_change_difficulty_packet;
|
|||
pub mod serverbound_chat_ack_packet;
|
||||
pub mod serverbound_chat_command_packet;
|
||||
pub mod serverbound_chat_packet;
|
||||
pub mod serverbound_chat_preview_packet;
|
||||
pub mod serverbound_client_command_packet;
|
||||
pub mod serverbound_client_information_packet;
|
||||
pub mod serverbound_command_suggestion_packet;
|
||||
pub mod serverbound_container_button_click_packet;
|
||||
pub mod serverbound_container_click_packet;
|
||||
pub mod serverbound_container_close_packet;
|
||||
|
@ -169,51 +158,47 @@ declare_state_packets!(
|
|||
0x03: serverbound_chat_ack_packet::ServerboundChatAckPacket,
|
||||
0x04: serverbound_chat_command_packet::ServerboundChatCommandPacket,
|
||||
0x05: serverbound_chat_packet::ServerboundChatPacket,
|
||||
0x06: serverbound_chat_preview_packet::ServerboundChatPreviewPacket,
|
||||
0x07: serverbound_client_command_packet::ServerboundClientCommandPacket,
|
||||
0x08: serverbound_client_information_packet::ServerboundClientInformationPacket,
|
||||
0x09: serverbound_command_suggestion_packet::ServerboundCommandSuggestionPacket,
|
||||
0x0a: serverbound_container_button_click_packet::ServerboundContainerButtonClickPacket,
|
||||
0x0b: serverbound_container_click_packet::ServerboundContainerClickPacket,
|
||||
0x0c: serverbound_container_close_packet::ServerboundContainerClosePacket,
|
||||
0x0d: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket,
|
||||
0x0e: serverbound_edit_book_packet::ServerboundEditBookPacket,
|
||||
0x0f: serverbound_entity_tag_query::ServerboundEntityTagQuery,
|
||||
0x10: serverbound_interact_packet::ServerboundInteractPacket,
|
||||
0x11: serverbound_jigsaw_generate_packet::ServerboundJigsawGeneratePacket,
|
||||
0x12: serverbound_keep_alive_packet::ServerboundKeepAlivePacket,
|
||||
0x13: serverbound_lock_difficulty_packet::ServerboundLockDifficultyPacket,
|
||||
0x14: serverbound_move_player_pos_packet::ServerboundMovePlayerPosPacket,
|
||||
0x15: serverbound_move_player_pos_rot_packet::ServerboundMovePlayerPosRotPacket,
|
||||
0x16: serverbound_move_player_rot_packet::ServerboundMovePlayerRotPacket,
|
||||
0x17: serverbound_move_player_status_only_packet::ServerboundMovePlayerStatusOnlyPacket,
|
||||
0x18: serverbound_move_vehicle_packet::ServerboundMoveVehiclePacket,
|
||||
0x19: serverbound_paddle_boat_packet::ServerboundPaddleBoatPacket,
|
||||
0x1a: serverbound_pick_item_packet::ServerboundPickItemPacket,
|
||||
0x1b: serverbound_place_recipe_packet::ServerboundPlaceRecipePacket,
|
||||
0x1c: serverbound_player_abilities_packet::ServerboundPlayerAbilitiesPacket,
|
||||
0x1d: serverbound_player_action_packet::ServerboundPlayerActionPacket,
|
||||
0x1e: serverbound_player_command_packet::ServerboundPlayerCommandPacket,
|
||||
0x1f: serverbound_player_input_packet::ServerboundPlayerInputPacket,
|
||||
0x20: serverbound_pong_packet::ServerboundPongPacket,
|
||||
0x21: serverbound_recipe_book_change_settings_packet::ServerboundRecipeBookChangeSettingsPacket,
|
||||
0x22: serverbound_recipe_book_seen_recipe_packet::ServerboundRecipeBookSeenRecipePacket,
|
||||
0x23: serverbound_rename_item_packet::ServerboundRenameItemPacket,
|
||||
0x24: serverbound_resource_pack_packet::ServerboundResourcePackPacket,
|
||||
0x25: serverbound_seen_advancements_packet::ServerboundSeenAdvancementsPacket,
|
||||
0x26: serverbound_select_trade_packet::ServerboundSelectTradePacket,
|
||||
0x27: serverbound_set_beacon_packet::ServerboundSetBeaconPacket,
|
||||
0x28: serverbound_set_carried_item_packet::ServerboundSetCarriedItemPacket,
|
||||
0x29: serverbound_set_command_block_packet::ServerboundSetCommandBlockPacket,
|
||||
0x2a: serverbound_set_command_minecart_packet::ServerboundSetCommandMinecartPacket,
|
||||
0x2b: serverbound_set_creative_mode_slot_packet::ServerboundSetCreativeModeSlotPacket,
|
||||
0x2c: serverbound_set_jigsaw_block_packet::ServerboundSetJigsawBlockPacket,
|
||||
0x2d: serverbound_set_structure_block_packet::ServerboundSetStructureBlockPacket,
|
||||
0x2e: serverbound_sign_update_packet::ServerboundSignUpdatePacket,
|
||||
0x2f: serverbound_swing_packet::ServerboundSwingPacket,
|
||||
0x30: serverbound_teleport_to_entity_packet::ServerboundTeleportToEntityPacket,
|
||||
0x31: serverbound_use_item_on_packet::ServerboundUseItemOnPacket,
|
||||
0x32: serverbound_use_item_packet::ServerboundUseItemPacket,
|
||||
0x06: serverbound_container_button_click_packet::ServerboundContainerButtonClickPacket,
|
||||
0x07: serverbound_container_click_packet::ServerboundContainerClickPacket,
|
||||
0x08: serverbound_container_close_packet::ServerboundContainerClosePacket,
|
||||
0x09: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket,
|
||||
0x0a: serverbound_edit_book_packet::ServerboundEditBookPacket,
|
||||
0x0b: serverbound_entity_tag_query::ServerboundEntityTagQuery,
|
||||
0x0c: serverbound_interact_packet::ServerboundInteractPacket,
|
||||
0x0d: serverbound_jigsaw_generate_packet::ServerboundJigsawGeneratePacket,
|
||||
0x0e: serverbound_keep_alive_packet::ServerboundKeepAlivePacket,
|
||||
0x0f: serverbound_lock_difficulty_packet::ServerboundLockDifficultyPacket,
|
||||
0x10: serverbound_move_player_pos_packet::ServerboundMovePlayerPosPacket,
|
||||
0x11: serverbound_move_player_pos_rot_packet::ServerboundMovePlayerPosRotPacket,
|
||||
0x12: serverbound_move_player_rot_packet::ServerboundMovePlayerRotPacket,
|
||||
0x13: serverbound_move_player_status_only_packet::ServerboundMovePlayerStatusOnlyPacket,
|
||||
0x14: serverbound_move_vehicle_packet::ServerboundMoveVehiclePacket,
|
||||
0x15: serverbound_paddle_boat_packet::ServerboundPaddleBoatPacket,
|
||||
0x16: serverbound_pick_item_packet::ServerboundPickItemPacket,
|
||||
0x17: serverbound_place_recipe_packet::ServerboundPlaceRecipePacket,
|
||||
0x18: serverbound_player_abilities_packet::ServerboundPlayerAbilitiesPacket,
|
||||
0x19: serverbound_player_action_packet::ServerboundPlayerActionPacket,
|
||||
0x1a: serverbound_player_command_packet::ServerboundPlayerCommandPacket,
|
||||
0x1b: serverbound_player_input_packet::ServerboundPlayerInputPacket,
|
||||
0x1c: serverbound_pong_packet::ServerboundPongPacket,
|
||||
0x1d: serverbound_recipe_book_change_settings_packet::ServerboundRecipeBookChangeSettingsPacket,
|
||||
0x1e: serverbound_recipe_book_seen_recipe_packet::ServerboundRecipeBookSeenRecipePacket,
|
||||
0x1f: serverbound_rename_item_packet::ServerboundRenameItemPacket,
|
||||
0x20: serverbound_resource_pack_packet::ServerboundResourcePackPacket,
|
||||
0x21: serverbound_seen_advancements_packet::ServerboundSeenAdvancementsPacket,
|
||||
0x22: serverbound_select_trade_packet::ServerboundSelectTradePacket,
|
||||
0x23: serverbound_set_beacon_packet::ServerboundSetBeaconPacket,
|
||||
0x24: serverbound_set_carried_item_packet::ServerboundSetCarriedItemPacket,
|
||||
0x25: serverbound_set_command_block_packet::ServerboundSetCommandBlockPacket,
|
||||
0x26: serverbound_set_command_minecart_packet::ServerboundSetCommandMinecartPacket,
|
||||
0x27: serverbound_set_creative_mode_slot_packet::ServerboundSetCreativeModeSlotPacket,
|
||||
0x28: serverbound_set_jigsaw_block_packet::ServerboundSetJigsawBlockPacket,
|
||||
0x29: serverbound_set_structure_block_packet::ServerboundSetStructureBlockPacket,
|
||||
0x2a: serverbound_sign_update_packet::ServerboundSignUpdatePacket,
|
||||
0x2b: serverbound_swing_packet::ServerboundSwingPacket,
|
||||
0x2c: serverbound_teleport_to_entity_packet::ServerboundTeleportToEntityPacket,
|
||||
0x2d: serverbound_use_item_on_packet::ServerboundUseItemOnPacket,
|
||||
0x2e: serverbound_use_item_packet::ServerboundUseItemPacket,
|
||||
},
|
||||
Clientbound => {
|
||||
0x00: clientbound_add_entity_packet::ClientboundAddEntityPacket,
|
||||
|
@ -228,18 +213,16 @@ declare_state_packets!(
|
|||
0x09: clientbound_block_update_packet::ClientboundBlockUpdatePacket,
|
||||
0x0a: clientbound_boss_event_packet::ClientboundBossEventPacket,
|
||||
0x0b: clientbound_change_difficulty_packet::ClientboundChangeDifficultyPacket,
|
||||
0x0c: clientbound_chat_preview_packet::ClientboundChatPreviewPacket,
|
||||
0x0e: clientbound_command_suggestions_packet::ClientboundCommandSuggestionsPacket,
|
||||
0x0f: clientbound_commands_packet::ClientboundCommandsPacket,
|
||||
0x11: clientbound_container_set_content_packet::ClientboundContainerSetContentPacket,
|
||||
0x12: clientbound_container_set_data_packet::ClientboundContainerSetDataPacket,
|
||||
0x13: clientbound_container_set_slot_packet::ClientboundContainerSetSlotPacket,
|
||||
0x14: clientbound_cooldown_packet::ClientboundCooldownPacket,
|
||||
0x15: clientbound_custom_chat_completions_packet::ClientboundCustomChatCompletionsPacket,
|
||||
0x16: clientbound_custom_payload_packet::ClientboundCustomPayloadPacket,
|
||||
0x17: clientbound_custom_sound_packet::ClientboundCustomSoundPacket,
|
||||
0x18: clientbound_delete_chat_packet::ClientboundDeleteChatPacket,
|
||||
0x19: clientbound_disconnect_packet::ClientboundDisconnectPacket,
|
||||
0x0d: clientbound_container_set_content_packet::ClientboundContainerSetContentPacket,
|
||||
0x0e: clientbound_container_set_data_packet::ClientboundContainerSetDataPacket,
|
||||
0x0f: clientbound_container_set_slot_packet::ClientboundContainerSetSlotPacket,
|
||||
0x10: clientbound_cooldown_packet::ClientboundCooldownPacket,
|
||||
0x11: clientbound_custom_chat_completions_packet::ClientboundCustomChatCompletionsPacket,
|
||||
0x12: clientbound_custom_payload_packet::ClientboundCustomPayloadPacket,
|
||||
0x13: clientbound_custom_sound_packet::ClientboundCustomSoundPacket,
|
||||
0x14: clientbound_delete_chat_packet::ClientboundDeleteChatPacket,
|
||||
0x15: clientbound_disconnect_packet::ClientboundDisconnectPacket,
|
||||
0x16: clientbound_disguised_chat_packet::ClientboundDisguisedChatPacket,
|
||||
0x1a: clientbound_entity_event_packet::ClientboundEntityEventPacket,
|
||||
0x1b: clientbound_explode_packet::ClientboundExplodePacket,
|
||||
0x1c: clientbound_forget_level_chunk_packet::ClientboundForgetLevelChunkPacket,
|
||||
|
@ -264,12 +247,10 @@ declare_state_packets!(
|
|||
0x2f: clientbound_ping_packet::ClientboundPingPacket,
|
||||
0x30: clientbound_place_ghost_recipe_packet::ClientboundPlaceGhostRecipePacket,
|
||||
0x31: clientbound_player_abilities_packet::ClientboundPlayerAbilitiesPacket,
|
||||
0x32: clientbound_player_chat_header_packet::ClientboundPlayerChatHeaderPacket,
|
||||
0x33: clientbound_player_chat_packet::ClientboundPlayerChatPacket,
|
||||
0x34: clientbound_player_combat_end_packet::ClientboundPlayerCombatEndPacket,
|
||||
0x35: clientbound_player_combat_enter_packet::ClientboundPlayerCombatEnterPacket,
|
||||
0x36: clientbound_player_combat_kill_packet::ClientboundPlayerCombatKillPacket,
|
||||
0x37: clientbound_player_info_packet::ClientboundPlayerInfoPacket,
|
||||
0x32: clientbound_player_combat_kill_packet::ClientboundPlayerCombatKillPacket,
|
||||
0x32: clientbound_player_chat_packet::ClientboundPlayerChatPacket,
|
||||
0x36: clientbound_player_info_remove_packet::ClientboundPlayerInfoRemovePacket,
|
||||
0x37: clientbound_player_info_update_packet::ClientboundPlayerInfoUpdatePacket,
|
||||
0x38: clientbound_player_look_at_packet::ClientboundPlayerLookAtPacket,
|
||||
0x39: clientbound_player_position_packet::ClientboundPlayerPositionPacket,
|
||||
0x3a: clientbound_recipe_packet::ClientboundRecipePacket,
|
||||
|
@ -293,34 +274,31 @@ declare_state_packets!(
|
|||
0x4c: clientbound_update_view_distance_packet::ClientboundUpdateViewDistancePacket,
|
||||
0x4c: clientbound_set_chunk_cache_radius_packet::ClientboundSetChunkCacheRadiusPacket,
|
||||
0x4d: clientbound_set_default_spawn_position_packet::ClientboundSetDefaultSpawnPositionPacket,
|
||||
0x4e: clientbound_set_display_chat_preview_packet::ClientboundSetDisplayChatPreviewPacket,
|
||||
0x4f: clientbound_set_display_objective_packet::ClientboundSetDisplayObjectivePacket,
|
||||
0x50: clientbound_set_entity_data_packet::ClientboundSetEntityDataPacket,
|
||||
0x51: clientbound_set_entity_link_packet::ClientboundSetEntityLinkPacket,
|
||||
0x52: clientbound_entity_velocity_packet::ClientboundEntityVelocityPacket,
|
||||
0x52: clientbound_set_entity_motion_packet::ClientboundSetEntityMotionPacket,
|
||||
0x53: clientbound_set_equipment_packet::ClientboundSetEquipmentPacket,
|
||||
0x54: clientbound_set_experience_packet::ClientboundSetExperiencePacket,
|
||||
0x55: clientbound_set_health_packet::ClientboundSetHealthPacket,
|
||||
0x56: clientbound_set_objective_packet::ClientboundSetObjectivePacket,
|
||||
0x57: clientbound_set_passengers_packet::ClientboundSetPassengersPacket,
|
||||
0x58: clientbound_set_player_team_packet::ClientboundSetPlayerTeamPacket,
|
||||
0x59: clientbound_set_score_packet::ClientboundSetScorePacket,
|
||||
0x5a: clientbound_set_simulation_distance_packet::ClientboundSetSimulationDistancePacket,
|
||||
0x5b: clientbound_set_subtitle_text_packet::ClientboundSetSubtitleTextPacket,
|
||||
0x5c: clientbound_set_time_packet::ClientboundSetTimePacket,
|
||||
0x5d: clientbound_set_title_text_packet::ClientboundSetTitleTextPacket,
|
||||
0x5e: clientbound_set_titles_animation_packet::ClientboundSetTitlesAnimationPacket,
|
||||
0x5f: clientbound_sound_entity_packet::ClientboundSoundEntityPacket,
|
||||
0x60: clientbound_sound_packet::ClientboundSoundPacket,
|
||||
0x61: clientbound_stop_sound_packet::ClientboundStopSoundPacket,
|
||||
0x62: clientbound_system_chat_packet::ClientboundSystemChatPacket,
|
||||
0x63: clientbound_tab_list_packet::ClientboundTabListPacket,
|
||||
0x64: clientbound_tag_query_packet::ClientboundTagQueryPacket,
|
||||
0x65: clientbound_take_item_entity_packet::ClientboundTakeItemEntityPacket,
|
||||
0x66: clientbound_teleport_entity_packet::ClientboundTeleportEntityPacket,
|
||||
0x67: clientbound_update_advancements_packet::ClientboundUpdateAdvancementsPacket,
|
||||
0x68: clientbound_update_attributes_packet::ClientboundUpdateAttributesPacket,
|
||||
0x4e: clientbound_entity_velocity_packet::ClientboundEntityVelocityPacket,
|
||||
0x4e: clientbound_set_entity_motion_packet::ClientboundSetEntityMotionPacket,
|
||||
0x4f: clientbound_set_equipment_packet::ClientboundSetEquipmentPacket,
|
||||
0x50: clientbound_set_experience_packet::ClientboundSetExperiencePacket,
|
||||
0x51: clientbound_set_health_packet::ClientboundSetHealthPacket,
|
||||
0x52: clientbound_set_objective_packet::ClientboundSetObjectivePacket,
|
||||
0x53: clientbound_set_passengers_packet::ClientboundSetPassengersPacket,
|
||||
0x54: clientbound_set_player_team_packet::ClientboundSetPlayerTeamPacket,
|
||||
0x55: clientbound_set_score_packet::ClientboundSetScorePacket,
|
||||
0x56: clientbound_set_simulation_distance_packet::ClientboundSetSimulationDistancePacket,
|
||||
0x57: clientbound_set_subtitle_text_packet::ClientboundSetSubtitleTextPacket,
|
||||
0x58: clientbound_set_time_packet::ClientboundSetTimePacket,
|
||||
0x59: clientbound_set_title_text_packet::ClientboundSetTitleTextPacket,
|
||||
0x5a: clientbound_set_titles_animation_packet::ClientboundSetTitlesAnimationPacket,
|
||||
0x5b: clientbound_sound_entity_packet::ClientboundSoundEntityPacket,
|
||||
0x5c: clientbound_sound_packet::ClientboundSoundPacket,
|
||||
0x5d: clientbound_stop_sound_packet::ClientboundStopSoundPacket,
|
||||
0x5e: clientbound_system_chat_packet::ClientboundSystemChatPacket,
|
||||
0x5f: clientbound_tab_list_packet::ClientboundTabListPacket,
|
||||
0x60: clientbound_tag_query_packet::ClientboundTagQueryPacket,
|
||||
0x61: clientbound_take_item_entity_packet::ClientboundTakeItemEntityPacket,
|
||||
0x62: clientbound_teleport_entity_packet::ClientboundTeleportEntityPacket,
|
||||
0x63: clientbound_update_advancements_packet::ClientboundUpdateAdvancementsPacket,
|
||||
0x64: clientbound_update_attributes_packet::ClientboundUpdateAttributesPacket,
|
||||
0x68: clientbound_update_enabled_features_packet::ClientboundUpdateEnabledFeaturesPacket,
|
||||
0x69: clientbound_update_mob_effect_packet::ClientboundUpdateMobEffectPacket,
|
||||
0x6a: clientbound_update_recipes_packet::ClientboundUpdateRecipesPacket,
|
||||
0x6b: clientbound_update_tags_packet::ClientboundUpdateTagsPacket,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use crate::packets::game::clientbound_player_chat_packet::LastSeenMessagesUpdate;
|
||||
use azalea_buf::McBuf;
|
||||
use azalea_protocol_macros::ServerboundGamePacket;
|
||||
|
||||
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
|
||||
pub struct ServerboundChatAckPacket {
|
||||
pub last_seen_messages: LastSeenMessagesUpdate,
|
||||
#[var]
|
||||
pub offset: u32,
|
||||
}
|
||||
|
|
|
@ -1,22 +1,5 @@
|
|||
use azalea_buf::McBuf;
|
||||
use azalea_crypto::MessageSignature;
|
||||
use azalea_protocol_macros::ServerboundGamePacket;
|
||||
|
||||
use super::clientbound_player_chat_packet::LastSeenMessagesUpdate;
|
||||
|
||||
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
|
||||
pub struct ServerboundChatCommandPacket {
|
||||
pub command: String,
|
||||
// TODO: Choose a real timestamp type
|
||||
pub timestamp: u64,
|
||||
pub salt: u64,
|
||||
pub argument_signatures: Vec<ArgumentSignature>,
|
||||
pub signed_preview: bool,
|
||||
pub last_seen_messages: LastSeenMessagesUpdate,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, McBuf)]
|
||||
pub struct ArgumentSignature {
|
||||
pub name: String,
|
||||
pub signature: MessageSignature,
|
||||
}
|
||||
pub struct ServerboundChatCommandPacket {}
|
||||
|
|
|
@ -1,14 +1,5 @@
|
|||
use crate::packets::game::clientbound_player_chat_packet::LastSeenMessagesUpdate;
|
||||
use azalea_buf::McBuf;
|
||||
use azalea_crypto::MessageSignature;
|
||||
use azalea_protocol_macros::ServerboundGamePacket;
|
||||
|
||||
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
|
||||
pub struct ServerboundChatPacket {
|
||||
pub message: String,
|
||||
pub timestamp: u64,
|
||||
pub salt: u64,
|
||||
pub signature: MessageSignature,
|
||||
pub signed_preview: bool,
|
||||
pub last_seen_messages: LastSeenMessagesUpdate,
|
||||
}
|
||||
pub struct ServerboundChatPacket {}
|
||||
|
|
|
@ -2,37 +2,10 @@ use azalea_buf::McBuf;
|
|||
use azalea_protocol_macros::ServerboundLoginPacket;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Clone, Debug, ServerboundLoginPacket, McBuf, PartialEq, Eq)]
|
||||
#[derive(Clone, Debug, McBuf, ServerboundLoginPacket)]
|
||||
pub struct ServerboundHelloPacket {
|
||||
pub username: String,
|
||||
pub public_key: Option<ProfilePublicKeyData>,
|
||||
pub name: String,
|
||||
// TODO: {'field': 'b.b', 'operation': 'write', 'type': 'uuid'}
|
||||
pub chat_session: Option<(u64, u32, Vec<u8>, u32, Vec<u8>)>,
|
||||
pub profile_id: Option<Uuid>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, McBuf, PartialEq, Eq)]
|
||||
pub struct ProfilePublicKeyData {
|
||||
pub expires_at: u64,
|
||||
pub key: Vec<u8>,
|
||||
pub key_signature: Vec<u8>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::io::Cursor;
|
||||
|
||||
use super::*;
|
||||
use azalea_buf::{McBufReadable, McBufWritable};
|
||||
|
||||
#[test]
|
||||
fn test_read_write() {
|
||||
let packet = ServerboundHelloPacket {
|
||||
username: "test".to_string(),
|
||||
public_key: None,
|
||||
profile_id: Some(Uuid::from_u128(0)),
|
||||
};
|
||||
let mut buf: Vec<u8> = Vec::new();
|
||||
packet.write_into(&mut buf).unwrap();
|
||||
let packet2 = ServerboundHelloPacket::read_from(&mut Cursor::new(&buf)).unwrap();
|
||||
assert_eq!(packet, packet2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ use std::io::{Cursor, Write};
|
|||
|
||||
// TODO: rename the packet files to just like clientbound_add_entity instead of clientbound_add_entity_packet
|
||||
|
||||
pub const PROTOCOL_VERSION: u32 = 760;
|
||||
pub const PROTOCOL_VERSION: u32 = 1073741928;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub enum ConnectionProtocol {
|
||||
|
|
|
@ -80,8 +80,14 @@ def burger_type_to_rust_type(burger_type, field_name: Optional[str] = None, inst
|
|||
enum_first_part_name)
|
||||
print('enum_first_part_obfuscated_name',
|
||||
enum_first_part_obfuscated_name)
|
||||
enum_name = mappings.get_method_type(
|
||||
enum_first_part_obfuscated_name, enum_field.split('.')[1].split('(')[0], '')
|
||||
print('enum field', enum_field.split('.')[1].split('(')[0])
|
||||
try:
|
||||
enum_name = mappings.get_method_type(
|
||||
enum_first_part_obfuscated_name, enum_field.split('.')[1].split('(')[0], '')
|
||||
except KeyError:
|
||||
# sometimes enums are fields instead of methods
|
||||
enum_name = mappings.get_field_type(
|
||||
enum_first_part_obfuscated_name, enum_field.split('.')[1].split('(')[0])
|
||||
|
||||
print('hm', enum_name)
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue