mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 23:44:38 +00:00
start fixing tests
This commit is contained in:
parent
e0cb50fea0
commit
2f1483f483
3 changed files with 20 additions and 7 deletions
|
@ -63,13 +63,14 @@ impl Component {
|
|||
///
|
||||
/// ```rust
|
||||
/// use azalea_chat::Component;
|
||||
/// use serde::de::Deserialize;
|
||||
///
|
||||
/// let component = Component::deserialize(&serde_json::json!({
|
||||
/// "text": "Hello, world!",
|
||||
/// "color": "red",
|
||||
/// })).unwrap();
|
||||
///
|
||||
/// println!("{}", component.to_ansi());
|
||||
/// println!("{}", component.to_ansi(None));
|
||||
/// ```
|
||||
pub fn to_ansi(&self, default_style: Option<&Style>) -> String {
|
||||
// default the default_style to white if it's not set
|
||||
|
|
|
@ -231,7 +231,10 @@ fn jump_boost_power<D: DerefMut<Target = World>>(_entity: &Entity<D>) -> f64 {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use azalea_core::ChunkPos;
|
||||
use azalea_world::{Chunk, World};
|
||||
use azalea_world::{
|
||||
entity::{metadata, EntityMetadata},
|
||||
Chunk, World,
|
||||
};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[test]
|
||||
|
@ -247,6 +250,7 @@ mod tests {
|
|||
y: 70.,
|
||||
z: 0.,
|
||||
},
|
||||
EntityMetadata::Player(metadata::Player::default()),
|
||||
),
|
||||
);
|
||||
let mut entity = world.entity_mut(0).unwrap();
|
||||
|
@ -279,6 +283,7 @@ mod tests {
|
|||
y: 70.,
|
||||
z: 0.5,
|
||||
},
|
||||
EntityMetadata::Player(metadata::Player::default()),
|
||||
),
|
||||
);
|
||||
let block_state = world.set_block_state(&BlockPos { x: 0, y: 69, z: 0 }, BlockState::Stone);
|
||||
|
@ -311,6 +316,7 @@ mod tests {
|
|||
y: 71.,
|
||||
z: 0.5,
|
||||
},
|
||||
EntityMetadata::Player(metadata::Player::default()),
|
||||
),
|
||||
);
|
||||
let block_state = world.set_block_state(
|
||||
|
@ -344,6 +350,7 @@ mod tests {
|
|||
y: 71.,
|
||||
z: 0.5,
|
||||
},
|
||||
EntityMetadata::Player(metadata::Player::default()),
|
||||
),
|
||||
);
|
||||
let block_state = world.set_block_state(
|
||||
|
@ -377,6 +384,7 @@ mod tests {
|
|||
y: 73.,
|
||||
z: 0.5,
|
||||
},
|
||||
EntityMetadata::Player(metadata::Player::default()),
|
||||
),
|
||||
);
|
||||
let block_state = world.set_block_state(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use azalea::prelude::*;
|
||||
use azalea::{Account, Accounts, Client, Event, Swarm};
|
||||
use azalea::{prelude::*, SwarmEvent};
|
||||
use azalea::{Account, Client, Event, Swarm};
|
||||
use parking_lot::Mutex;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
@ -42,9 +42,13 @@ async fn handle(bot: Client, event: Event, state: State) -> anyhow::Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
async fn swarm_handle<S>(swarm: Swarm<S>, event: Event, state: SwarmState) -> anyhow::Result<()> {
|
||||
match event {
|
||||
Event::Login => {
|
||||
async fn swarm_handle(
|
||||
swarm: Swarm<State>,
|
||||
event: SwarmEvent,
|
||||
state: SwarmState,
|
||||
) -> anyhow::Result<()> {
|
||||
match &event {
|
||||
SwarmEvent::Login => {
|
||||
swarm.goto(azalea::BlockPos::new(0, 70, 0)).await;
|
||||
// or bots.goto_goal(pathfinder::Goals::Goto(azalea::BlockPos(0, 70, 0))).await;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue