aboutsummaryrefslogtreecommitdiff
path: root/azalea/src/lib.rs
blob: 8c29e2c3629869d06d3d12f803e3c1d11c6ca5db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#![doc = include_str!("../README.md")]
#![feature(type_changing_struct_update)]

#[cfg(doc)]
pub mod _docs;
pub mod accept_resource_packs;
pub mod auto_reconnect;
pub mod auto_respawn;
pub mod auto_tool;
pub mod bot;
mod builder;
mod client_impl;
pub mod container;
mod entity_ref;
pub mod events;
mod join_opts;
pub mod nearest_entity;
pub mod pathfinder;
pub mod prelude;
pub mod swarm;
pub mod tick_broadcast;

pub use azalea_auth as auth;
pub use azalea_block as block;
#[doc(hidden)]
#[deprecated = "moved to `azalea::block`"]
pub mod blocks {
    pub type BlockStates = azalea_block::BlockStates;
    pub type BlockState = azalea_block::BlockState;
    pub trait BlockTrait: azalea_block::BlockTrait {}
    // azalea_block has more items but rust doesn't mark them deprecated if we
    // `use azalea_block::*`, so hopefully the three types above are enough for
    // most users :(
}

pub use azalea_brigadier as brigadier;
pub use azalea_buf as buf;
pub use azalea_chat::FormattedText;
pub use azalea_client::*;
pub use azalea_core as core;
// these are re-exported on this level because they're very common
pub use azalea_core::position::{BlockPos, Vec3};
pub use azalea_entity as entity;
pub use azalea_physics as physics;
pub use azalea_protocol as protocol;
pub use azalea_registry as registry;
#[doc(hidden)]
#[deprecated(note = "renamed to `Identifier`.")]
pub type ResourceLocation = azalea_registry::identifier::Identifier;

// TODO: replace this mod with the commented line below
// pub use azalea_chat as chat;
pub mod chat {
    pub use azalea_chat::*;
    #[deprecated = "moved to `azalea::client_chat`."]
    pub type ChatPacket = azalea_client::client_chat::ChatPacket;
}

pub use azalea_registry::identifier::Identifier;
pub use azalea_world as world;
pub use bevy_app as app;
pub use bevy_ecs as ecs;
use bevy_ecs::component::Component;
pub use builder::ClientBuilder;
use futures::future::BoxFuture;
pub use join_opts::JoinOpts;

pub use crate::{
    client_impl::{Client, StartClientOpts, error},
    entity_ref::EntityRef,
    events::Event,
};

// for convenience, adds the alias `azalea::Result` instead of
// `azalea::error::AzaleaResult`. the user should probably be using anyhow/eyre,
// but in some cases they may prefer to have the errors more strictly defined.
pub type Result<T> = error::AzaleaResult<T>;

pub type BoxHandleFn<S, R> = Box<dyn Fn(Client, Event, S) -> BoxFuture<'static, R> + Send>;
pub type HandleFn<S, Fut> = fn(Client, Event, S) -> Fut;

/// A marker that can be used in place of a State in [`ClientBuilder`] or
/// [`SwarmBuilder`].
///
/// You probably don't need to use this manually since the compiler will infer
/// it for you.
///
/// [`SwarmBuilder`]: swarm::SwarmBuilder
#[derive(Clone, Component, Default)]
pub struct NoState;