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
//! A library for interfacing with Minecraft world information
//!
//! `worldstat` provides a simple interface for getting information about a Minecraft world.
//! It supports both singleplayer and multiplayer worlds, so you can view and modify data for
//! other players.
//!
//! # Usage
//!
//! While some parts do not require providing a [Context](context::Context), most do, as they pertain to physical world data.
//! [Context](context::Context) is used to tell other parts of the library where to look for data. You can also specify
//! whether you want to read multiplayer or singleplayer data.
//!
//! Many structs may *seem* to be missing fields, but they are actually just fields that are not explicitly deserialized. If you know your data
//! should have a certain field, you can still access it by using `<Struct>.get("your_field")`. This is useful for accessing custom data that is not
//! covered, or may even be custom (e.g. through mods).
//!
//! # Examples
//!
//! Get a players UUID and skin URLs from their username:
//!
//! ```
//! use worldstat::player::Player;
//!
//! let player = Player::new()
//! .with_name("SpikeHD");
//! let uuid = player.uuid()?;
//! let skin_urls = player.skin_urls()?;
//!
//! println!("Player UUID: {}", uuid);
//! println!("Player skin URLs: {:?}", skin_urls);
//! ```
//!
//! See how many oak planks a user has broken:
//!
//! ```
//! use worldstat::{context::Context, player::Player};
//!
//! let ctx = Context::new()
//! .with_is_singleplayer(false)
//! .with_path("./myworld");
//! let stats = Player::new()
//! .with_name("SpikeHD")
//! .with_ctx(ctx)
//! .statistics()?;
//!
//! let crafted = stats.crafted("minecraft:oak_planks")?;
//! let count = crafted.as_i64()?;
//!
//! println!("SpikeHD has crafted {} oak planks", count);
//! ```