2022-04-15 07:55:45 +10:00
|
|
|
#![forbid(unsafe_code)]
|
2022-04-29 17:48:41 +10:00
|
|
|
#![warn(
|
|
|
|
missing_debug_implementations,
|
|
|
|
trivial_casts,
|
|
|
|
trivial_numeric_casts,
|
|
|
|
unused_lifetimes,
|
|
|
|
unused_import_braces,
|
|
|
|
missing_docs
|
|
|
|
)]
|
2022-04-15 07:55:45 +10:00
|
|
|
|
|
|
|
mod aabb;
|
2022-04-18 10:06:13 +10:00
|
|
|
pub mod block;
|
2022-04-15 07:55:45 +10:00
|
|
|
mod block_pos;
|
|
|
|
mod byte_angle;
|
2022-04-29 17:48:41 +10:00
|
|
|
pub mod chunk;
|
|
|
|
pub mod client;
|
2022-04-15 07:55:45 +10:00
|
|
|
mod codec;
|
|
|
|
pub mod component;
|
|
|
|
pub mod config;
|
|
|
|
pub mod entity;
|
|
|
|
pub mod identifier;
|
|
|
|
mod packets;
|
|
|
|
mod protocol;
|
2022-04-29 17:48:41 +10:00
|
|
|
pub mod server;
|
|
|
|
mod slotmap;
|
2022-04-15 07:55:45 +10:00
|
|
|
pub mod text;
|
|
|
|
pub mod util;
|
|
|
|
mod var_int;
|
|
|
|
mod var_long;
|
2022-04-29 17:48:41 +10:00
|
|
|
pub mod world;
|
2022-04-15 07:55:45 +10:00
|
|
|
|
|
|
|
pub use aabb::Aabb;
|
2022-04-29 17:48:41 +10:00
|
|
|
pub use block_pos::BlockPos;
|
|
|
|
pub use chunk::{Chunk, ChunkPos, ChunkStore};
|
|
|
|
pub use client::{Client, ClientStore};
|
2022-04-15 07:55:45 +10:00
|
|
|
pub use config::{BiomeId, DimensionId, ServerConfig};
|
2022-04-29 17:48:41 +10:00
|
|
|
pub use entity::{Entity, EntityId, EntityStore};
|
2022-04-15 07:55:45 +10:00
|
|
|
pub use identifier::Identifier;
|
|
|
|
pub use text::{Text, TextFormat};
|
|
|
|
pub use uuid::Uuid;
|
2022-04-29 17:48:41 +10:00
|
|
|
pub use world::{World, WorldId, WorldStore};
|
|
|
|
pub use {nalgebra_glm as glm, nbt, uuid};
|
2022-04-15 07:55:45 +10:00
|
|
|
|
|
|
|
pub use crate::server::{NewClientData, Server, SharedServer, ShutdownResult};
|
|
|
|
|
|
|
|
/// The Minecraft protocol version that this library targets.
|
|
|
|
pub const PROTOCOL_VERSION: i32 = 758;
|
|
|
|
/// The name of the Minecraft version that this library targets.
|
|
|
|
pub const VERSION_NAME: &str = "1.18.2";
|
|
|
|
|
|
|
|
/// The namespace for this library used internally for namespaced identifiers.
|
|
|
|
const LIBRARY_NAMESPACE: &str = "valence";
|
|
|
|
|
|
|
|
/// A discrete unit of time where 1 tick is the duration of a
|
|
|
|
/// single game update.
|
|
|
|
///
|
|
|
|
/// The duration of a game update depends on the current configuration, which
|
|
|
|
/// may or may not be the same as Minecraft's standard 20 ticks/second.
|
|
|
|
pub type Ticks = i64;
|
2022-04-29 17:48:41 +10:00
|
|
|
|
|
|
|
/// Types such as [`EntityId`], [`WorldId`], and [`ChunkId`] which can be used
|
|
|
|
/// as indices into an array.
|
|
|
|
///
|
|
|
|
/// Every ID is either valid or invalid. Valid IDs point to living values. For
|
|
|
|
/// instance, a valid [`EntityId`] points to a living entity on the server. When
|
|
|
|
/// that entity is deleted, the corresponding [`EntityId`] becomes invalid.
|
|
|
|
pub trait Id: Copy + Send + Sync + PartialEq + Eq {
|
|
|
|
/// Returns the index of this ID.
|
|
|
|
///
|
|
|
|
/// For all IDs `a` and `b`, `a == b` implies `a.idx() == b.idx()`. If
|
|
|
|
/// both `a` and `b` are currently valid, then `a != b` implies `a.idx() !=
|
|
|
|
/// b.idx()`.
|
|
|
|
fn idx(self) -> usize;
|
|
|
|
}
|