1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 23:44:38 +00:00

fix all the tests

This commit is contained in:
Ubuntu 2023-01-30 18:30:04 +00:00
commit 27fce90682
5 changed files with 11 additions and 12 deletions

View file

@ -40,7 +40,7 @@ async fn main() {
if sender == client.profile.name { if sender == client.profile.name {
continue; // ignore our own messages continue; // ignore our own messages
} }
client.chat(&content).await; client.chat(&content);
}; };
} }
_ => {} _ => {}

View file

@ -150,7 +150,7 @@ impl Client {
/// ```rust,no_run /// ```rust,no_run
/// # use azalea_client::{Client, Event}; /// # use azalea_client::{Client, Event};
/// # async fn handle(bot: Client, event: Event) -> anyhow::Result<()> { /// # async fn handle(bot: Client, event: Event) -> anyhow::Result<()> {
/// bot.chat("Hello, world!").await.unwrap(); /// bot.chat("Hello, world!");
/// # Ok(()) /// # Ok(())
/// # } /// # }
/// ``` /// ```

View file

@ -27,13 +27,19 @@ impl Client {
/// # Example /// # Example
/// Note that this will very likely change in the future. /// Note that this will very likely change in the future.
/// ``` /// ```
/// use azalea_client::{Client, GameProfileComponent};
/// use azalea_ecs::query::With;
/// use azalea_world::entity::{Position, metadata::Player};
///
/// # fn example(mut bot: Client, sender_name: String) {
/// let entity = bot.entity_by::<With<Player>, (&GameProfileComponent,)>( /// let entity = bot.entity_by::<With<Player>, (&GameProfileComponent,)>(
/// |profile: &&GameProfileComponent| profile.name == sender, /// |profile: &&GameProfileComponent| profile.name == sender_name,
/// ); /// );
/// if let Some(entity) = entity { /// if let Some(entity) = entity {
/// let position = bot.entity_component::<Position>(entity); /// let position = bot.entity_component::<Position>(entity);
/// // ... /// // ...
/// } /// }
/// # }
/// ``` /// ```
pub fn entity_by<F: ReadOnlyWorldQuery, Q: ReadOnlyWorldQuery>( pub fn entity_by<F: ReadOnlyWorldQuery, Q: ReadOnlyWorldQuery>(
&mut self, &mut self,

View file

@ -12,10 +12,7 @@
//! - Rename bevy_ecs::world::World to azalea_ecs::ecs::Ecs //! - Rename bevy_ecs::world::World to azalea_ecs::ecs::Ecs
//! - Re-export `bevy_app` in the `app` module. //! - Re-export `bevy_app` in the `app` module.
use std::{ use std::time::{Duration, Instant};
task::{Context, Poll},
time::{Duration, Instant},
};
pub mod ecs { pub mod ecs {
pub use bevy_ecs::world::World as Ecs; pub use bevy_ecs::world::World as Ecs;
@ -91,9 +88,7 @@ pub struct TickStage {
impl Stage for TickStage { impl Stage for TickStage {
fn run(&mut self, ecs: &mut Ecs) { fn run(&mut self, ecs: &mut Ecs) {
// if the interval is 0, that means it runs every tick // if the interval is 0, that means it runs every tick
println!("running tick stage maybe");
if self.interval.is_zero() { if self.interval.is_zero() {
println!("running tick stage");
self.stage.run(ecs); self.stage.run(ecs);
return; return;
} }

View file

@ -312,7 +312,6 @@ mod tests {
entity::{EntityBundle, MinecraftEntityId}, entity::{EntityBundle, MinecraftEntityId},
Chunk, EntityPlugin, PartialWorld, Chunk, EntityPlugin, PartialWorld,
}; };
use iyes_loopless::fixedtimestep::FixedTimestepStageLabel;
use parking_lot::RwLock; use parking_lot::RwLock;
use uuid::Uuid; use uuid::Uuid;
@ -331,12 +330,11 @@ mod tests {
#[test] #[test]
fn test_gravity() { fn test_gravity() {
let mut app = make_test_app(); let mut app = make_test_app();
let world_lock = app.world.resource_mut::<WorldContainer>().insert( let _world_lock = app.world.resource_mut::<WorldContainer>().insert(
ResourceLocation::new("minecraft:overworld").unwrap(), ResourceLocation::new("minecraft:overworld").unwrap(),
384, 384,
-64, -64,
); );
let mut partial_world = PartialWorld::default();
let entity = app let entity = app
.world .world