diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e04fe5eec..e172bb077 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,15 +33,21 @@ The Documentation of Pumpkin can be found at ### Coding Guidelines -Things need to be done before this Pull Request can be merged. Your CI also checks most of them automaticly and fill fail if something is not fulfilled -Note: Pumpkin's clippy settings are relativly strict, this can be may frustrating but is necesarry so the code says clean and conssistent +Things need to be done before this Pull Request can be merged. Your CI also checks most of them automatically and fill fail if something is not fulfilled +Note: Pumpkin's clippy settings are relatively strict, this can be may frustrating but is necessary so the code says clean and conssistent **Basic** -- **Code Formatting:** Code must be well-formatted and follow the project's style guidelines. You can achieve this by running `cargo fmt`. -- **No Clippy Warnings:** Code should not produce any warnings from the Clippy linter. You can check for warnings using `cargo clippy --all-targets`. +- **Title:** Use a concise and informative title that clearly communicates the purpose of the PR. Anyone reviewing the PR should quickly understand the changes being proposed. +- **Description:** Provide a comprehensive description of the changes. Explain: +- What was changed? +- Why was this change necessary? +- What is the impact of this change? +- Are there any known issues or limitations? +- Include any relevant context, such as related issues or discussions. +- **No Clippy Warnings:** Address all warnings reported by the Clippy linter. You can check for warnings using `cargo clippy --all-targets`. - **Passing Unit Tests:** All existing unit tests must pass successfully. You can run the tests with `cargo test`. -**Best Pratice** +**Best Practice** - **Writing Unit Tests:** When adding new features or modifying existing code, consider adding unit tests to prevent regressions in the future. Refer to the Rust documentation for guidance on writing tests: https://doc.rust-lang.org/book/ch11-01-writing-tests.html - **Benchmarking:** If your changes might impact performance, consider adding benchmarks to track performance regressions or improvements. We use the Criterion library for benchmarking. Refer to their Quick Start guide for more information: https://github.com/bheisler/criterion.rs#quickstart diff --git a/README.md b/README.md index 08b2730fb..def352310 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ and customizable experience. It prioritizes performance and player enjoyment whi - [x] Player Inventory - [x] Player Combat - Entities - - [ ] Non-Living (Minecart, Eggs...) + - [x] Non-Living (Minecart, Eggs...) - [x] Players - [x] Mobs - [x] Animals @@ -82,6 +82,7 @@ and customizable experience. It prioritizes performance and player enjoyment whi - [x] Chat - [x] Commands - [x] Permissions + - [x] Translations - Proxy - [x] Bungeecord - [x] Velocity diff --git a/pumpkin-world/src/entity/mod.rs b/pumpkin-world/src/entity/mod.rs index 30282ee57..d10899055 100644 --- a/pumpkin-world/src/entity/mod.rs +++ b/pumpkin-world/src/entity/mod.rs @@ -1 +1 @@ -pub mod entity_registry; +pub mod registry; diff --git a/pumpkin-world/src/entity/entity_registry.rs b/pumpkin-world/src/entity/registry.rs similarity index 100% rename from pumpkin-world/src/entity/entity_registry.rs rename to pumpkin-world/src/entity/registry.rs diff --git a/pumpkin-world/src/loot/mod.rs b/pumpkin-world/src/loot/mod.rs index f9b7ebaa4..ac1acc5e9 100644 --- a/pumpkin-world/src/loot/mod.rs +++ b/pumpkin-world/src/loot/mod.rs @@ -26,12 +26,12 @@ pub struct LootPoolEntry { #[serde(rename = "snake_case")] pub enum LootTableType { #[serde(rename = "minecraft:empty")] - /// Nothing will be droped + /// Nothing will be dropped Empty, #[serde(rename = "minecraft:block")] - /// A Block will be droped + /// A Block will be dropped Block, #[serde(rename = "minecraft:chest")] - /// A Item will be droped + /// A Item will be dropped Chest, } diff --git a/pumpkin/src/entity/projectile/mod.rs b/pumpkin/src/entity/projectile/mod.rs index 400d72580..25087edfb 100644 --- a/pumpkin/src/entity/projectile/mod.rs +++ b/pumpkin/src/entity/projectile/mod.rs @@ -4,13 +4,13 @@ use pumpkin_util::math::vector3::Vector3; use super::{living::LivingEntity, Entity, EntityBase}; -pub struct ThrownItem { +pub struct ThrownItemEntity { entity: Entity, } const DEG_PER_RAD_F32: f32 = 180.0 / PI; -impl ThrownItem { +impl ThrownItemEntity { pub fn new(entity: Entity, owner: &Entity) -> Self { let mut owner_pos = owner.pos.load(); owner_pos.y = (owner_pos.y + f64::from(owner.standing_eye_height)) - 0.1; @@ -77,7 +77,7 @@ impl ThrownItem { } } -impl EntityBase for ThrownItem { +impl EntityBase for ThrownItemEntity { fn get_entity(&self) -> &Entity { &self.entity } diff --git a/pumpkin/src/item/items/egg.rs b/pumpkin/src/item/items/egg.rs index 106b46ee4..d11a23551 100644 --- a/pumpkin/src/item/items/egg.rs +++ b/pumpkin/src/item/items/egg.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use crate::entity::player::Player; -use crate::entity::projectile::ThrownItem; +use crate::entity::projectile::ThrownItemEntity; use crate::item::pumpkin_item::PumpkinItem; use crate::server::Server; use async_trait::async_trait; @@ -28,7 +28,7 @@ impl PumpkinItem for EggItem { .await; // TODO: Implement eggs the right way, so there is a chance of spawning chickens let entity = server.add_entity(position, EntityType::Egg, world); - let snowball = ThrownItem::new(entity, &player.living_entity.entity); + let snowball = ThrownItemEntity::new(entity, &player.living_entity.entity); let yaw = player.living_entity.entity.yaw.load(); let pitch = player.living_entity.entity.pitch.load(); snowball.set_velocity_from(&player.living_entity.entity, pitch, yaw, 0.0, POWER, 1.0); diff --git a/pumpkin/src/item/items/snowball.rs b/pumpkin/src/item/items/snowball.rs index 12ea9d10c..f0cacc687 100644 --- a/pumpkin/src/item/items/snowball.rs +++ b/pumpkin/src/item/items/snowball.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use crate::entity::player::Player; -use crate::entity::projectile::ThrownItem; +use crate::entity::projectile::ThrownItemEntity; use crate::item::pumpkin_item::PumpkinItem; use crate::server::Server; use async_trait::async_trait; @@ -27,7 +27,7 @@ impl PumpkinItem for SnowBallItem { ) .await; let entity = server.add_entity(position, EntityType::Snowball, world); - let snowball = ThrownItem::new(entity, &player.living_entity.entity); + let snowball = ThrownItemEntity::new(entity, &player.living_entity.entity); let yaw = player.living_entity.entity.yaw.load(); let pitch = player.living_entity.entity.pitch.load(); snowball.set_velocity_from(&player.living_entity.entity, pitch, yaw, 0.0, POWER, 1.0); diff --git a/pumpkin/src/net/packet/play.rs b/pumpkin/src/net/packet/play.rs index f6878dee6..0af5c9fef 100644 --- a/pumpkin/src/net/packet/play.rs +++ b/pumpkin/src/net/packet/play.rs @@ -49,7 +49,7 @@ use pumpkin_world::item::registry::{get_item_by_id, get_name_by_id}; use pumpkin_world::item::ItemStack; use pumpkin_world::{ block::{registry::get_block_by_item, BlockDirection}, - entity::entity_registry::get_entity_id, + entity::registry::get_entity_id, item::registry::get_spawn_egg, }; diff --git a/pumpkin/src/server/mod.rs b/pumpkin/src/server/mod.rs index 79cfa8bcc..be773416d 100644 --- a/pumpkin/src/server/mod.rs +++ b/pumpkin/src/server/mod.rs @@ -16,7 +16,7 @@ use pumpkin_util::text::TextComponent; use pumpkin_util::GameMode; use pumpkin_world::block::registry::Block; use pumpkin_world::dimension::Dimension; -use pumpkin_world::entity::entity_registry::get_entity_by_id; +use pumpkin_world::entity::registry::get_entity_by_id; use rand::prelude::SliceRandom; use std::collections::HashMap; use std::net::IpAddr; diff --git a/pumpkin/src/world/level_time.rs b/pumpkin/src/world/level_time.rs index abdf8594b..deefd0ab4 100644 --- a/pumpkin/src/world/level_time.rs +++ b/pumpkin/src/world/level_time.rs @@ -8,13 +8,6 @@ pub struct LevelTime { pub rain_time: i64, } -pub enum DayTime { - Day = 1000, - Night = 13000, - Noon = 6000, - Midnight = 18000, -} - impl Default for LevelTime { fn default() -> Self { Self::new()