this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Change api.rs function's comments to be viewable like documentation

Rouffy cbc3722b 184c3a39

+9 -9
+9 -9
src/api.rs
··· 6 6 7 7 use crate::{types::packet::PacketBuilder, types::prefixed_array::PrefixedArray}; 8 8 9 - // Used as the first ever packet sent for the TCP connection, to set the intent that the connection will use 9 + /// Used as the first ever packet sent for the TCP connection, to set the intent that the connection will use 10 10 pub fn sb_handshake(intent: i32, stream: &mut TcpStream) { 11 11 let packet = PacketBuilder::new(Some(0x00)) 12 12 .add_varint(772) ··· 19 19 stream.flush().unwrap(); 20 20 } 21 21 22 - // Request server information ( Intent must be set to 1 when calling sb_handshake) 22 + /// Request server information ( Intent must be set to 1 when calling sb_handshake) 23 23 #[allow(dead_code)] 24 24 fn sb_status() { 25 25 let mut stream = TcpStream::connect("127.0.0.1:25565").unwrap(); ··· 30 30 stream.flush().unwrap(); 31 31 } 32 32 33 - // Good to have for crash logs 33 + /// Good to have for crash logs 34 34 pub fn sb_client_brand(stream: &mut TcpStream) { 35 35 let packet = PacketBuilder::new(Some(0x02)) 36 36 .add_string("minecraft:brand") ··· 41 41 stream.flush().unwrap(); 42 42 } 43 43 44 - // Used to login into the minecraft server ( Intent must be set to 2 when calling sb_handshake 44 + /// Used to login into the minecraft server ( Intent must be set to 2 when calling sb_handshake 45 45 pub fn sb_login(stream: &mut TcpStream) { 46 46 sb_handshake(2, stream); 47 47 ··· 59 59 stream.flush().unwrap(); 60 60 } 61 61 62 - // After receiving succesful login response from the server confirm that it has been received 62 + /// After receiving succesful login response from the server confirm that it has been received 63 63 pub fn sb_login_acknowledged(stream: &mut TcpStream) { 64 64 let packet = PacketBuilder::new(Some(0x03)).build(); 65 65 ··· 67 67 stream.flush().unwrap(); 68 68 } 69 69 70 - // After logging in we need to stay connected to the server while answering a keep alive hearbeats 70 + /// After logging in we need to stay connected to the server while answering a keep alive hearbeats 71 71 pub fn sb_keep_alive(stream: &mut TcpStream, buffer: Vec<u8>) { 72 72 let mut packet = PacketBuilder::new(None).add_slice(&buffer).build(); 73 73 ··· 75 75 stream.flush().unwrap(); 76 76 } 77 77 78 - // Declares player settings when they connect 78 + /// Declares player settings when they connect 79 79 pub fn sb_client_information(stream: &mut TcpStream) { 80 80 let packet = PacketBuilder::new(Some(0x00)) 81 81 .add_string("en_us") ··· 93 93 stream.flush().unwrap(); 94 94 } 95 95 96 - // Declares the known packs to the server ( Required for configuration to finalize) 96 + /// Declares the known packs to the server ( Required for configuration to finalize) 97 97 pub fn sb_known_packs(stream: &mut TcpStream) { 98 98 let packet = PacketBuilder::new(Some(0x07)) 99 99 .add_slice( ··· 107 107 stream.flush().unwrap(); 108 108 } 109 109 110 - // Tells the server that the configuration confirmation has been received and we can proceed to the next state 110 + /// Tells the server that the configuration confirmation has been received and we can proceed to the next state 111 111 pub fn sb_acknowledge_finish_configuration(stream: &mut TcpStream) { 112 112 let mut packet = PacketBuilder::new(Some(0x03)).build(); 113 113 stream.write_all(&mut packet).unwrap();