chunkedge/
lib.rs

1#![cfg_attr(
2    unstable_doc,
3    doc = "**❗ NOTE:** This documentation is sourced from the `main` branch. Guides and general project documentation can be found in [`docs`].\n\n---\n"
4)]
5#![doc = include_str!("../README.md")]
6#![cfg_attr(
7    doc,
8    doc = "\n\n## General Project Documentation\n\nThe guides, FAQ, and other pages are available in [`docs`].\n"
9)]
10#![doc(
11    html_logo_url = "https://raw.githubusercontent.com/ChunkEdge/ChunkEdge/main/assets/logo.svg",
12    html_favicon_url = "https://raw.githubusercontent.com/ChunkEdge/ChunkEdge/main/assets/logo.svg"
13)]
14#![deny(
15    rustdoc::broken_intra_doc_links,
16    rustdoc::private_intra_doc_links,
17    rustdoc::missing_crate_level_docs,
18    rustdoc::invalid_codeblock_attributes,
19    rustdoc::invalid_rust_codeblocks,
20    rustdoc::bare_urls,
21    rustdoc::invalid_html_tags
22)]
23#![warn(
24    trivial_casts,
25    trivial_numeric_casts,
26    unused_lifetimes,
27    unused_import_braces,
28    unreachable_pub,
29    clippy::dbg_macro
30)]
31
32use bevy_app::{PluginGroup, PluginGroupBuilder};
33
34#[cfg(doc)]
35pub mod docs;
36
37#[cfg(feature = "testing")]
38pub mod testing;
39
40#[cfg(test)]
41mod tests;
42
43#[cfg(feature = "log")]
44pub use bevy_log as log;
45#[cfg(feature = "advancement")]
46pub use chunkedge_advancement as advancement;
47#[cfg(feature = "anvil")]
48pub use chunkedge_anvil as anvil;
49#[cfg(feature = "boss_bar")]
50pub use chunkedge_boss_bar as boss_bar;
51#[cfg(feature = "command")]
52pub use chunkedge_command as command;
53#[cfg(feature = "command")]
54pub use chunkedge_command_macros as command_macros;
55#[cfg(feature = "equipment")]
56pub use chunkedge_equipment as equipment;
57#[cfg(feature = "inventory")]
58pub use chunkedge_inventory as inventory;
59#[cfg(feature = "network")]
60pub use chunkedge_network as network;
61#[cfg(feature = "player_list")]
62pub use chunkedge_player_list as player_list;
63use chunkedge_registry::RegistryPlugin;
64#[cfg(feature = "scoreboard")]
65pub use chunkedge_scoreboard as scoreboard;
66use chunkedge_server::abilities::AbilitiesPlugin;
67use chunkedge_server::action::ActionPlugin;
68use chunkedge_server::client::ClientPlugin;
69use chunkedge_server::client_command::ClientCommandPlugin;
70use chunkedge_server::client_settings::ClientSettingsPlugin;
71use chunkedge_server::custom_payload::CustomPayloadPlugin;
72use chunkedge_server::entity::hitbox::HitboxPlugin;
73use chunkedge_server::entity::EntityPlugin;
74use chunkedge_server::event_loop::EventLoopPlugin;
75use chunkedge_server::hand_swing::HandSwingPlugin;
76use chunkedge_server::interact_block::InteractBlockPlugin;
77use chunkedge_server::interact_entity::InteractEntityPlugin;
78use chunkedge_server::interact_item::InteractItemPlugin;
79use chunkedge_server::keepalive::KeepalivePlugin;
80use chunkedge_server::layer::LayerPlugin;
81use chunkedge_server::message::MessagePlugin;
82use chunkedge_server::movement::MovementPlugin;
83use chunkedge_server::op_level::OpLevelPlugin;
84pub use chunkedge_server::protocol::status_effects;
85use chunkedge_server::resource_pack::ResourcePackPlugin;
86use chunkedge_server::status::StatusPlugin;
87use chunkedge_server::status_effect::StatusEffectPlugin;
88use chunkedge_server::teleport::TeleportPlugin;
89pub use chunkedge_server::*;
90#[cfg(feature = "weather")]
91pub use chunkedge_weather as weather;
92#[cfg(feature = "world_border")]
93pub use chunkedge_world_border as world_border;
94use registry::biome::BiomePlugin;
95use registry::dimension_type::DimensionTypePlugin;
96pub use {chunkedge_item as item, chunkedge_lang as lang};
97
98/// Contains the most frequently used items in ChunkEdge projects.
99///
100/// This is usually glob imported like so:
101///
102/// ```no_run
103/// use chunkedge::prelude::*; // Glob import.
104///
105/// let mut app = App::empty();
106/// app.add_systems(Update, || println!("yippee!"));
107/// app.update()
108/// // ...
109/// ```
110pub mod prelude {
111    pub use bevy_app::prelude::*;
112    pub use bevy_ecs; // Needed for bevy_ecs macros to function correctly.
113    pub use bevy_ecs::prelude::*;
114    #[cfg(feature = "advancement")]
115    pub use chunkedge_advancement::{
116        event::AdvancementTabChangeEvent, Advancement, AdvancementBundle, AdvancementClientUpdate,
117        AdvancementCriteria, AdvancementDisplay, AdvancementFrameType, AdvancementRequirements,
118    };
119    #[cfg(feature = "equipment")]
120    pub use chunkedge_equipment::Equipment;
121    #[cfg(feature = "inventory")]
122    pub use chunkedge_inventory::{
123        CursorItem, Inventory, InventoryKind, InventoryWindow, InventoryWindowMut, OpenInventory,
124    };
125    #[cfg(feature = "network")]
126    pub use chunkedge_network::{
127        ConnectionMode, ErasedNetworkCallbacks, NetworkCallbacks, NetworkSettings, NewClientInfo,
128        SharedNetworkState,
129    };
130    #[cfg(feature = "player_list")]
131    pub use chunkedge_player_list::{PlayerList, PlayerListEntry};
132    pub use chunkedge_registry::biome::{Biome, BiomeId, BiomeRegistry};
133    pub use chunkedge_registry::dimension_type::{DimensionType, DimensionTypeRegistry};
134    pub use chunkedge_server::action::{DiggingEvent, DiggingState};
135    pub use chunkedge_server::block::{BlockKind, BlockState, PropName, PropValue};
136    pub use chunkedge_server::client::{
137        despawn_disconnected_clients, Client, Ip, OldView, OldViewDistance, Properties, Username,
138        View, ViewDistance, VisibleChunkLayer, VisibleEntityLayers,
139    };
140    pub use chunkedge_server::client_command::{
141        JumpWithHorseEvent, JumpWithHorseState, LeaveBedEvent, PlayerCommand, SneakEvent,
142        SneakState, SprintEvent, SprintState,
143    };
144    pub use chunkedge_server::entity::hitbox::{Hitbox, HitboxShape};
145    pub use chunkedge_server::entity::{
146        EntityAnimation, EntityKind, EntityLayerId, EntityManager, EntityStatus, HeadYaw, Look,
147        OldEntityLayerId, OldPosition, Position,
148    };
149    pub use chunkedge_server::event_loop::{
150        EventLoopPostUpdate, EventLoopPreUpdate, EventLoopUpdate,
151    };
152    pub use chunkedge_server::ident::Ident;
153    pub use chunkedge_server::interact_entity::{EntityInteraction, InteractEntityEvent};
154    pub use chunkedge_server::layer::chunk::{
155        Block, BlockRef, Chunk, ChunkLayer, LoadedChunk, UnloadedChunk,
156    };
157    pub use chunkedge_server::layer::{EntityLayer, LayerBundle};
158    pub use chunkedge_server::math::{DVec2, DVec3, Vec2, Vec3};
159    pub use chunkedge_server::message::SendMessage as _;
160    pub use chunkedge_server::nbt::Compound;
161    pub use chunkedge_server::protocol::packets::play::level_particles_s2c::Particle;
162    pub use chunkedge_server::protocol::text::{Color, IntoText, Text};
163    pub use chunkedge_server::protocol::RegistryId;
164    pub use chunkedge_server::spawn::{
165        ClientSpawnQuery, ClientSpawnQueryReadOnly, RespawnPosition,
166    };
167    pub use chunkedge_server::title::SetTitle as _;
168    pub use chunkedge_server::{
169        ident, BlockPos, ChunkPos, ChunkView, Despawned, Direction, GameMode, Hand, ItemKind,
170        ItemStack, Server, UniqueId,
171    };
172    pub use uuid::Uuid;
173
174    pub use super::DefaultPlugins;
175}
176
177/// This plugin group will add all the default plugins for a ChunkEdge
178/// application.
179///
180/// [`DefaultPlugins`] obeys Cargo feature flags. Users may exert control over
181/// this plugin group by disabling `default-features` in their `Cargo.toml` and
182/// enabling only those features that they wish to use.
183pub struct DefaultPlugins;
184
185impl PluginGroup for DefaultPlugins {
186    fn build(self) -> PluginGroupBuilder {
187        #[allow(unused_mut)]
188        let mut group = PluginGroupBuilder::start::<Self>()
189            .add(ServerPlugin)
190            .add(RegistryPlugin)
191            .add(BiomePlugin)
192            .add(DimensionTypePlugin)
193            .add(EntityPlugin)
194            .add(HitboxPlugin)
195            .add(LayerPlugin)
196            .add(ClientPlugin)
197            .add(EventLoopPlugin)
198            .add(MovementPlugin)
199            .add(ClientCommandPlugin)
200            .add(KeepalivePlugin)
201            .add(InteractEntityPlugin)
202            .add(ClientSettingsPlugin)
203            .add(ActionPlugin)
204            .add(TeleportPlugin)
205            .add(MessagePlugin)
206            .add(CustomPayloadPlugin)
207            .add(HandSwingPlugin)
208            .add(InteractBlockPlugin)
209            .add(InteractItemPlugin)
210            .add(OpLevelPlugin)
211            .add(ResourcePackPlugin)
212            .add(StatusPlugin)
213            .add(StatusEffectPlugin)
214            .add(AbilitiesPlugin);
215
216        #[cfg(feature = "log")]
217        {
218            group = group.add(bevy_log::LogPlugin::default())
219        }
220
221        #[cfg(feature = "network")]
222        {
223            group = group.add(chunkedge_network::NetworkPlugin)
224        }
225
226        #[cfg(feature = "player_list")]
227        {
228            group = group.add(chunkedge_player_list::PlayerListPlugin)
229        }
230
231        #[cfg(feature = "equipment")]
232        {
233            group = group.add(chunkedge_equipment::EquipmentPlugin)
234        }
235
236        #[cfg(feature = "inventory")]
237        {
238            group = group.add(chunkedge_inventory::InventoryPlugin)
239        }
240
241        #[cfg(feature = "anvil")]
242        {
243            group = group.add(chunkedge_anvil::AnvilPlugin)
244        }
245
246        #[cfg(feature = "advancement")]
247        {
248            group = group.add(chunkedge_advancement::AdvancementPlugin)
249        }
250
251        #[cfg(feature = "weather")]
252        {
253            group = group.add(chunkedge_weather::WeatherPlugin)
254        }
255
256        #[cfg(feature = "world_border")]
257        {
258            group = group.add(chunkedge_world_border::WorldBorderPlugin)
259        }
260
261        #[cfg(feature = "boss_bar")]
262        {
263            group = group.add(chunkedge_boss_bar::BossBarPlugin)
264        }
265
266        #[cfg(feature = "command")]
267        {
268            group = group.add(chunkedge_command::manager::CommandPlugin)
269        }
270
271        #[cfg(feature = "scoreboard")]
272        {
273            group = group.add(chunkedge_scoreboard::ScoreboardPlugin)
274        }
275
276        group
277    }
278}