File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -679,6 +679,37 @@ impl Server {
679679
680680 fn on_plugin_message_clientbound ( & mut self , channel : & str , data : & [ u8 ] ) {
681681 println ! ( "Received plugin message: channel={}, data={:?}" , channel, data) ;
682+
683+ match channel {
684+ // TODO: "REGISTER" =>
685+ // TODO: "UNREGISTER" =>
686+ "FML|HS" => {
687+ // https://wiki.vg/Minecraft_Forge_Handshake
688+ let discriminator = data[ 0 ] ;
689+
690+ match discriminator {
691+ 0 => {
692+ // ServerHello
693+ let fml_protocol_version = data[ 1 ] ;
694+ let dimension = if fml_protocol_version > 1 {
695+ use byteorder:: { BigEndian , ReadBytesExt } ;
696+ let dimension = ( & data[ 2 ..2 + 4 ] ) . read_u32 :: < BigEndian > ( ) . unwrap ( ) ;
697+ Some ( dimension)
698+ } else {
699+ None
700+ } ;
701+
702+ println ! ( "FML|HS ServerHello: fml_protocol_version={}, dimension={:?}" , fml_protocol_version, dimension) ;
703+
704+ // TODO: send reply
705+ } ,
706+ _ => {
707+ println ! ( "Unhandled FML|HS packet: discriminator={}" , discriminator) ;
708+ }
709+ }
710+ }
711+ _ => ( )
712+ }
682713 }
683714
684715 fn on_game_join_i32_viewdistance ( & mut self , join : packet:: play:: clientbound:: JoinGame_i32_ViewDistance ) {
You can’t perform that action at this time.
0 commit comments