mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
Fix some typos
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}]);
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<T, W>(value: &T, mut writer: W) -> Result<()>
|
||||
where
|
||||
T: Serialize,
|
||||
|
||||
@@ -41,7 +41,7 @@ pub(crate) trait PerlinTerrainGenerator: Sync + Send {
|
||||
|
||||
fn prepare_chunk(&self, at: &Vector2<i32>, perlin: &Perlin);
|
||||
|
||||
/// Dependens on the perlin noise height
|
||||
/// Depends on the perlin noise height
|
||||
fn generate_block(
|
||||
&self,
|
||||
coordinates: ChunkRelativeBlockCoordinates,
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ pub async fn standard_open_container_unique<C: Container + Default + 'static>(
|
||||
|
||||
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::<C>(
|
||||
entity_id,
|
||||
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()));
|
||||
} 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);
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -121,7 +121,7 @@ pub struct Player {
|
||||
pub watched_section: AtomicCell<Cylindrical>,
|
||||
/// 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<Instant>,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user