todo to TODO

This commit is contained in:
lukas0008
2024-08-07 20:33:51 +02:00
parent fa8969d6a2
commit 2fd8686fea
9 changed files with 21 additions and 21 deletions

View File

@@ -1,6 +1,6 @@
use num_derive::ToPrimitive;
// todo
// TODO
#[derive(ToPrimitive, Clone)]
pub enum EntityType {
Zombie = 124,

View File

@@ -80,7 +80,7 @@ pub fn authenticate(
}
pub fn unpack_textures(property: Property, config: &TextureConfig) {
// todo: no unwrap
// TODO: no unwrap
let from64 = general_purpose::STANDARD.decode(property.value).unwrap();
let textures: ProfileTextures = serde_json::from_slice(&from64).unwrap();
dbg!(&textures);

View File

@@ -48,10 +48,10 @@ impl Client {
}
pub fn handle_login_start(&mut self, server: &mut Server, login_start: SLoginStart) {
// todo: do basic name validation
// TODO: do basic name validation
dbg!("login start");
// default game profile, when no online mode
// todo: make offline uuid
// TODO: make offline uuid
self.gameprofile = Some(GameProfile {
id: login_start.uuid,
name: login_start.name,
@@ -59,7 +59,7 @@ impl Client {
profile_actions: None,
});
// todo: check config for encryption
// TODO: check config for encryption
let verify_token: [u8; 4] = rand::random();
let public_key_der = &server.public_key_der;
let packet = CEncryptionRequest::new(

View File

@@ -136,7 +136,7 @@ impl Client {
pub fn teleport(&mut self, x: f64, y: f64, z: f64, yaw: f32, pitch: f32) {
assert!(self.is_player());
// todo
// TODO
let id = 0;
let player = self.player.as_mut().unwrap();
let entity = &mut player.entity;

View File

@@ -49,7 +49,7 @@ impl Client {
entity.x = position.x;
entity.y = position.feet_y;
entity.z = position.z;
// todo: teleport when moving > 8 block
// TODO: teleport when moving > 8 block
// send new position to all other players
let on_ground = player.on_ground;

View File

@@ -18,7 +18,7 @@ impl<'a> Command<'a> for GamemodeCommand {
let args: Vec<&str> = command.split_whitespace().collect();
if args.len() != 2 {
// todo red
// TODO: red
player.send_system_message("Usage: /gamemode <mode>".into());
return;
}
@@ -30,13 +30,13 @@ impl<'a> Command<'a> for GamemodeCommand {
player.send_system_message(format!("Set own game mode to {mode_str}").into());
}
Err(_) => {
// todo red
// TODO: red
player.send_system_message("Invalid gamemode".into());
}
}
}
// todo: support console, (name required)
// TODO: support console, (name required)
fn player_required() -> bool {
true
}

View File

@@ -29,7 +29,7 @@ pub enum CommandSender<'a> {
impl<'a> CommandSender<'a> {
pub fn send_message(&mut self, text: TextComponent) {
match self {
// todo: add color and stuff to console
// TODO: add color and stuff to console
CommandSender::Console => log::info!("{}", text.text),
CommandSender::Player(c) => c.send_system_message(text),
}
@@ -66,6 +66,6 @@ pub fn handle_command(sender: &mut CommandSender, command: String) {
GamemodeCommand::on_execute(sender, command);
return;
}
// todo: red color
// TODO: red color
sender.send_message("Command not Found".into());
}

View File

@@ -23,7 +23,7 @@ pub struct AdvancedConfiguration {
pub struct Commands {
/// Are commands from the Console accepted ?
pub use_console: bool,
// todo commands...
// TODO: commands...
}
impl Default for Commands {

View File

@@ -50,8 +50,8 @@ pub struct Server {
pub current_clients: HashMap<Rc<Token>, Rc<RefCell<Client>>>,
// todo replace with HashMap <World, Player>
entity_id: AtomicI32, // todo: place this into every world
// TODO: replace with HashMap <World, Player>
entity_id: AtomicI32, // TODO: place this into every world
pub base_config: BasicConfiguration,
pub advanced_config: AdvancedConfiguration,
@@ -66,7 +66,7 @@ impl Server {
.expect("Failed to parse Status response into JSON");
let cached_server_brand = Self::build_brand();
// todo, only create when needed
// TODO: only create when needed
let (public_key, private_key) = Self::generate_keys();
let public_key_der = rsa_der::public_key_to_der(
@@ -100,7 +100,7 @@ impl Server {
// Returns Tokens to remove
pub fn poll(&mut self, client: &mut Client, _poll: &Poll, event: &Event) {
// todo, Poll players in every world
// TODO: Poll players in every world
client.poll(self, event)
}
@@ -113,7 +113,7 @@ impl Server {
}
// here is where the magic happens
// todo: do this in a world
// TODO: do this in a world
pub fn spawn_player(&mut self, client: &mut Client) {
// This code follows the vanilla packet order
let entity_id = self.new_entity_id();
@@ -127,8 +127,8 @@ impl Server {
self.base_config.hardcore,
vec!["minecraft:overworld".into()],
self.base_config.max_players.into(),
self.base_config.view_distance.into(), // view distance todo
self.base_config.simulation_distance.into(), // sim view dinstance todo
self.base_config.view_distance.into(), // TODO: view distance
self.base_config.simulation_distance.into(), // TODO: sim view dinstance
false,
false,
false,
@@ -283,7 +283,7 @@ impl Server {
}
}
// todo: do this in a world
// TODO: do this in a world
fn _spawn_test_chunk(client: &mut Client) {
let test_chunk = TestChunk::new();
client.send_packet(CChunkDataUpdateLight::new(