1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! Chunk storage for the ghast Minecraft Java Edition client library.
//!
//! One world type per protocol version ([`v1_8::World`], [`v1_16_5::World`]) decodes the
//! version's chunk and block-change packets into a version-independent [`ColumnMap`] of
//! [`Column`]s made of compact [`Section`]s.
//!
//! - **Loaded vs unloaded is explicit.** [`v1_8::World::block_state`] returns `None` for a
//! column the server has not sent (or has unloaded); it never reports air there. Behaviour code
//! must treat `None` as "unknown". Only the `ghast_physics::BlockView` implementation (feature
//! `physics`) maps unloaded columns to air, because that is exactly what the vanilla client's
//! empty chunk does and what the physics must reproduce.
//! - **Vanilla decoding.** States are stored as vanilla reads them: unknown 1.8 `id << 4 | meta`
//! values and unregistered metas, unknown 1.16.5 palette ids and out-of-range palette indices
//! all read as air. Packet handling follows the vanilla client (ground-up chunks replace the
//! column, partial chunks for unloaded columns are ignored, block changes in unloaded columns
//! are ignored, respawn into the same dimension keeps the world, ...). See each method.
//! - **Cheap lookups.** A block lookup is one hash of the column position plus one or two array
//! reads; all-air sections are not stored.
//! - **Never panics on server data.** Malformed chunk data returns a [`WorldError`]. A 1.8 chunk
//! shorter than its mask is applied as far as the vanilla client gets before its copy fails
//! (a ground-up chunk still loads its column, as vanilla does); a malformed 1.16 section
//! unloads the column.
//!
//! ```
//! # #[cfg(feature = "v1_8")] {
//! use ghast_world::{WorldConfig, v1_8::World};
//! let mut world = World::new(WorldConfig::default());
//! assert_eq!(world.block_state(0, 64, 0), None); // nothing loaded yet: unknown, not air
//! # }
//! ```
pub use Border;
pub use ;
pub use WorldError;
pub use ;
/// What a world keeps besides block states.
/// What applying a packet did.