aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-protocol/src')
-rwxr-xr-xazalea-protocol/src/mc_buf/mod.rs6
-rwxr-xr-xazalea-protocol/src/packets/game/mod.rs5
-rw-r--r--azalea-protocol/src/packets/game/serverbound_custom_payload_packet.rs11
3 files changed, 21 insertions, 1 deletions
diff --git a/azalea-protocol/src/mc_buf/mod.rs b/azalea-protocol/src/mc_buf/mod.rs
index 4048bae7..d50817fb 100755
--- a/azalea-protocol/src/mc_buf/mod.rs
+++ b/azalea-protocol/src/mc_buf/mod.rs
@@ -32,6 +32,12 @@ impl From<Vec<u8>> for UnsizedByteArray {
}
}
+impl From<&str> for UnsizedByteArray {
+ fn from(s: &str) -> Self {
+ Self(s.as_bytes().to_vec())
+ }
+}
+
/// Represents Java's BitSet, a list of bits.
#[derive(Debug, Clone, PartialEq, Eq, Hash, McBufReadable, McBufWritable)]
pub struct BitSet {
diff --git a/azalea-protocol/src/packets/game/mod.rs b/azalea-protocol/src/packets/game/mod.rs
index 4b8132f1..aac1a9a0 100755
--- a/azalea-protocol/src/packets/game/mod.rs
+++ b/azalea-protocol/src/packets/game/mod.rs
@@ -16,12 +16,15 @@ pub mod clientbound_set_chunk_cache_center;
pub mod clientbound_update_recipes_packet;
pub mod clientbound_update_tags_packet;
pub mod clientbound_update_view_distance_packet;
+pub mod serverbound_custom_payload_packet;
use packet_macros::declare_state_packets;
declare_state_packets!(
GamePacket,
- Serverbound => {},
+ Serverbound => {
+ 0x0a: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket,
+ },
Clientbound => {
0x02: clientbound_add_mob_packet::ClientboundAddMobPacket,
0x0e: clientbound_change_difficulty_packet::ClientboundChangeDifficultyPacket,
diff --git a/azalea-protocol/src/packets/game/serverbound_custom_payload_packet.rs b/azalea-protocol/src/packets/game/serverbound_custom_payload_packet.rs
new file mode 100644
index 00000000..43ddb700
--- /dev/null
+++ b/azalea-protocol/src/packets/game/serverbound_custom_payload_packet.rs
@@ -0,0 +1,11 @@
+// i don't know the actual name of this packet, i couldn't find it in the source code
+
+use crate::mc_buf::UnsizedByteArray;
+use azalea_core::resource_location::ResourceLocation;
+use packet_macros::GamePacket;
+
+#[derive(Clone, Debug, GamePacket)]
+pub struct ServerboundCustomPayloadPacket {
+ pub identifier: ResourceLocation,
+ pub data: UnsizedByteArray,
+}