Skip to main content

azalea_registry/registry_holder/
dimension_type.rs

1use std::collections::HashMap;
2
3use azalea_buf::AzBuf;
4use azalea_codec::Codec;
5use azalea_core::identifier::Identifier;
6use indexmap::IndexMap;
7use simdnbt::owned::NbtTag;
8
9use crate::{
10    HolderSet,
11    builtin::{BlockKind, EnvironmentAttribute, SoundEvent},
12};
13
14#[derive(Clone, Debug, Codec)]
15pub struct TrimMaterialElement {
16    pub asset_name: String,
17    pub ingredient: Identifier,
18    pub item_model_index: f32,
19    pub override_armor_materials: HashMap<String, String>,
20    pub description: Option<String>,
21}
22
23/// Data about a kind of chat message
24#[derive(Clone, Debug, Codec)]
25pub struct ChatTypeElement {
26    pub chat: ChatTypeData,
27    pub narration: ChatTypeData,
28}
29
30/// Data about a chat message.
31#[derive(Clone, Debug, Codec)]
32pub struct ChatTypeData {
33    pub translation_key: String,
34    pub parameters: Vec<String>,
35    pub style: Option<ChatTypeStyle>,
36}
37
38/// The style of a chat message.
39#[derive(Clone, Debug, Codec)]
40pub struct ChatTypeStyle {
41    pub color: Option<String>,
42    pub bold: Option<bool>,
43    pub italic: Option<bool>,
44    pub underlined: Option<bool>,
45    pub strikethrough: Option<bool>,
46    pub obfuscated: Option<bool>,
47}
48
49/// Dimension attributes.
50#[derive(Clone, Debug, Codec, Default)]
51pub struct DimensionKindElement {
52    #[codec(optional)]
53    pub has_fixed_time: bool,
54    pub has_skylight: bool,
55    pub has_ceiling: bool,
56    pub has_ender_dragon_fight: bool,
57    pub coordinate_scale: f32,
58    pub min_y: i32,
59    pub height: u32,
60    pub logical_height: u32,
61    pub infiniburn: HolderSet<BlockKind>,
62    pub ambient_light: f32,
63    #[codec(flatten)]
64    pub monster_settings: MonsterSettings,
65    #[codec(optional)]
66    pub skybox: Option<String>,
67    #[codec(optional)]
68    pub cardinal_light: Option<CardinalLighting>,
69    #[codec(optional)]
70    pub attributes: EnvironmentAttributeMap,
71    #[codec(optional)]
72    pub timelines: Option<HolderSet<crate::data::Timeline>>,
73    #[codec(optional)]
74    pub default_clock: Option<crate::data::WorldClock>,
75
76    #[codec(flatten)]
77    pub _extra: HashMap<String, NbtTag>,
78}
79
80#[derive(Clone, Debug, Codec)]
81#[codec(default_snake_case_key)]
82pub enum CardinalLighting {
83    Default,
84    Nether,
85}
86#[derive(Clone, Debug, Codec, Default)]
87#[codec(transparent)]
88pub struct EnvironmentAttributeMap {
89    pub values: IndexMap<EnvironmentAttribute, EnvironmentAttributeEntry>,
90}
91azalea_codec::impl_defaultable!(EnvironmentAttributeMap, self, self.values.is_empty());
92
93/// Unimplemented.
94#[derive(Clone, Debug, Codec)]
95#[codec(transparent)]
96pub struct EnvironmentAttributeEntry(azalea_codec::types::Drain);
97
98#[derive(Clone, Debug, Codec, Default)]
99pub struct MonsterSettings {
100    pub monster_spawn_light_level: IntProvider,
101    pub monster_spawn_block_light_limit: u8,
102}
103
104/// Unimplemented.
105#[derive(Clone, Debug, Codec, Default)]
106#[codec(transparent)]
107pub struct IntProvider(azalea_codec::types::Drain);
108
109/// Biome attributes.
110#[derive(Clone, Debug, Codec)]
111pub struct WorldTypeElement {
112    pub has_precipitation: bool,
113    pub temperature: f32,
114    pub temperature_modifier: Option<String>,
115    pub downfall: f32,
116    pub effects: BiomeEffects,
117}
118
119/// The effects of a biome.
120///
121/// This includes the sky, fog, water, and grass color,
122/// as well as music and other sound effects.
123#[derive(Clone, Debug, Codec)]
124pub struct BiomeEffects {
125    pub sky_color: u32,
126    pub fog_color: u32,
127    pub water_color: u32,
128    pub water_fog_color: u32,
129    pub foliage_color: Option<u32>,
130    pub grass_color: Option<u32>,
131    pub grass_color_modifier: Option<String>,
132    pub music: Option<BiomeMusic>,
133    pub mood_sound: BiomeMoodSound,
134    pub additions_sound: Option<AdditionsSound>,
135    pub ambient_sound: Option<Identifier>,
136    pub particle: Option<BiomeParticle>,
137}
138
139/// The music of the biome.
140///
141/// Some biomes have unique music that only play when inside them.
142#[derive(Clone, Debug, Codec)]
143pub struct BiomeMusic {
144    pub replace_current_music: bool,
145    pub max_delay: u32,
146    pub min_delay: u32,
147    pub sound: SoundEvent,
148}
149
150#[derive(Clone, Debug, Codec)]
151pub struct BiomeMoodSound {
152    pub tick_delay: u32,
153    pub block_search_extent: u32,
154    pub offset: f32,
155    pub sound: SoundEvent,
156}
157
158#[derive(Clone, Debug, Codec)]
159pub struct AdditionsSound {
160    pub tick_chance: f32,
161    pub sound: SoundEvent,
162}
163
164/// Biome particles.
165///
166/// Some biomes have particles that spawn in the air.
167#[derive(Clone, Debug, Codec)]
168pub struct BiomeParticle {
169    pub probability: f32,
170    pub options: HashMap<String, String>,
171}
172
173#[derive(Clone, Debug, Codec)]
174pub struct TrimPatternElement {
175    #[codec(flatten)]
176    pub pattern: HashMap<String, String>,
177}
178
179#[derive(Debug, Clone, AzBuf, PartialEq, Codec)]
180pub struct DamageTypeElement {
181    pub message_id: String,
182    pub scaling: String,
183    pub exhaustion: f32,
184    #[codec(optional)]
185    pub effects: Option<String>,
186    #[codec(optional)]
187    pub death_message_type: Option<String>,
188}