Fix some typos

This commit is contained in:
Alexander Medvedev 2025-01-28 14:05:17 +01:00
parent f63034e3a1
commit 41fac573ba
21 changed files with 45 additions and 45 deletions

View File

@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
#[serde(default)] #[serde(default)]
/// Packet compression /// Packet compression
pub struct CompressionConfig { pub struct CompressionConfig {
/// Wether compression is enabled /// Whether compression is enabled
pub enabled: bool, pub enabled: bool,
#[serde(flatten)] #[serde(flatten)]
pub compression_info: CompressionInfo, pub compression_info: CompressionInfo,

View File

@ -11,7 +11,7 @@ mod entity_pose;
mod entity_type; mod entity_type;
mod game_event; mod game_event;
mod message_type; mod message_type;
mod noise_parmeter; mod noise_parameter;
mod packet; mod packet;
mod particle; mod particle;
mod scoreboard_slot; mod scoreboard_slot;
@ -32,7 +32,7 @@ pub fn main() {
write_generated_file(scoreboard_slot::build(), "scoreboard_slot.rs"); write_generated_file(scoreboard_slot::build(), "scoreboard_slot.rs");
write_generated_file(world_event::build(), "world_event.rs"); write_generated_file(world_event::build(), "world_event.rs");
write_generated_file(entity_type::build(), "entity_type.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(biome::build(), "biome.rs");
write_generated_file(message_type::build(), "message_type.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 path = Path::new(&out_dir).join(out_file);
let code = content.to_string(); 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. // Try to format the output for debugging purposes.
// Doesn't matter if rustfmt is unavailable. // Doesn't matter if rustfmt is unavailable.

View File

@ -35,8 +35,8 @@ pub(crate) fn build() -> TokenStream {
.expect("Failed to parse message_type.json"); .expect("Failed to parse message_type.json");
let mut variants = TokenStream::new(); let mut variants = TokenStream::new();
for (name, paremter) in json.iter() { for (name, typee) in json.iter() {
let i = paremter.id; let i = typee.id;
let name = ident(name.to_uppercase()); let name = ident(name.to_uppercase());
variants.extend([quote! { variants.extend([quote! {
pub const #name: u32 = #i; pub const #name: u32 = #i;

View File

@ -21,11 +21,11 @@ pub(crate) fn build() -> TokenStream {
.expect("Failed to parse noise_parameters.json"); .expect("Failed to parse noise_parameters.json");
let mut variants = TokenStream::new(); let mut variants = TokenStream::new();
for (name, paremter) in json.iter() { for (name, parameter) in json.iter() {
let raw_name = format!("minecraft:{name}"); let raw_name = format!("minecraft:{name}");
let name = ident(name.to_uppercase()); let name = ident(name.to_uppercase());
let first_octave = paremter.first_octave; let first_octave = parameter.first_octave;
let amplitudes = &paremter.amplitudes; let amplitudes = &parameter.amplitudes;
variants.extend([quote! { variants.extend([quote! {
pub const #name: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new(#first_octave, &[#(#amplitudes),*], #raw_name); pub const #name: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new(#first_octave, &[#(#amplitudes),*], #raw_name);
}]); }]);

View File

@ -17,7 +17,7 @@ pub mod sound {
pub mod chunk { pub mod chunk {
include!(concat!(env!("OUT_DIR"), "/biome.rs")); 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")); include!(concat!(env!("OUT_DIR"), "/chunk_status.rs"));
} }

View File

@ -221,7 +221,7 @@ mod test {
} }
#[test] #[test]
fn test_simple_ser_de_unamed() { fn test_simple_ser_de_unnamed() {
let test = Test { let test = Test {
byte: 123, byte: 123,
short: 1342, short: 1342,

View File

@ -87,7 +87,7 @@ where
value.serialize(&mut serializer)?; value.serialize(&mut serializer)?;
Ok(serializer.output) Ok(serializer.output)
} }
/// Serializes struct using Serde Serializer to unamed NBT /// Serializes struct using Serde Serializer to unnamed NBT
pub fn to_writer_unnamed<T, W>(value: &T, mut writer: W) -> Result<()> pub fn to_writer_unnamed<T, W>(value: &T, mut writer: W) -> Result<()>
where where
T: Serialize, T: Serialize,

View File

@ -41,7 +41,7 @@ pub(crate) trait PerlinTerrainGenerator: Sync + Send {
fn prepare_chunk(&self, at: &Vector2<i32>, perlin: &Perlin); fn prepare_chunk(&self, at: &Vector2<i32>, perlin: &Perlin);
/// Dependens on the perlin noise height /// Depends on the perlin noise height
fn generate_block( fn generate_block(
&self, &self,
coordinates: ChunkRelativeBlockCoordinates, coordinates: ChunkRelativeBlockCoordinates,

View File

@ -61,7 +61,7 @@ impl Level {
region_folder, 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 // So TODO
let locker = AnvilLevelLocker::look(&level_folder).expect("Failed to lock level"); let locker = AnvilLevelLocker::look(&level_folder).expect("Failed to lock level");

View File

@ -65,7 +65,7 @@ impl PumpkinBlock for CraftingTableBlock {
container.remove_player(entity_id); 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: 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) // TODO: ephemeral containers (crafting tables) might need to be separate data structure than stored (ender chest)
} }

View File

@ -86,7 +86,7 @@ pub async fn standard_open_container_unique<C: Container + Default + 'static>(
if id_to_use == -1 { if id_to_use == -1 {
let new_id = server.new_container_id(); 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::<C>( let open_container = OpenContainer::new_empty_container::<C>(
entity_id, entity_id,
Some(location), Some(location),
@ -97,7 +97,7 @@ pub async fn standard_open_container_unique<C: Container + Default + 'static>(
player.open_container.store(Some(new_id.into())); player.open_container.store(Some(new_id.into()));
} else { } 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)) { if let Some(unique_container) = open_containers.get_mut(&(id_to_use as u64)) {
unique_container.set_location(Some(location)).await; unique_container.set_location(Some(location)).await;
unique_container.add_player(entity_id); unique_container.add_player(entity_id);

View File

@ -72,24 +72,24 @@ impl SlabBehavior {
} }
} }
pub fn evalute_property_type( pub fn evaluate_property_type(
block: &Block, block: &Block,
clicked_block: &Block, clicked_block: &Block,
face: &BlockFace, face: BlockFace,
use_item_on: &SUseItemOn, use_item_on: &SUseItemOn,
) -> String { ) -> String {
if block.id == clicked_block.id && face == &BlockFace::Top { if block.id == clicked_block.id && face == BlockFace::Top {
return format!("{}{}", "type", "double"); return format!("{}{}", "type", "double");
} }
if face == &BlockFace::Top { if face == BlockFace::Top {
return format!("{}{}", "type", "bottom"); return format!("{}{}", "type", "bottom");
} }
if face == &BlockFace::North if face == BlockFace::North
|| face == &BlockFace::South || face == BlockFace::South
|| face == &BlockFace::West || face == BlockFace::West
|| face == &BlockFace::East || face == BlockFace::East
{ {
let y_pos = use_item_on.cursor_pos.y; let y_pos = use_item_on.cursor_pos.y;
if y_pos > 0.5 { if y_pos > 0.5 {
@ -102,7 +102,7 @@ impl SlabBehavior {
format!("{}{}", "type", "bottom") format!("{}{}", "type", "bottom")
} }
pub fn evalute_property_waterlogged(block: &Block) -> String { pub fn evaluate_property_waterlogged(block: &Block) -> String {
if block.name == "water" { if block.name == "water" {
return format!("{}{}", "waterlogged", "true"); 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") let state = match get_property_key(property.name.as_str()).expect("Property not found")
{ {
BlockProperty::SlabType(_) => { 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"), _ => panic!("Property not found"),
}; };
hmap_key.push(state.to_string()); hmap_key.push(state.to_string());

View File

@ -144,7 +144,7 @@ impl StairBehavior {
use_item_on: &SUseItemOn, use_item_on: &SUseItemOn,
player_direction: &Direction, player_direction: &Direction,
) -> String { ) -> 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) = let (front_block_pos, back_block_pos) =
Self::calculate_positions(player_direction, block_pos); Self::calculate_positions(player_direction, block_pos);
@ -247,7 +247,7 @@ impl StairBehavior {
format!("{}{}", "waterlogged", "false") 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 { let facing = match face {
BlockFace::North => "south", BlockFace::North => "south",
BlockFace::South => "north", BlockFace::South => "north",
@ -264,7 +264,7 @@ impl StairBehavior {
format!("facing{facing}") 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 { match face {
BlockFace::Top => format!("{}{}", "half", "bottom"), BlockFace::Top => format!("{}{}", "half", "bottom"),
BlockFace::Bottom => format!("{}{}", "half", "top"), BlockFace::Bottom => format!("{}{}", "half", "top"),
@ -297,8 +297,8 @@ impl BlockBehavior for StairBehavior {
for property in &block.properties { for property in &block.properties {
let state = match get_property_key(property.name.as_str()).expect("Property not found") let state = match get_property_key(property.name.as_str()).expect("Property not found")
{ {
BlockProperty::Facing(_) => Self::evaluate_property_facing(face, player_direction), BlockProperty::Facing(_) => Self::evaluate_property_facing(*face, player_direction),
BlockProperty::Half(_) => Self::evaluate_property_half(face, use_item_on), BlockProperty::Half(_) => Self::evaluate_property_half(*face, use_item_on),
BlockProperty::StairShape(_) => { BlockProperty::StairShape(_) => {
Self::evaluate_property_shape( Self::evaluate_property_shape(
world, world,

View File

@ -33,7 +33,7 @@ impl CommandExecutor for BanListExecutor {
match *list_type { match *list_type {
"ips" => { "ips" => {
let lock = &BANNED_IP_LIST.read().await; let lock = &BANNED_IP_LIST.read().await;
let entires = lock let entries = lock
.banned_ips .banned_ips
.iter() .iter()
.map(|entry| { .map(|entry| {
@ -45,11 +45,11 @@ impl CommandExecutor for BanListExecutor {
}) })
.collect(); .collect();
handle_banlist(entires, sender).await; handle_banlist(entries, sender).await;
} }
"players" => { "players" => {
let lock = &BANNED_PLAYER_LIST.read().await; let lock = &BANNED_PLAYER_LIST.read().await;
let entires = lock let entries = lock
.banned_players .banned_players
.iter() .iter()
.map(|entry| { .map(|entry| {
@ -61,7 +61,7 @@ impl CommandExecutor for BanListExecutor {
}) })
.collect(); .collect();
handle_banlist(entires, sender).await; handle_banlist(entries, sender).await;
} }
_ => { _ => {
return Err(CommandError::GeneralCommandIssue( return Err(CommandError::GeneralCommandIssue(

View File

@ -22,7 +22,7 @@ const ARG_TARGETS: &str = "targets";
const ARG_TITLE: &str = "title"; const ARG_TITLE: &str = "title";
/// bool: Wether to reset or not /// bool: Whether to reset or not
struct ClearOrResetExecutor(bool); struct ClearOrResetExecutor(bool);
#[async_trait] #[async_trait]

View File

@ -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 // when normalize
if best_move.x == 0.0 && best_move.z == 0.0 { if best_move.x == 0.0 && best_move.z == 0.0 {
return; return;

View File

@ -38,7 +38,7 @@ pub type EntityId = i32;
pub struct Entity { pub struct Entity {
/// A unique identifier for the entity /// A unique identifier for the entity
pub entity_id: EntityId, pub entity_id: EntityId,
/// A persistant, unique identifier for the entity /// A persistent, unique identifier for the entity
pub entity_uuid: uuid::Uuid, pub entity_uuid: uuid::Uuid,
/// The type of entity (e.g., player, zombie, item) /// The type of entity (e.g., player, zombie, item)
pub entity_type: EntityType, pub entity_type: EntityType,

View File

@ -121,7 +121,7 @@ pub struct Player {
pub watched_section: AtomicCell<Cylindrical>, pub watched_section: AtomicCell<Cylindrical>,
/// Did we send a keep alive Packet and wait for the response? /// Did we send a keep alive Packet and wait for the response?
pub wait_for_keep_alive: AtomicBool, 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, pub keep_alive_id: AtomicI64,
/// Last time we send a keep alive /// Last time we send a keep alive
pub last_keep_alive_time: AtomicCell<Instant>, pub last_keep_alive_time: AtomicCell<Instant>,

View File

@ -33,7 +33,7 @@ impl ServerboundPacket {
/// Server -> Client /// Server -> Client
pub enum ClientboundPacket { 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`, /// 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, AuthResponse = 2,
/// A `SERVERDATA_RESPONSE` packet is the response to a `SERVERDATA_EXECCOMMAND` request. /// A `SERVERDATA_RESPONSE` packet is the response to a `SERVERDATA_EXECCOMMAND` request.
Output = 0, Output = 0,

View File

@ -118,9 +118,9 @@ impl PluginManager {
fs::create_dir(PLUGIN_DIR).unwrap(); 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() { if !entry.as_ref().unwrap().path().is_file() {
continue; continue;
} }

View File

@ -240,7 +240,7 @@ impl World {
for player in self.current_players.lock().await.values() { for player in self.current_players.lock().await.values() {
player.tick().await; player.tick().await;
} }
// entites tick // entities tick
for entity in self.current_living_mobs.lock().await.values() { for entity in self.current_living_mobs.lock().await.values() {
entity.tick().await; entity.tick().await;
} }