From 41fac573baf751d8117400a60836290b903143e8 Mon Sep 17 00:00:00 2001 From: Alexander Medvedev Date: Tue, 28 Jan 2025 14:05:17 +0100 Subject: [PATCH] Fix some typos --- pumpkin-config/src/networking/compression.rs | 2 +- pumpkin-data/build/build.rs | 6 ++--- pumpkin-data/build/message_type.rs | 4 ++-- .../{noise_parmeter.rs => noise_parameter.rs} | 6 ++--- pumpkin-data/src/lib.rs | 2 +- pumpkin-nbt/src/lib.rs | 2 +- pumpkin-nbt/src/serializer.rs | 2 +- pumpkin-world/src/generation/generator.rs | 2 +- pumpkin-world/src/level.rs | 2 +- pumpkin/src/block/blocks/crafting_table.rs | 2 +- pumpkin/src/block/blocks/mod.rs | 4 ++-- pumpkin/src/block/properties/slab.rs | 22 +++++++++---------- pumpkin/src/block/properties/stair.rs | 10 ++++----- pumpkin/src/command/commands/banlist.rs | 8 +++---- pumpkin/src/command/commands/title.rs | 2 +- pumpkin/src/entity/ai/path/mod.rs | 2 +- pumpkin/src/entity/mod.rs | 2 +- pumpkin/src/entity/player.rs | 2 +- pumpkin/src/net/rcon/packet.rs | 2 +- pumpkin/src/plugin/mod.rs | 4 ++-- pumpkin/src/world/mod.rs | 2 +- 21 files changed, 45 insertions(+), 45 deletions(-) rename pumpkin-data/build/{noise_parmeter.rs => noise_parameter.rs} (91%) diff --git a/pumpkin-config/src/networking/compression.rs b/pumpkin-config/src/networking/compression.rs index 7a7b22c81..a07c4959b 100644 --- a/pumpkin-config/src/networking/compression.rs +++ b/pumpkin-config/src/networking/compression.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; #[serde(default)] /// Packet compression pub struct CompressionConfig { - /// Wether compression is enabled + /// Whether compression is enabled pub enabled: bool, #[serde(flatten)] pub compression_info: CompressionInfo, diff --git a/pumpkin-data/build/build.rs b/pumpkin-data/build/build.rs index 0e5554d39..f5cb9c321 100644 --- a/pumpkin-data/build/build.rs +++ b/pumpkin-data/build/build.rs @@ -11,7 +11,7 @@ mod entity_pose; mod entity_type; mod game_event; mod message_type; -mod noise_parmeter; +mod noise_parameter; mod packet; mod particle; mod scoreboard_slot; @@ -32,7 +32,7 @@ pub fn main() { write_generated_file(scoreboard_slot::build(), "scoreboard_slot.rs"); write_generated_file(world_event::build(), "world_event.rs"); write_generated_file(entity_type::build(), "entity_type.rs"); - write_generated_file(noise_parmeter::build(), "noise_parmeter.rs"); + write_generated_file(noise_parameter::build(), "noise_parameter.rs"); write_generated_file(biome::build(), "biome.rs"); write_generated_file(message_type::build(), "message_type.rs"); } @@ -54,7 +54,7 @@ pub fn write_generated_file(content: TokenStream, out_file: &str) { let path = Path::new(&out_dir).join(out_file); let code = content.to_string(); - fs::write(&path, code).expect("Faile to write to fs"); + fs::write(&path, code).expect("Failed to write to fs"); // Try to format the output for debugging purposes. // Doesn't matter if rustfmt is unavailable. diff --git a/pumpkin-data/build/message_type.rs b/pumpkin-data/build/message_type.rs index 1403608cd..71086bc5c 100644 --- a/pumpkin-data/build/message_type.rs +++ b/pumpkin-data/build/message_type.rs @@ -35,8 +35,8 @@ pub(crate) fn build() -> TokenStream { .expect("Failed to parse message_type.json"); let mut variants = TokenStream::new(); - for (name, paremter) in json.iter() { - let i = paremter.id; + for (name, typee) in json.iter() { + let i = typee.id; let name = ident(name.to_uppercase()); variants.extend([quote! { pub const #name: u32 = #i; diff --git a/pumpkin-data/build/noise_parmeter.rs b/pumpkin-data/build/noise_parameter.rs similarity index 91% rename from pumpkin-data/build/noise_parmeter.rs rename to pumpkin-data/build/noise_parameter.rs index 4a6bbf9ed..1a113cfa2 100644 --- a/pumpkin-data/build/noise_parmeter.rs +++ b/pumpkin-data/build/noise_parameter.rs @@ -21,11 +21,11 @@ pub(crate) fn build() -> TokenStream { .expect("Failed to parse noise_parameters.json"); let mut variants = TokenStream::new(); - for (name, paremter) in json.iter() { + for (name, parameter) in json.iter() { let raw_name = format!("minecraft:{name}"); let name = ident(name.to_uppercase()); - let first_octave = paremter.first_octave; - let amplitudes = &paremter.amplitudes; + let first_octave = parameter.first_octave; + let amplitudes = ¶meter.amplitudes; variants.extend([quote! { pub const #name: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new(#first_octave, &[#(#amplitudes),*], #raw_name); }]); diff --git a/pumpkin-data/src/lib.rs b/pumpkin-data/src/lib.rs index a51194ed6..6cca51aa5 100644 --- a/pumpkin-data/src/lib.rs +++ b/pumpkin-data/src/lib.rs @@ -17,7 +17,7 @@ pub mod sound { pub mod chunk { include!(concat!(env!("OUT_DIR"), "/biome.rs")); - include!(concat!(env!("OUT_DIR"), "/noise_parmeter.rs")); + include!(concat!(env!("OUT_DIR"), "/noise_parameter.rs")); include!(concat!(env!("OUT_DIR"), "/chunk_status.rs")); } diff --git a/pumpkin-nbt/src/lib.rs b/pumpkin-nbt/src/lib.rs index 5ed48da9b..36d724e96 100644 --- a/pumpkin-nbt/src/lib.rs +++ b/pumpkin-nbt/src/lib.rs @@ -221,7 +221,7 @@ mod test { } #[test] - fn test_simple_ser_de_unamed() { + fn test_simple_ser_de_unnamed() { let test = Test { byte: 123, short: 1342, diff --git a/pumpkin-nbt/src/serializer.rs b/pumpkin-nbt/src/serializer.rs index 7fb59cdbd..c150d5f32 100644 --- a/pumpkin-nbt/src/serializer.rs +++ b/pumpkin-nbt/src/serializer.rs @@ -87,7 +87,7 @@ where value.serialize(&mut serializer)?; Ok(serializer.output) } -/// Serializes struct using Serde Serializer to unamed NBT +/// Serializes struct using Serde Serializer to unnamed NBT pub fn to_writer_unnamed(value: &T, mut writer: W) -> Result<()> where T: Serialize, diff --git a/pumpkin-world/src/generation/generator.rs b/pumpkin-world/src/generation/generator.rs index e30ac46a8..877edc7a5 100644 --- a/pumpkin-world/src/generation/generator.rs +++ b/pumpkin-world/src/generation/generator.rs @@ -41,7 +41,7 @@ pub(crate) trait PerlinTerrainGenerator: Sync + Send { fn prepare_chunk(&self, at: &Vector2, perlin: &Perlin); - /// Dependens on the perlin noise height + /// Depends on the perlin noise height fn generate_block( &self, coordinates: ChunkRelativeBlockCoordinates, diff --git a/pumpkin-world/src/level.rs b/pumpkin-world/src/level.rs index 223e5d41d..d1ee64db7 100644 --- a/pumpkin-world/src/level.rs +++ b/pumpkin-world/src/level.rs @@ -61,7 +61,7 @@ impl Level { region_folder, }; - // if we fail to lock, lets crash ???. maybe not the best soultion when we have a large server with many worlds and one is locked. + // if we fail to lock, lets crash ???. maybe not the best solution when we have a large server with many worlds and one is locked. // So TODO let locker = AnvilLevelLocker::look(&level_folder).expect("Failed to lock level"); diff --git a/pumpkin/src/block/blocks/crafting_table.rs b/pumpkin/src/block/blocks/crafting_table.rs index 236442dd0..48ee3cdca 100644 --- a/pumpkin/src/block/blocks/crafting_table.rs +++ b/pumpkin/src/block/blocks/crafting_table.rs @@ -65,7 +65,7 @@ impl PumpkinBlock for CraftingTableBlock { container.remove_player(entity_id); - // TODO: items should be re-added to player inventory or dropped dependending on if they are in movement. + // TODO: items should be re-added to player inventory or dropped depending on if they are in movement. // TODO: unique containers should be implemented as a separate stack internally (optimizes large player servers for example) // TODO: ephemeral containers (crafting tables) might need to be separate data structure than stored (ender chest) } diff --git a/pumpkin/src/block/blocks/mod.rs b/pumpkin/src/block/blocks/mod.rs index 1a4d452f1..d658bfd03 100644 --- a/pumpkin/src/block/blocks/mod.rs +++ b/pumpkin/src/block/blocks/mod.rs @@ -86,7 +86,7 @@ pub async fn standard_open_container_unique( if id_to_use == -1 { let new_id = server.new_container_id(); - log::debug!("Creating new unqiue container ID: {}", new_id); + log::debug!("Creating new unique container ID: {}", new_id); let open_container = OpenContainer::new_empty_container::( entity_id, Some(location), @@ -97,7 +97,7 @@ pub async fn standard_open_container_unique( player.open_container.store(Some(new_id.into())); } else { - log::debug!("Using previous unqiue container ID: {}", id_to_use); + log::debug!("Using previous unique container ID: {}", id_to_use); if let Some(unique_container) = open_containers.get_mut(&(id_to_use as u64)) { unique_container.set_location(Some(location)).await; unique_container.add_player(entity_id); diff --git a/pumpkin/src/block/properties/slab.rs b/pumpkin/src/block/properties/slab.rs index 133045c93..2b6cefaac 100644 --- a/pumpkin/src/block/properties/slab.rs +++ b/pumpkin/src/block/properties/slab.rs @@ -72,24 +72,24 @@ impl SlabBehavior { } } - pub fn evalute_property_type( + pub fn evaluate_property_type( block: &Block, clicked_block: &Block, - face: &BlockFace, + face: BlockFace, use_item_on: &SUseItemOn, ) -> String { - if block.id == clicked_block.id && face == &BlockFace::Top { + if block.id == clicked_block.id && face == BlockFace::Top { return format!("{}{}", "type", "double"); } - if face == &BlockFace::Top { + if face == BlockFace::Top { return format!("{}{}", "type", "bottom"); } - if face == &BlockFace::North - || face == &BlockFace::South - || face == &BlockFace::West - || face == &BlockFace::East + if face == BlockFace::North + || face == BlockFace::South + || face == BlockFace::West + || face == BlockFace::East { let y_pos = use_item_on.cursor_pos.y; if y_pos > 0.5 { @@ -102,7 +102,7 @@ impl SlabBehavior { format!("{}{}", "type", "bottom") } - pub fn evalute_property_waterlogged(block: &Block) -> String { + pub fn evaluate_property_waterlogged(block: &Block) -> String { if block.name == "water" { return format!("{}{}", "waterlogged", "true"); } @@ -129,9 +129,9 @@ impl BlockBehavior for SlabBehavior { let state = match get_property_key(property.name.as_str()).expect("Property not found") { BlockProperty::SlabType(_) => { - Self::evalute_property_type(block, clicked_block, face, use_item_on) + Self::evaluate_property_type(block, clicked_block, *face, use_item_on) } - BlockProperty::Waterlogged(false) => Self::evalute_property_waterlogged(block), + BlockProperty::Waterlogged(false) => Self::evaluate_property_waterlogged(block), _ => panic!("Property not found"), }; hmap_key.push(state.to_string()); diff --git a/pumpkin/src/block/properties/stair.rs b/pumpkin/src/block/properties/stair.rs index 35d2c6a4d..3cb4b000c 100644 --- a/pumpkin/src/block/properties/stair.rs +++ b/pumpkin/src/block/properties/stair.rs @@ -144,7 +144,7 @@ impl StairBehavior { use_item_on: &SUseItemOn, player_direction: &Direction, ) -> String { - let block_half = Self::evaluate_property_half(face, use_item_on); + let block_half = Self::evaluate_property_half(*face, use_item_on); let (front_block_pos, back_block_pos) = Self::calculate_positions(player_direction, block_pos); @@ -247,7 +247,7 @@ impl StairBehavior { format!("{}{}", "waterlogged", "false") } - pub fn evaluate_property_facing(face: &BlockFace, player_direction: &Direction) -> String { + pub fn evaluate_property_facing(face: BlockFace, player_direction: &Direction) -> String { let facing = match face { BlockFace::North => "south", BlockFace::South => "north", @@ -264,7 +264,7 @@ impl StairBehavior { format!("facing{facing}") } - pub fn evaluate_property_half(face: &BlockFace, use_item_on: &SUseItemOn) -> String { + pub fn evaluate_property_half(face: BlockFace, use_item_on: &SUseItemOn) -> String { match face { BlockFace::Top => format!("{}{}", "half", "bottom"), BlockFace::Bottom => format!("{}{}", "half", "top"), @@ -297,8 +297,8 @@ impl BlockBehavior for StairBehavior { for property in &block.properties { let state = match get_property_key(property.name.as_str()).expect("Property not found") { - BlockProperty::Facing(_) => Self::evaluate_property_facing(face, player_direction), - BlockProperty::Half(_) => Self::evaluate_property_half(face, use_item_on), + BlockProperty::Facing(_) => Self::evaluate_property_facing(*face, player_direction), + BlockProperty::Half(_) => Self::evaluate_property_half(*face, use_item_on), BlockProperty::StairShape(_) => { Self::evaluate_property_shape( world, diff --git a/pumpkin/src/command/commands/banlist.rs b/pumpkin/src/command/commands/banlist.rs index 46f1744ea..731d2506f 100644 --- a/pumpkin/src/command/commands/banlist.rs +++ b/pumpkin/src/command/commands/banlist.rs @@ -33,7 +33,7 @@ impl CommandExecutor for BanListExecutor { match *list_type { "ips" => { let lock = &BANNED_IP_LIST.read().await; - let entires = lock + let entries = lock .banned_ips .iter() .map(|entry| { @@ -45,11 +45,11 @@ impl CommandExecutor for BanListExecutor { }) .collect(); - handle_banlist(entires, sender).await; + handle_banlist(entries, sender).await; } "players" => { let lock = &BANNED_PLAYER_LIST.read().await; - let entires = lock + let entries = lock .banned_players .iter() .map(|entry| { @@ -61,7 +61,7 @@ impl CommandExecutor for BanListExecutor { }) .collect(); - handle_banlist(entires, sender).await; + handle_banlist(entries, sender).await; } _ => { return Err(CommandError::GeneralCommandIssue( diff --git a/pumpkin/src/command/commands/title.rs b/pumpkin/src/command/commands/title.rs index 4aae50d09..43241bb85 100644 --- a/pumpkin/src/command/commands/title.rs +++ b/pumpkin/src/command/commands/title.rs @@ -22,7 +22,7 @@ const ARG_TARGETS: &str = "targets"; const ARG_TITLE: &str = "title"; -/// bool: Wether to reset or not +/// bool: Whether to reset or not struct ClearOrResetExecutor(bool); #[async_trait] diff --git a/pumpkin/src/entity/ai/path/mod.rs b/pumpkin/src/entity/ai/path/mod.rs index f0c656c23..e48b4e1b8 100644 --- a/pumpkin/src/entity/ai/path/mod.rs +++ b/pumpkin/src/entity/ai/path/mod.rs @@ -56,7 +56,7 @@ impl Navigator { } } - // this is important, first this saves us many packets when we don't actually move, and secound this prevents division using zero + // this is important, first this saves us many packets when we don't actually move, and second this prevents division using zero // when normalize if best_move.x == 0.0 && best_move.z == 0.0 { return; diff --git a/pumpkin/src/entity/mod.rs b/pumpkin/src/entity/mod.rs index c1d38ab49..b3e6a035b 100644 --- a/pumpkin/src/entity/mod.rs +++ b/pumpkin/src/entity/mod.rs @@ -38,7 +38,7 @@ pub type EntityId = i32; pub struct Entity { /// A unique identifier for the entity pub entity_id: EntityId, - /// A persistant, unique identifier for the entity + /// A persistent, unique identifier for the entity pub entity_uuid: uuid::Uuid, /// The type of entity (e.g., player, zombie, item) pub entity_type: EntityType, diff --git a/pumpkin/src/entity/player.rs b/pumpkin/src/entity/player.rs index 70de39b94..282d99b27 100644 --- a/pumpkin/src/entity/player.rs +++ b/pumpkin/src/entity/player.rs @@ -121,7 +121,7 @@ pub struct Player { pub watched_section: AtomicCell, /// Did we send a keep alive Packet and wait for the response? pub wait_for_keep_alive: AtomicBool, - /// Whats the keep alive packet payload we send, The client should responde with the same id + /// Whats the keep alive packet payload we send, The client should respond with the same id pub keep_alive_id: AtomicI64, /// Last time we send a keep alive pub last_keep_alive_time: AtomicCell, diff --git a/pumpkin/src/net/rcon/packet.rs b/pumpkin/src/net/rcon/packet.rs index eb685bec2..6e976b4e5 100644 --- a/pumpkin/src/net/rcon/packet.rs +++ b/pumpkin/src/net/rcon/packet.rs @@ -33,7 +33,7 @@ impl ServerboundPacket { /// Server -> Client pub enum ClientboundPacket { /// This packet is a notification of the connection's current auth status. When the server receives an auth request, it will respond with an empty `SERVERDATA_RESPONSE_VALUE`, - /// followed immediately by a `SERVERDATA_AUTH_RESPONSE` indicating whether authentication succeeded or failed. Note that the status code is returned in the packet id field, so when pairing the response with the original auth request, you may need to look at the packet id of the preceeding `SERVERDATA_RESPONSE_VALUE`. + /// followed immediately by a `SERVERDATA_AUTH_RESPONSE` indicating whether authentication succeeded or failed. Note that the status code is returned in the packet id field, so when pairing the response with the original auth request, you may need to look at the packet id of the `SERVERDATA_RESPONSE_VALUE`. AuthResponse = 2, /// A `SERVERDATA_RESPONSE` packet is the response to a `SERVERDATA_EXECCOMMAND` request. Output = 0, diff --git a/pumpkin/src/plugin/mod.rs b/pumpkin/src/plugin/mod.rs index 16288d2a6..e8b0ac7da 100644 --- a/pumpkin/src/plugin/mod.rs +++ b/pumpkin/src/plugin/mod.rs @@ -118,9 +118,9 @@ impl PluginManager { fs::create_dir(PLUGIN_DIR).unwrap(); } - let dir_entires = fs::read_dir(PLUGIN_DIR); + let dir_entries = fs::read_dir(PLUGIN_DIR); - for entry in dir_entires.unwrap() { + for entry in dir_entries.unwrap() { if !entry.as_ref().unwrap().path().is_file() { continue; } diff --git a/pumpkin/src/world/mod.rs b/pumpkin/src/world/mod.rs index 9d7551da8..6db6750e7 100644 --- a/pumpkin/src/world/mod.rs +++ b/pumpkin/src/world/mod.rs @@ -240,7 +240,7 @@ impl World { for player in self.current_players.lock().await.values() { player.tick().await; } - // entites tick + // entities tick for entity in self.current_living_mobs.lock().await.values() { entity.tick().await; }