-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Begin Refactoring Clientbound Packets to new structure
See #19 for details
- Loading branch information
Showing
14 changed files
with
76 additions
and
151 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,15 @@ | ||
use pumpkin_macros::packet; | ||
use serde::Serialize; | ||
|
||
use crate::{bytebuf::ByteBuffer, ClientPacket}; | ||
|
||
#[derive(Serialize)] | ||
#[packet(0x00)] | ||
pub struct CLoginDisconnect<'a> { | ||
reason: &'a str, | ||
json_reason: &'a str, | ||
} | ||
|
||
impl<'a> CLoginDisconnect<'a> { | ||
pub fn new(reason: &'a str) -> Self { | ||
Self { reason } | ||
} | ||
} | ||
|
||
impl<'a> ClientPacket for CLoginDisconnect<'a> { | ||
fn write(&self, bytebuf: &mut ByteBuffer) { | ||
bytebuf.put_string(&serde_json::to_string_pretty(&self.reason).unwrap()); | ||
// input json! | ||
pub fn new(json_reason: &'a str) -> Self { | ||
Self { json_reason } | ||
} | ||
} |
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 |
---|---|---|
@@ -1,20 +1,16 @@ | ||
use pumpkin_macros::packet; | ||
use serde::Serialize; | ||
|
||
use crate::{bytebuf::ByteBuffer, ClientPacket, VarInt}; | ||
use crate::VarInt32; | ||
|
||
#[derive(Serialize)] | ||
#[packet(0x03)] | ||
pub struct CSetCompression { | ||
threshold: VarInt, | ||
threshold: VarInt32, | ||
} | ||
|
||
impl CSetCompression { | ||
pub fn new(threshold: VarInt) -> Self { | ||
pub fn new(threshold: VarInt32) -> Self { | ||
Self { threshold } | ||
} | ||
} | ||
|
||
impl ClientPacket for CSetCompression { | ||
fn write(&self, bytebuf: &mut ByteBuffer) { | ||
bytebuf.put_var_int(self.threshold); | ||
} | ||
} |
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
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
Oops, something went wrong.