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