File tree Expand file tree Collapse file tree 2 files changed +3
-35
lines changed Expand file tree Collapse file tree 2 files changed +3
-35
lines changed Original file line number Diff line number Diff line change @@ -145,38 +145,6 @@ where
145
145
}
146
146
}
147
147
148
- /// This implementation assumes that the optional was written using PacketByteBuf#writeNullable and has a leading bool.
149
- impl < T > NetDecode for Option < T >
150
- where
151
- T : NetDecode ,
152
- {
153
- fn decode < R : Read > ( reader : & mut R , opts : & NetDecodeOpts ) -> Result < Self , NetDecodeError > {
154
- let is_some = <bool as NetDecode >:: decode ( reader, opts) ?;
155
-
156
- if !is_some {
157
- return Ok ( None ) ;
158
- }
159
-
160
- let value = <T as NetDecode >:: decode ( reader, opts) ?;
161
-
162
- Ok ( Some ( value) )
163
- }
164
-
165
- async fn decode_async < R : AsyncRead + Unpin > (
166
- reader : & mut R ,
167
- opts : & NetDecodeOpts ,
168
- ) -> Result < Self , NetDecodeError > {
169
- let is_some = <bool as NetDecode >:: decode_async ( reader, opts) . await ?;
170
- if !is_some {
171
- return Ok ( None ) ;
172
- }
173
-
174
- let value = <T as NetDecode >:: decode_async ( reader, opts) . await ?;
175
-
176
- Ok ( Some ( value) )
177
- }
178
- }
179
-
180
148
/// This isn't actually a type in the Minecraft Protocol. This is just for saving data/ or for general use.
181
149
/// It was created for saving/reading chunks!
182
150
impl < K , V > NetDecode for HashMap < K , V >
Original file line number Diff line number Diff line change 1
1
use ferrumc_macros:: { packet, NetDecode } ;
2
- use ferrumc_net_codec:: net_types:: var_int:: VarInt ;
2
+ use ferrumc_net_codec:: net_types:: { prefixed_optional :: PrefixedOptional , var_int:: VarInt } ;
3
3
4
- #[ derive( NetDecode , Debug , Clone ) ]
4
+ #[ derive( NetDecode ) ]
5
5
#[ packet( packet_id = "chat" , state = "play" ) ]
6
6
pub struct ChatMessagePacket {
7
7
pub message : String ,
8
8
pub timestamp : u64 ,
9
9
pub salt : u64 ,
10
10
pub has_signature : bool ,
11
- pub signature : Option < Vec < u64 > > ,
11
+ pub signature : PrefixedOptional < Vec < u64 > > ,
12
12
pub message_count : VarInt ,
13
13
pub acknowledged : Vec < u8 > ,
14
14
}
You can’t perform that action at this time.
0 commit comments