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//! | [`v26_3`] | `v26_3` | 26.3 (protocol 777) | global palette with properties; movement facts from the jar |
13//!
14//! All tables are generated (`codegen/data`) from PrismarineJS minecraft-data 3.119.0 plus a small
15//! hand-maintained file of physics facts, and live in `static` memory: no runtime parsing, no lazy
16//! initialisation, lookups by id are array indexing, lookups by name are binary searches.
17//!
18//! ```
19//! # #[cfg(feature = "v1_8")] {
20//! use ghast_data::v1_8::{Block, BlockState};
21//! let slab = BlockState::new(Block::STONE_SLAB, 0);
22//! assert_eq!(slab.shape()[0].max_y, 0.5);
23//! assert_eq!(Block::ICE.physics().slipperiness, 0.98);
24//! # }
25//! ```
26//!
27//! Collision shapes are vanilla-exact only where the source data is; blocks whose shape depends on
28//! neighbours, entities or block entities say so via [`ShapeDependency`] instead of returning a
29//! fake static shape. See the crate README for known data discrepancies.
30
31#![forbid(unsafe_code)]
32#![warn(missing_docs, unnameable_types)]
33// The version table above links every default module; a build with fewer versions has no
34// target for some of the links (docs.rs builds with all features).
35#![cfg_attr(
36 not(all(
37 feature = "v1_8",
38 feature = "v1_12",
39 feature = "v1_16_5",
40 feature = "v26_1",
41 feature = "v26_2"
42 )),
43 allow(rustdoc::broken_intra_doc_links)
44)]
45
46#[cfg(any(feature = "v1_8", feature = "v1_12", feature = "v1_16_5"))]
47mod attack;
48pub mod common;
49mod generated;
50#[cfg_attr(
51 not(any(feature = "v1_8", feature = "v1_12", feature = "v1_16_5")),
52 allow(unused_macros, unused_imports)
53)]
54mod macros;
55#[cfg(any(feature = "v1_8", feature = "v1_12", feature = "v1_16_5"))]
56mod place;
57
58#[cfg(any(feature = "v26_1", feature = "v26_2", feature = "v26_3"))]
59pub mod modern;
60#[cfg(feature = "v1_12")]
61pub mod v1_12;
62#[cfg(feature = "v1_16_5")]
63pub mod v1_16_5;
64#[cfg(feature = "v1_8")]
65pub mod v1_8;
66#[cfg(feature = "v26_1")]
67pub mod v26_1;
68#[cfg(feature = "v26_2")]
69pub mod v26_2;
70#[cfg(feature = "v26_3")]
71pub mod v26_3;
72
73#[cfg(any(feature = "v1_8", feature = "v1_12", feature = "v1_16_5"))]
74pub use attack::ItemAttack;
75pub use common::{
76 Aabb, BiomeInfo, BlockInfo, BlockPhysics, BoundingBox, BreakTime, Collision, DigMaterial, Drop,
77 EffectInfo, EnchantCost, EnchantmentInfo, EntityDimensions, EntityInfo, EntityKind, Fluid,
78 FluidKind, FoodInfo, ItemInfo, NeighbourShape, PhysicsFlags, SelectionShape, ShapeDependency,
79 VanillaEntitySize, WorldCoord, WorldCoords, break_time,
80};