diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8770448..2f0b161 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -227,7 +227,7 @@ where appropriate. Unit tests help your contributions last! They ensure that your code works as expected and that it continues to work in the future. -whole-server unit tests can be found in [`crates/valence/src/tests/`](crates/valence/src/tests). +whole-server unit tests can be found in [`/src/tests/`](/src/tests). ## Naming Quantities diff --git a/Cargo.toml b/Cargo.toml index 962750e..0da3447 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,80 @@ +[package] +name = "valence" +version.workspace = true +edition.workspace = true +description = "A framework for building Minecraft servers in Rust." +documentation.workspace = true +repository.workspace = true +readme = "README.md" +license.workspace = true +keywords = ["minecraft", "gamedev", "server", "ecs"] +categories = ["game-engines"] + +[features] +default = [ + "network", + "player_list", + "inventory", + "anvil", + "advancement", + "world_border", +] +network = ["dep:valence_network"] +player_list = ["dep:valence_player_list"] +inventory = ["dep:valence_inventory"] +anvil = ["dep:valence_anvil"] +advancement = ["dep:valence_advancement"] +world_border = ["dep:valence_world_border"] + +[dependencies] +bevy_app.workspace = true +bevy_ecs.workspace = true +glam.workspace = true +uuid.workspace = true +valence_nbt.workspace = true +valence_core.workspace = true +valence_registry.workspace = true +valence_block.workspace = true +valence_biome.workspace = true +valence_dimension.workspace = true +valence_entity.workspace = true +valence_instance.workspace = true +valence_client.workspace = true +valence_network = { workspace = true, optional = true } +valence_player_list = { workspace = true, optional = true } +valence_inventory = { workspace = true, optional = true } +valence_anvil = { workspace = true, optional = true } +valence_advancement = { workspace = true, optional = true } +valence_world_border = { workspace = true, optional = true } + +[dev-dependencies] +anyhow.workspace = true +bytes.workspace = true +clap.workspace = true +criterion.workspace = true +flume.workspace = true +noise.workspace = true # For the terrain example. +rand.workspace = true +tracing-subscriber.workspace = true +tracing.workspace = true + +[dev-dependencies.reqwest] +workspace = true +default-features = false +features = ["rustls-tls", "blocking", "stream"] + +[[bench]] +name = "main" +harness = false + +[profile.dev.package."*"] +opt-level = 3 + +[profile.dev] +opt-level = 1 + [workspace] members = ["crates/*", "tools/*"] -exclude = ["rust-mc-bot"] resolver = "2" [workspace.package] @@ -96,12 +170,5 @@ valence_network.path = "crates/valence_network" valence_player_list.path = "crates/valence_player_list" valence_registry.path = "crates/valence_registry" valence_world_border.path = "crates/valence_world_border" -valence.path = "crates/valence" - +valence.path = "." zip = "0.6.3" - -[profile.dev.package."*"] -opt-level = 3 - -[profile.dev] -opt-level = 1 diff --git a/crates/valence/benches/anvil.rs b/benches/anvil.rs similarity index 100% rename from crates/valence/benches/anvil.rs rename to benches/anvil.rs diff --git a/crates/valence/benches/block.rs b/benches/block.rs similarity index 100% rename from crates/valence/benches/block.rs rename to benches/block.rs diff --git a/crates/valence/benches/decode_array.rs b/benches/decode_array.rs similarity index 100% rename from crates/valence/benches/decode_array.rs rename to benches/decode_array.rs diff --git a/crates/valence/benches/idle.rs b/benches/idle.rs similarity index 100% rename from crates/valence/benches/idle.rs rename to benches/idle.rs diff --git a/crates/valence/benches/main.rs b/benches/main.rs similarity index 100% rename from crates/valence/benches/main.rs rename to benches/main.rs diff --git a/crates/valence/benches/packet.rs b/benches/packet.rs similarity index 100% rename from crates/valence/benches/packet.rs rename to benches/packet.rs diff --git a/crates/valence/benches/var_int.rs b/benches/var_int.rs similarity index 100% rename from crates/valence/benches/var_int.rs rename to benches/var_int.rs diff --git a/crates/valence/benches/var_long.rs b/benches/var_long.rs similarity index 100% rename from crates/valence/benches/var_long.rs rename to benches/var_long.rs diff --git a/crates/valence/Cargo.toml b/crates/valence/Cargo.toml deleted file mode 100644 index b754089..0000000 --- a/crates/valence/Cargo.toml +++ /dev/null @@ -1,66 +0,0 @@ -[package] -name = "valence" -version.workspace = true -edition.workspace = true -description = "A framework for building Minecraft servers in Rust." -documentation.workspace = true -repository.workspace = true -readme = "README.md" -license.workspace = true -keywords = ["minecraft", "gamedev", "server", "ecs"] -categories = ["game-engines"] - -[features] -default = ["network", "player_list", "inventory", "anvil", "advancement", "world_border"] -network = ["dep:valence_network"] -player_list = ["dep:valence_player_list"] -inventory = ["dep:valence_inventory"] -anvil = ["dep:valence_anvil"] -advancement = ["dep:valence_advancement"] -world_border = ["dep:valence_world_border"] - -[dependencies] -bevy_app.workspace = true -bevy_ecs.workspace = true -glam.workspace = true -uuid.workspace = true -valence_nbt.workspace = true -valence_core.workspace = true -valence_registry.workspace = true -valence_block.workspace = true -valence_biome.workspace = true -valence_dimension.workspace = true -valence_entity.workspace = true -valence_instance.workspace = true -valence_client.workspace = true -valence_network = { workspace = true, optional = true } -valence_player_list = { workspace = true, optional = true } -valence_inventory = { workspace = true, optional = true } -valence_anvil = { workspace = true, optional = true } -valence_advancement = { workspace = true, optional = true } -valence_world_border = { workspace = true, optional = true } - - -[dev-dependencies] -anyhow.workspace = true -bytes.workspace = true -noise.workspace = true -tracing-subscriber.workspace = true -rand.workspace = true -tracing.workspace = true -flume.workspace = true -clap.workspace = true -criterion.workspace = true -fs_extra.workspace = true -tempfile.workspace = true -zip.workspace = true - -[dev-dependencies.reqwest] -workspace = true -default-features = false -# Avoid OpenSSL dependency on Linux. -features = ["rustls-tls", "blocking", "stream"] - -[[bench]] -name = "main" -harness = false diff --git a/crates/valence/README.md b/crates/valence/README.md deleted file mode 100644 index f9bed2f..0000000 --- a/crates/valence/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# valence - -The main Valence crate. This acts primarily as a shell to re-export the other crates and consolidate plugins. Users are expected to use the other crates indirectly through this interface. - -Additionally, project examples and whole-server unit tests are stored in `examples/` and `src/tests/` respectively. diff --git a/crates/valence_client/src/command.rs b/crates/valence_client/src/command.rs index f3d5e46..e9096fa 100644 --- a/crates/valence_client/src/command.rs +++ b/crates/valence_client/src/command.rs @@ -8,10 +8,10 @@ use valence_entity::{entity, Pose}; use crate::event_loop::{EventLoopSchedule, EventLoopSet, PacketEvent}; pub(super) fn build(app: &mut App) { - app.add_event::() - .add_event::() - .add_event::() - .add_event::() + app.add_event::() + .add_event::() + .add_event::() + .add_event::() .add_system( handle_client_command .in_schedule(EventLoopSchedule) @@ -20,7 +20,7 @@ pub(super) fn build(app: &mut App) { } #[derive(Copy, Clone, PartialEq, Eq, Debug)] -pub struct Sprinting { +pub struct SprintEvent { pub client: Entity, pub state: SprintState, } @@ -32,7 +32,7 @@ pub enum SprintState { } #[derive(Copy, Clone, PartialEq, Eq, Debug)] -pub struct Sneaking { +pub struct SneakEvent { pub client: Entity, pub state: SneakState, } @@ -44,7 +44,7 @@ pub enum SneakState { } #[derive(Copy, Clone, PartialEq, Eq, Debug)] -pub struct JumpWithHorse { +pub struct JumpWithHorseEvent { pub client: Entity, pub state: JumpWithHorseState, } @@ -59,17 +59,17 @@ pub enum JumpWithHorseState { } #[derive(Copy, Clone, PartialEq, Eq, Debug)] -pub struct LeaveBed { +pub struct LeaveBedEvent { pub client: Entity, } fn handle_client_command( mut packets: EventReader, mut clients: Query<(&mut entity::Pose, &mut Flags)>, - mut sprinting_events: EventWriter, - mut sneaking_events: EventWriter, - mut jump_with_horse_events: EventWriter, - mut leave_bed_events: EventWriter, + mut sprinting_events: EventWriter, + mut sneaking_events: EventWriter, + mut jump_with_horse_events: EventWriter, + mut leave_bed_events: EventWriter, ) { for packet in packets.iter() { if let Some(pkt) = packet.decode::() { @@ -80,7 +80,7 @@ fn handle_client_command( flags.set_sneaking(true); } - sneaking_events.send(Sneaking { + sneaking_events.send(SneakEvent { client: packet.client, state: SneakState::Start, }) @@ -91,12 +91,12 @@ fn handle_client_command( flags.set_sneaking(false); } - sneaking_events.send(Sneaking { + sneaking_events.send(SneakEvent { client: packet.client, state: SneakState::Stop, }) } - ClientCommand::LeaveBed => leave_bed_events.send(LeaveBed { + ClientCommand::LeaveBed => leave_bed_events.send(LeaveBedEvent { client: packet.client, }), ClientCommand::StartSprinting => { @@ -104,7 +104,7 @@ fn handle_client_command( flags.set_sprinting(true); } - sprinting_events.send(Sprinting { + sprinting_events.send(SprintEvent { client: packet.client, state: SprintState::Start, }); @@ -114,21 +114,25 @@ fn handle_client_command( flags.set_sprinting(false); } - sprinting_events.send(Sprinting { + sprinting_events.send(SprintEvent { client: packet.client, state: SprintState::Stop, }) } - ClientCommand::StartJumpWithHorse => jump_with_horse_events.send(JumpWithHorse { - client: packet.client, - state: JumpWithHorseState::Start { - power: pkt.jump_boost.0 as u8, - }, - }), - ClientCommand::StopJumpWithHorse => jump_with_horse_events.send(JumpWithHorse { - client: packet.client, - state: JumpWithHorseState::Stop, - }), + ClientCommand::StartJumpWithHorse => { + jump_with_horse_events.send(JumpWithHorseEvent { + client: packet.client, + state: JumpWithHorseState::Start { + power: pkt.jump_boost.0 as u8, + }, + }) + } + ClientCommand::StopJumpWithHorse => { + jump_with_horse_events.send(JumpWithHorseEvent { + client: packet.client, + state: JumpWithHorseState::Stop, + }) + } ClientCommand::OpenHorseInventory => {} // TODO ClientCommand::StartFlyingWithElytra => { if let Ok((mut pose, _)) = clients.get_mut(packet.client) { diff --git a/crates/valence/examples/advancement.rs b/examples/advancement.rs similarity index 96% rename from crates/valence/examples/advancement.rs rename to examples/advancement.rs index 0801ac7..436992c 100644 --- a/crates/valence/examples/advancement.rs +++ b/examples/advancement.rs @@ -1,9 +1,8 @@ use std::collections::HashMap; +use valence::advancement::bevy_hierarchy::{BuildChildren, Children, Parent}; +use valence::advancement::ForceTabUpdate; use valence::prelude::*; -use valence_advancement::bevy_hierarchy::{BuildChildren, Children, Parent}; -use valence_advancement::ForceTabUpdate; -use valence_client::SpawnClientsSet; #[derive(Component)] struct RootCriteria; @@ -29,13 +28,14 @@ fn main() { .init_resource::() .add_startup_system(setup) .add_systems(( + load_clients, + apply_system_buffers + .after(load_clients) + .before(init_advancements), init_clients, init_advancements, sneak, tab_change, - load_clients - .after(SpawnClientsSet) - .in_base_set(CoreSet::PreUpdate), )) .run(); } @@ -225,7 +225,7 @@ fn init_advancements( } fn sneak( - mut sneaking: EventReader, + mut sneaking: EventReader, mut client: Query<(&mut AdvancementClientUpdate, &mut RootCriteriaDone)>, root_criteria: Query>, client_uuid: Query<&UniqueId>, diff --git a/crates/valence/examples/anvil_loading.rs b/examples/anvil_loading.rs similarity index 100% rename from crates/valence/examples/anvil_loading.rs rename to examples/anvil_loading.rs diff --git a/crates/valence/examples/bench_players.rs b/examples/bench_players.rs similarity index 96% rename from crates/valence/examples/bench_players.rs rename to examples/bench_players.rs index f526242..d337b8f 100644 --- a/crates/valence/examples/bench_players.rs +++ b/examples/bench_players.rs @@ -2,9 +2,7 @@ use std::time::Instant; -use valence::instance::{Chunk, Instance}; use valence::prelude::*; -use valence_network::ConnectionMode; const SPAWN_Y: i32 = 64; diff --git a/crates/valence/examples/biomes.rs b/examples/biomes.rs similarity index 100% rename from crates/valence/examples/biomes.rs rename to examples/biomes.rs diff --git a/crates/valence/examples/block_entities.rs b/examples/block_entities.rs similarity index 100% rename from crates/valence/examples/block_entities.rs rename to examples/block_entities.rs diff --git a/crates/valence/examples/building.rs b/examples/building.rs similarity index 97% rename from crates/valence/examples/building.rs rename to examples/building.rs index 9882d32..b02cce3 100644 --- a/crates/valence/examples/building.rs +++ b/examples/building.rs @@ -60,7 +60,10 @@ fn init_clients( } } -fn toggle_gamemode_on_sneak(mut clients: Query<&mut GameMode>, mut events: EventReader) { +fn toggle_gamemode_on_sneak( + mut clients: Query<&mut GameMode>, + mut events: EventReader, +) { for event in events.iter() { let Ok(mut mode) = clients.get_mut(event.client) else { continue; diff --git a/crates/valence/examples/chest.rs b/examples/chest.rs similarity index 95% rename from crates/valence/examples/chest.rs rename to examples/chest.rs index 9a4bd48..857019d 100644 --- a/crates/valence/examples/chest.rs +++ b/examples/chest.rs @@ -59,7 +59,10 @@ fn init_clients( } } -fn toggle_gamemode_on_sneak(mut clients: Query<&mut GameMode>, mut events: EventReader) { +fn toggle_gamemode_on_sneak( + mut clients: Query<&mut GameMode>, + mut events: EventReader, +) { for event in events.iter() { let Ok(mut mode) = clients.get_mut(event.client) else { continue; diff --git a/crates/valence/examples/combat.rs b/examples/combat.rs similarity index 97% rename from crates/valence/examples/combat.rs rename to examples/combat.rs index 66198f5..4d839ad 100644 --- a/crates/valence/examples/combat.rs +++ b/examples/combat.rs @@ -95,10 +95,10 @@ struct CombatQuery { fn handle_combat_events( server: Res, mut clients: Query, - mut sprinting: EventReader, + mut sprinting: EventReader, mut interact_entity: EventReader, ) { - for &Sprinting { client, state } in sprinting.iter() { + for &SprintEvent { client, state } in sprinting.iter() { if let Ok(mut client) = clients.get_mut(client) { client.state.has_bonus_knockback = state == SprintState::Start; } diff --git a/crates/valence/examples/cow_sphere.rs b/examples/cow_sphere.rs similarity index 100% rename from crates/valence/examples/cow_sphere.rs rename to examples/cow_sphere.rs diff --git a/crates/valence/examples/death.rs b/examples/death.rs similarity index 99% rename from crates/valence/examples/death.rs rename to examples/death.rs index d65f10a..ad00350 100644 --- a/crates/valence/examples/death.rs +++ b/examples/death.rs @@ -65,7 +65,7 @@ fn init_clients( } } -fn squat_and_die(mut clients: Query<&mut Client>, mut events: EventReader) { +fn squat_and_die(mut clients: Query<&mut Client>, mut events: EventReader) { for event in events.iter() { if event.state == SneakState::Start { if let Ok(mut client) = clients.get_mut(event.client) { diff --git a/crates/valence/examples/entity_hitbox.rs b/examples/entity_hitbox.rs similarity index 99% rename from crates/valence/examples/entity_hitbox.rs rename to examples/entity_hitbox.rs index 47a86c7..e81bb19 100644 --- a/crates/valence/examples/entity_hitbox.rs +++ b/examples/entity_hitbox.rs @@ -60,7 +60,7 @@ fn init_clients( fn spawn_entity( mut commands: Commands, - mut sneaking: EventReader, + mut sneaking: EventReader, client_query: Query<(&Position, &Location)>, ) { for sneaking in sneaking.iter() { diff --git a/crates/valence/examples/conway.rs b/examples/game_of_life.rs similarity index 99% rename from crates/valence/examples/conway.rs rename to examples/game_of_life.rs index 10aefe6..43e21a8 100644 --- a/crates/valence/examples/conway.rs +++ b/examples/game_of_life.rs @@ -185,7 +185,7 @@ fn update_board( } fn pause_on_crouch( - mut events: EventReader, + mut events: EventReader, mut board: ResMut, mut clients: Query<&mut Client>, ) { diff --git a/crates/valence/examples/parkour.rs b/examples/parkour.rs similarity index 100% rename from crates/valence/examples/parkour.rs rename to examples/parkour.rs diff --git a/crates/valence/examples/particles.rs b/examples/particles.rs similarity index 100% rename from crates/valence/examples/particles.rs rename to examples/particles.rs diff --git a/crates/valence/examples/player_list.rs b/examples/player_list.rs similarity index 100% rename from crates/valence/examples/player_list.rs rename to examples/player_list.rs diff --git a/crates/valence/examples/resource_pack.rs b/examples/resource_pack.rs similarity index 100% rename from crates/valence/examples/resource_pack.rs rename to examples/resource_pack.rs diff --git a/crates/valence/examples/server_list_ping.rs b/examples/server_list_ping.rs similarity index 95% rename from crates/valence/examples/server_list_ping.rs rename to examples/server_list_ping.rs index 7ce3793..25447b7 100644 --- a/crates/valence/examples/server_list_ping.rs +++ b/examples/server_list_ping.rs @@ -40,7 +40,7 @@ impl NetworkCallbacks for MyCallbacks { }], description: "Your IP address is ".into_text() + remote_addr.to_string().color(Color::GOLD), - favicon_png: include_bytes!("../../../assets/logo-64x64.png"), + favicon_png: include_bytes!("../assets/logo-64x64.png"), } } diff --git a/crates/valence/examples/terrain.rs b/examples/terrain.rs similarity index 100% rename from crates/valence/examples/terrain.rs rename to examples/terrain.rs diff --git a/crates/valence/examples/text.rs b/examples/text.rs similarity index 100% rename from crates/valence/examples/text.rs rename to examples/text.rs diff --git a/crates/valence/examples/world_border.rs b/examples/world_border.rs similarity index 100% rename from crates/valence/examples/world_border.rs rename to examples/world_border.rs diff --git a/crates/valence/src/lib.rs b/src/lib.rs similarity index 72% rename from crates/valence/src/lib.rs rename to src/lib.rs index 9ea6866..9ee2077 100644 --- a/crates/valence/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -#![doc = include_str!("../../../README.md")] // Points to the main project README. +#![doc = include_str!("../README.md")] // Points to the main project README. #![doc( html_logo_url = "https://raw.githubusercontent.com/valence-rs/valence/main/assets/logo.svg", html_favicon_url = "https://raw.githubusercontent.com/valence-rs/valence/main/assets/logo.svg" @@ -40,7 +40,7 @@ pub use valence_player_list as player_list; #[cfg(feature = "world_border")] pub use valence_world_border as world_border; pub use { - bevy_app as app, bevy_ecs as ecs, glam, valence_biome as biome, valence_block as block, + bevy_app, bevy_ecs, glam, valence_biome as biome, valence_block as block, valence_client as client, valence_dimension as dimension, valence_entity as entity, valence_instance as instance, valence_nbt as nbt, valence_registry as registry, }; @@ -58,62 +58,64 @@ pub use { /// ``` pub mod prelude { pub use ::uuid::Uuid; - pub use app::prelude::*; - pub use bevy_ecs; // Needed for bevy_ecs proc macros to function correctly. - pub use biome::{Biome, BiomeId, BiomeRegistry}; - pub use block::{BlockKind, BlockState, PropName, PropValue}; - pub use block_pos::BlockPos; - pub use chunk_pos::{ChunkPos, ChunkView}; - pub use client::action::*; - pub use client::command::*; - pub use client::event_loop::{EventLoopSchedule, EventLoopSet}; - pub use client::interact_entity::*; - pub use client::title::SetTitle as _; - pub use client::{ + pub use bevy_app::prelude::*; + pub use bevy_ecs; // Needed for bevy_ecs macros to function correctly. + pub use bevy_ecs::prelude::*; + pub use glam::{DVec2, DVec3, Vec2, Vec3}; + pub use ident::Ident; + #[cfg(feature = "advancement")] + pub use valence_advancement::{ + event::AdvancementTabChange, Advancement, AdvancementBundle, AdvancementClientUpdate, + AdvancementCriteria, AdvancementDisplay, AdvancementFrameType, AdvancementRequirements, + }; + pub use valence_biome::{Biome, BiomeId, BiomeRegistry}; + pub use valence_block::{BlockKind, BlockState, PropName, PropValue}; + pub use valence_client::action::{DiggingEvent, DiggingState}; + pub use valence_client::command::{ + ClientCommand, JumpWithHorseEvent, JumpWithHorseState, LeaveBedEvent, SneakEvent, + SneakState, SprintEvent, SprintState, + }; + pub use valence_client::event_loop::{EventLoopSchedule, EventLoopSet}; + pub use valence_client::interact_entity::{EntityInteraction, InteractEntityEvent}; + pub use valence_client::title::SetTitle as _; + pub use valence_client::{ despawn_disconnected_clients, Client, CompassPos, DeathLocation, HasRespawnScreen, HashedSeed, Ip, IsDebug, IsFlat, IsHardcore, OldView, OldViewDistance, PrevGameMode, Properties, ReducedDebugInfo, Username, View, ViewDistance, }; - pub use despawn::Despawned; - pub use dimension::{DimensionType, DimensionTypeRegistry}; - pub use direction::Direction; - pub use ecs::prelude::*; - pub use entity::{ + pub use valence_core::block_pos::BlockPos; + pub use valence_core::chunk_pos::{ChunkPos, ChunkView}; + pub use valence_core::despawn::Despawned; + pub use valence_core::direction::Direction; + pub use valence_core::game_mode::GameMode; + pub use valence_core::hand::Hand; + pub use valence_core::ident; // Export the `ident!` macro. + pub use valence_core::item::{ItemKind, ItemStack}; + pub use valence_core::particle::Particle; + pub use valence_core::text::{Color, Text, TextFormat}; + pub use valence_core::uuid::UniqueId; + pub use valence_core::{translation_key, CoreSettings, Server}; + pub use valence_dimension::{DimensionType, DimensionTypeRegistry}; + pub use valence_entity::hitbox::{Hitbox, HitboxShape}; + pub use valence_entity::{ EntityAnimation, EntityKind, EntityManager, EntityStatus, HeadYaw, Location, Look, OldLocation, OldPosition, Position, }; - pub use game_mode::GameMode; - pub use glam::{DVec2, DVec3, Vec2, Vec3}; - pub use hand::Hand; - pub use ident::Ident; - pub use instance::{Block, BlockMut, BlockRef, Chunk, Instance}; + pub use valence_instance::{Block, BlockMut, BlockRef, Chunk, Instance}; #[cfg(feature = "inventory")] - pub use inventory::{ + pub use valence_inventory::{ CursorItem, Inventory, InventoryKind, InventoryWindow, InventoryWindowMut, OpenInventory, }; - pub use item::{ItemKind, ItemStack}; - pub use nbt::Compound; + pub use valence_nbt::Compound; #[cfg(feature = "network")] - pub use network::{ - ErasedNetworkCallbacks, NetworkCallbacks, NetworkSettings, NewClientInfo, + pub use valence_network::{ + ConnectionMode, ErasedNetworkCallbacks, NetworkCallbacks, NetworkSettings, NewClientInfo, SharedNetworkState, }; - pub use particle::Particle; #[cfg(feature = "player_list")] - pub use player_list::{PlayerList, PlayerListEntry}; - pub use text::{Color, Text, TextFormat}; - #[cfg(feature = "advancement")] - pub use valence_advancement::{ - event::AdvancementTabChange, Advancement, AdvancementBundle, AdvancementClientUpdate, - AdvancementCriteria, AdvancementDisplay, AdvancementFrameType, AdvancementRequirements, - }; - pub use valence_core::ident; // Export the `ident!` macro. - pub use valence_core::uuid::UniqueId; - pub use valence_core::{translation_key, CoreSettings, Server}; - pub use valence_entity::hitbox::{Hitbox, HitboxShape}; + pub use valence_player_list::{PlayerList, PlayerListEntry}; pub use super::DefaultPlugins; - use super::*; } /// This plugin group will add all the default plugins for a Valence diff --git a/crates/valence/src/tests.rs b/src/tests.rs similarity index 100% rename from crates/valence/src/tests.rs rename to src/tests.rs diff --git a/crates/valence/src/tests/client.rs b/src/tests/client.rs similarity index 100% rename from crates/valence/src/tests/client.rs rename to src/tests/client.rs diff --git a/crates/valence/src/tests/example.rs b/src/tests/example.rs similarity index 94% rename from crates/valence/src/tests/example.rs rename to src/tests/example.rs index 35302c6..c0c9a14 100644 --- a/crates/valence/src/tests/example.rs +++ b/src/tests/example.rs @@ -6,11 +6,14 @@ //! Some of the tests in this file may be inferior duplicates of real tests. use bevy_app::App; +use glam::DVec3; use valence_client::movement::PositionAndOnGroundC2s; +use valence_client::Client; +use valence_entity::Position; use valence_inventory::packet::{InventoryS2c, OpenScreenS2c}; +use valence_inventory::{Inventory, InventoryKind, OpenInventory}; use super::*; -use crate::prelude::*; /// The server's tick should increment every update. #[test] diff --git a/crates/valence/src/tests/inventory.rs b/src/tests/inventory.rs similarity index 100% rename from crates/valence/src/tests/inventory.rs rename to src/tests/inventory.rs diff --git a/crates/valence/src/tests/weather.rs b/src/tests/weather.rs similarity index 100% rename from crates/valence/src/tests/weather.rs rename to src/tests/weather.rs diff --git a/crates/valence/src/tests/world_border.rs b/src/tests/world_border.rs similarity index 100% rename from crates/valence/src/tests/world_border.rs rename to src/tests/world_border.rs diff --git a/tools/dump_schedule/Cargo.toml b/tools/dump_schedule/Cargo.toml index 58f6941..9a82313 100644 --- a/tools/dump_schedule/Cargo.toml +++ b/tools/dump_schedule/Cargo.toml @@ -5,4 +5,4 @@ edition.workspace = true [dependencies] bevy_mod_debugdump.workspace = true -valence.path = "../../crates/valence" +valence.workspace = true diff --git a/tools/packet_inspector/Cargo.toml b/tools/packet_inspector/Cargo.toml index 4574440..dd5ca80 100644 --- a/tools/packet_inspector/Cargo.toml +++ b/tools/packet_inspector/Cargo.toml @@ -43,12 +43,11 @@ syntect = { workspace = true, default-features = false, optional = true, feature serde = { workspace = true, optional = true, features = ["derive"] } clap = { workspace = true, optional = true, features = ["derive"] } - [build-dependencies] -syn = "2.0.18" -anyhow = "1.0.71" -heck = "0.4.1" -proc-macro2 = "1.0.60" -quote = "1.0.28" -serde = { version = "1.0.164", features = ["derive"] } -serde_json = "1.0.96" +syn.workspace = true +anyhow.workspace = true +heck.workspace = true +proc-macro2.workspace = true +quote.workspace = true +serde = { workspace = true, features = ["derive"] } +serde_json.workspace = true diff --git a/tools/packet_inspector/README.md b/tools/packet_inspector/README.md index 1882ed7..5b510a3 100644 --- a/tools/packet_inspector/README.md +++ b/tools/packet_inspector/README.md @@ -17,7 +17,7 @@ Firstly, we should have a server running that we're going to be proxying/inspecting. ```sh -cargo r -r --example conway +cargo r -r --example game_of_life ``` Next up, we need to run the proxy server, this can be done in 2 different ways, diff --git a/tools/playground/src/extras.rs b/tools/playground/src/extras.rs index d1e44d6..3b384d0 100644 --- a/tools/playground/src/extras.rs +++ b/tools/playground/src/extras.rs @@ -1,14 +1,14 @@ //! Put stuff in here if you find that you have to write the same code for //! multiple playgrounds. -use valence::client::command::{SneakState, Sneaking}; +use valence::client::command::{SneakEvent, SneakState}; use valence::prelude::*; /// Toggles client's game mode between survival and creative when they start /// sneaking. pub fn toggle_gamemode_on_sneak( mut clients: Query<&mut GameMode>, - mut events: EventReader, + mut events: EventReader, ) { for event in events.iter() { if event.state == SneakState::Start { diff --git a/tools/playground/src/main.rs b/tools/playground/src/main.rs index 6d9a94f..27ad0d1 100644 --- a/tools/playground/src/main.rs +++ b/tools/playground/src/main.rs @@ -18,7 +18,7 @@ use clap::Parser; use tracing::Level; -use valence::app::App; +use valence::bevy_app::App; #[allow(dead_code)] mod extras;