From 5ce714ed12ac52045df754bae7eb8990310b3b76 Mon Sep 17 00:00:00 2001 From: earomc Date: Thu, 29 Aug 2024 19:45:26 +0200 Subject: [PATCH] include readmes in crate lvl docs, improve clarity, fix some typos --- pumpkin-protocol/README.md | 6 +++++- pumpkin-protocol/src/lib.rs | 2 ++ pumpkin-registry/README.md | 2 +- pumpkin-registry/src/lib.rs | 2 ++ pumpkin/src/client/mod.rs | 1 + pumpkin/src/client/player_packet.rs | 3 ++- pumpkin/src/main.rs | 3 +++ 7 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pumpkin-protocol/README.md b/pumpkin-protocol/README.md index 4ea5c5c71..f230e16fd 100644 --- a/pumpkin-protocol/README.md +++ b/pumpkin-protocol/README.md @@ -1,5 +1,9 @@ ### Pumpkin Protocol -Contains all Serverbound(Client->Server) and Clientbound(Server->Client) Packets. +Contains all serverbound and clientbound packets. + +**Clientbound** meaning that it's a packet being sent from the server to the client. (Server->Client) + +**Serverbound** meaning that it's a packet the client sends to the server. (Client->Server) Packets in the Pumpkin protocol are organized by functionality and state. diff --git a/pumpkin-protocol/src/lib.rs b/pumpkin-protocol/src/lib.rs index e79388163..557e617f8 100644 --- a/pumpkin-protocol/src/lib.rs +++ b/pumpkin-protocol/src/lib.rs @@ -1,3 +1,5 @@ +#![doc = include_str!("../README.md")] + use bytebuf::{packet_id::Packet, ByteBuffer, DeserializerError}; use bytes::Buf; use serde::{Deserialize, Serialize}; diff --git a/pumpkin-registry/README.md b/pumpkin-registry/README.md index cd0b46392..822b27866 100644 --- a/pumpkin-registry/README.md +++ b/pumpkin-registry/README.md @@ -1,5 +1,5 @@ ### Pumpkin Registry Here you find all the registry data we have. Registries are repositories of data that contain entries pertaining to certain aspects of the game, such as the world, the player, among others. -Registry data usually send by the Clientbound Registry data Packet. +Registry data is usually send by the clientbound CRegistryData packet. A list of Registry entries can be found at https://wiki.vg/Registry_Data \ No newline at end of file diff --git a/pumpkin-registry/src/lib.rs b/pumpkin-registry/src/lib.rs index 2fb7d1a1b..01df60af7 100644 --- a/pumpkin-registry/src/lib.rs +++ b/pumpkin-registry/src/lib.rs @@ -1,3 +1,5 @@ +#![doc = include_str!("../README.md")] + use biomes::Biome; use chat_type::ChatType; use dimensions::Dimension; diff --git a/pumpkin/src/client/mod.rs b/pumpkin/src/client/mod.rs index 913019b90..e40b6a69a 100644 --- a/pumpkin/src/client/mod.rs +++ b/pumpkin/src/client/mod.rs @@ -60,6 +60,7 @@ impl Default for PlayerConfig { } } +/// Represents a Minecraft client connected to, or attempting to connect to the server. pub struct Client { pub gameprofile: Option, diff --git a/pumpkin/src/client/player_packet.rs b/pumpkin/src/client/player_packet.rs index 64bf0d5f2..3f09982e9 100644 --- a/pumpkin/src/client/player_packet.rs +++ b/pumpkin/src/client/player_packet.rs @@ -34,7 +34,8 @@ fn modulus(a: f32, b: f32) -> f32 { ((a % b) + b) % b } -/// Handles all Play Packets send by a real Player +/// Contains method implementations for handling play packets regarding a specific Minecraft player connected to the server. +/// Handles all Play packets sent by a real Player /// NEVER TRUST THE CLIENT. HANDLE EVERY ERROR, UNWRAP/EXPECT ARE FORBIDDEN impl Player { pub fn handle_confirm_teleport( diff --git a/pumpkin/src/main.rs b/pumpkin/src/main.rs index 69070306b..ba1792818 100644 --- a/pumpkin/src/main.rs +++ b/pumpkin/src/main.rs @@ -1,3 +1,6 @@ +#![doc = include_str!("../../README.md")] +#![doc = include_str!("../../STRUCTURE.md")] + #![allow(clippy::await_holding_refcell_ref)] #![allow(clippy::await_holding_lock)]