Skip to main content

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