Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

todo to TODO #22

Merged
merged 8 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pumpkin-entity/src/entity_type.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use num_derive::ToPrimitive;

// todo
// TODO
#[derive(ToPrimitive, Clone)]
pub enum EntityType {
Zombie = 124,
Expand Down
2 changes: 1 addition & 1 deletion pumpkin/src/client/authentication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions pumpkin/src/client/client_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ 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,
properties: vec![],
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(
Expand Down
2 changes: 1 addition & 1 deletion pumpkin/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion pumpkin/src/client/player_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions pumpkin/src/commands/gamemode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions pumpkin/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down Expand Up @@ -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());
}
2 changes: 1 addition & 1 deletion pumpkin/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
16 changes: 8 additions & 8 deletions pumpkin/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand All @@ -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(
Expand Down Expand Up @@ -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)
}

Expand All @@ -120,7 +120,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();
Expand All @@ -134,8 +134,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,
Expand Down Expand Up @@ -290,7 +290,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(
Expand Down