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