ghast_data/lib.rs
1//! Static Minecraft Java Edition game data for the ghast client library.
2//!
3//! One module per supported version, each behind a cargo feature:
4//!
5//! | module | feature | version | block model |
6//! |---|---|---|---|
7//! | [`v1_8`] | `v1_8` | 1.8.x (protocol 47) | `id << 4 \| meta` |
8//! | [`v1_16_5`] | `v1_16_5` | 1.16.5 (protocol 754) | global palette with properties |
9//!
10//! All tables are generated (`codegen/data`) from PrismarineJS minecraft-data 3.119.0 plus a small
11//! hand-maintained file of physics facts, and live in `static` memory: no runtime parsing, no lazy
12//! initialisation, lookups by id are array indexing, lookups by name are binary searches.
13//!
14//! ```
15//! # #[cfg(feature = "v1_8")] {
16//! use ghast_data::v1_8::{Block, BlockState};
17//! let slab = BlockState::new(Block::STONE_SLAB, 0);
18//! assert_eq!(slab.shape()[0].max_y, 0.5);
19//! assert_eq!(Block::ICE.physics().slipperiness, 0.98);
20//! # }
21//! ```
22//!
23//! Collision shapes are vanilla-exact only where the source data is; blocks whose shape depends on
24//! neighbours, entities or block entities say so via [`ShapeDependency`] instead of returning a
25//! fake static shape. See the crate README for known data discrepancies.
26
27#![forbid(unsafe_code)]
28#![warn(missing_docs, unnameable_types)]
29
30pub mod common;
31mod generated;
32#[cfg_attr(
33 not(any(feature = "v1_8", feature = "v1_16_5")),
34 allow(unused_macros, unused_imports)
35)]
36mod macros;
37
38#[cfg(feature = "v1_16_5")]
39pub mod v1_16_5;
40#[cfg(feature = "v1_8")]
41pub mod v1_8;
42
43pub use common::{
44 Aabb, BiomeInfo, BlockInfo, BlockPhysics, BoundingBox, Collision, DigMaterial, Drop,
45 EffectInfo, EnchantCost, EnchantmentInfo, EntityDimensions, EntityInfo, EntityKind, Fluid,
46 FluidKind, FoodInfo, ItemInfo, NeighbourShape, PhysicsFlags, ShapeDependency,
47 VanillaEntitySize, WorldCoord, WorldCoords,
48};