-
-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
23 changed files
with
446 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use num_derive::ToPrimitive; | ||
use pumpkin_macros::packet; | ||
use serde::Serialize; | ||
|
||
use crate::VarInt; | ||
|
||
#[derive(Serialize, Clone)] | ||
#[packet(0x03)] | ||
pub struct CEntityAnimation { | ||
entity_id: VarInt, | ||
/// See `Animation` | ||
animation: u8, | ||
} | ||
|
||
impl CEntityAnimation { | ||
pub fn new(entity_id: VarInt, animation: u8) -> Self { | ||
Self { | ||
entity_id, | ||
animation, | ||
} | ||
} | ||
} | ||
|
||
#[derive(ToPrimitive)] | ||
pub enum Animation { | ||
SwingMainArm, | ||
LeaveBed, | ||
SwingOffhand, | ||
CriticalEffect, | ||
MagicCriticaleffect, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use pumpkin_macros::packet; | ||
use serde::Serialize; | ||
|
||
use crate::VarInt; | ||
|
||
#[derive(Serialize, Clone)] | ||
#[packet(0x58)] | ||
pub struct CSetEntityMetadata { | ||
entity_id: VarInt, | ||
metadata: Vec<Metadata>, | ||
} | ||
|
||
impl CSetEntityMetadata { | ||
pub fn new(entity_id: VarInt, metadata: Vec<Metadata>) -> Self { | ||
Self { | ||
entity_id, | ||
metadata, | ||
} | ||
} | ||
} | ||
|
||
#[derive(Serialize, Clone)] | ||
pub struct Metadata { | ||
index: u8, | ||
typ: VarInt, | ||
value: u8, | ||
} | ||
|
||
impl Metadata { | ||
pub fn new(index: u8, typ: VarInt, value: u8) -> Self { | ||
Self { index, typ, value } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
use num_derive::FromPrimitive; | ||
use serde::Serialize; | ||
|
||
use crate::{text::TextComponent, VarInt}; | ||
|
||
#[derive(Serialize)] | ||
pub struct PlayerChatMessage<'a> { | ||
sender: uuid::Uuid, | ||
index: VarInt, | ||
message_signature: Option<&'a [u8]>, | ||
message: String, | ||
timestamp: i64, | ||
salt: i64, | ||
previous_messages: &'a [PreviousMessage<'a>], // max 20 | ||
unsigned_content: Option<TextComponent>, | ||
/// See `FilterType` | ||
filter_type: VarInt, | ||
chat_type: VarInt, | ||
sender_name: TextComponent, | ||
target_name: Option<TextComponent>, | ||
} | ||
|
||
impl<'a> PlayerChatMessage<'a> { | ||
#[allow(clippy::too_many_arguments)] | ||
pub fn new( | ||
sender: uuid::Uuid, | ||
index: VarInt, | ||
message_signature: Option<&'a [u8]>, | ||
message: String, | ||
timestamp: i64, | ||
salt: i64, | ||
previous_messages: &'a [PreviousMessage<'a>], | ||
unsigned_content: Option<TextComponent>, | ||
filter_type: VarInt, | ||
chat_type: VarInt, | ||
sender_name: TextComponent, | ||
target_name: Option<TextComponent>, | ||
) -> Self { | ||
Self { | ||
sender, | ||
index, | ||
message_signature, | ||
message, | ||
timestamp, | ||
salt, | ||
previous_messages, | ||
unsigned_content, | ||
filter_type, | ||
chat_type, | ||
sender_name, | ||
target_name, | ||
} | ||
} | ||
} | ||
|
||
#[derive(Serialize)] | ||
pub struct PreviousMessage<'a> { | ||
message_id: VarInt, | ||
signature: Option<&'a [u8]>, | ||
} | ||
|
||
#[derive(FromPrimitive)] | ||
pub enum FilterType { | ||
/// Message is not filtered at all | ||
PassThrough, | ||
/// Message is fully filtered | ||
FullyFiltered, | ||
/// Only some characters in the message are filtered | ||
PartiallyFiltered, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.