azalea_inventory/
components.rs

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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
use core::f64;
use std::{any::Any, collections::HashMap, io::Cursor};

use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable};
use azalea_chat::FormattedText;
use azalea_core::{position::GlobalPos, resource_location::ResourceLocation};
use azalea_registry::{
    Attribute, Block, ConsumeEffectKind, DataComponentKind, Enchantment, EntityKind, HolderSet,
    Item, MobEffect, Potion, SoundEvent, TrimMaterial, TrimPattern,
};
use simdnbt::owned::{Nbt, NbtCompound};
use uuid::Uuid;

use crate::ItemSlot;

pub trait DataComponent: Send + Sync + Any {}

pub trait EncodableDataComponent: Send + Sync + Any {
    fn encode(&self, buf: &mut Vec<u8>) -> Result<(), std::io::Error>;
    // using the Clone trait makes it not be object-safe, so we have our own clone
    // function instead
    fn clone(&self) -> Box<dyn EncodableDataComponent>;
    // same deal here
    fn eq(&self, other: Box<dyn EncodableDataComponent>) -> bool;
}

impl<T> EncodableDataComponent for T
where
    T: DataComponent + Clone + McBufWritable + McBufReadable + PartialEq,
{
    fn encode(&self, buf: &mut Vec<u8>) -> Result<(), std::io::Error> {
        self.write_into(buf)
    }
    fn clone(&self) -> Box<dyn EncodableDataComponent> {
        let cloned = self.clone();
        Box::new(cloned)
    }
    fn eq(&self, other: Box<dyn EncodableDataComponent>) -> bool {
        let other_any: Box<dyn Any> = other;
        if let Some(other) = other_any.downcast_ref::<T>() {
            self == other
        } else {
            false
        }
    }
}

pub fn from_kind(
    kind: azalea_registry::DataComponentKind,
    buf: &mut Cursor<&[u8]>,
) -> Result<Box<dyn EncodableDataComponent>, BufReadError> {
    // if this is causing a compile-time error, look at DataComponents.java in the
    // decompiled vanilla code to see how to implement new components

    // note that this match statement is updated by genitemcomponents.py
    Ok(match kind {
        DataComponentKind::CustomData => Box::new(CustomData::read_from(buf)?),
        DataComponentKind::MaxStackSize => Box::new(MaxStackSize::read_from(buf)?),
        DataComponentKind::MaxDamage => Box::new(MaxDamage::read_from(buf)?),
        DataComponentKind::Damage => Box::new(Damage::read_from(buf)?),
        DataComponentKind::Unbreakable => Box::new(Unbreakable::read_from(buf)?),
        DataComponentKind::CustomName => Box::new(CustomName::read_from(buf)?),
        DataComponentKind::ItemName => Box::new(ItemName::read_from(buf)?),
        DataComponentKind::Lore => Box::new(Lore::read_from(buf)?),
        DataComponentKind::Rarity => Box::new(Rarity::read_from(buf)?),
        DataComponentKind::Enchantments => Box::new(Enchantments::read_from(buf)?),
        DataComponentKind::CanPlaceOn => Box::new(CanPlaceOn::read_from(buf)?),
        DataComponentKind::CanBreak => Box::new(CanBreak::read_from(buf)?),
        DataComponentKind::AttributeModifiers => Box::new(AttributeModifiers::read_from(buf)?),
        DataComponentKind::CustomModelData => Box::new(CustomModelData::read_from(buf)?),
        DataComponentKind::HideAdditionalTooltip => {
            Box::new(HideAdditionalTooltip::read_from(buf)?)
        }
        DataComponentKind::HideTooltip => Box::new(HideTooltip::read_from(buf)?),
        DataComponentKind::RepairCost => Box::new(RepairCost::read_from(buf)?),
        DataComponentKind::CreativeSlotLock => Box::new(CreativeSlotLock::read_from(buf)?),
        DataComponentKind::EnchantmentGlintOverride => {
            Box::new(EnchantmentGlintOverride::read_from(buf)?)
        }
        DataComponentKind::IntangibleProjectile => Box::new(IntangibleProjectile::read_from(buf)?),
        DataComponentKind::Food => Box::new(Food::read_from(buf)?),
        DataComponentKind::Tool => Box::new(Tool::read_from(buf)?),
        DataComponentKind::StoredEnchantments => Box::new(StoredEnchantments::read_from(buf)?),
        DataComponentKind::DyedColor => Box::new(DyedColor::read_from(buf)?),
        DataComponentKind::MapColor => Box::new(MapColor::read_from(buf)?),
        DataComponentKind::MapId => Box::new(MapId::read_from(buf)?),
        DataComponentKind::MapDecorations => Box::new(MapDecorations::read_from(buf)?),
        DataComponentKind::MapPostProcessing => Box::new(MapPostProcessing::read_from(buf)?),
        DataComponentKind::ChargedProjectiles => Box::new(ChargedProjectiles::read_from(buf)?),
        DataComponentKind::BundleContents => Box::new(BundleContents::read_from(buf)?),
        DataComponentKind::PotionContents => Box::new(PotionContents::read_from(buf)?),
        DataComponentKind::SuspiciousStewEffects => {
            Box::new(SuspiciousStewEffects::read_from(buf)?)
        }
        DataComponentKind::WritableBookContent => Box::new(WritableBookContent::read_from(buf)?),
        DataComponentKind::WrittenBookContent => Box::new(WrittenBookContent::read_from(buf)?),
        DataComponentKind::Trim => Box::new(Trim::read_from(buf)?),
        DataComponentKind::DebugStickState => Box::new(DebugStickState::read_from(buf)?),
        DataComponentKind::EntityData => Box::new(EntityData::read_from(buf)?),
        DataComponentKind::BucketEntityData => Box::new(BucketEntityData::read_from(buf)?),
        DataComponentKind::BlockEntityData => Box::new(BlockEntityData::read_from(buf)?),
        DataComponentKind::Instrument => Box::new(Instrument::read_from(buf)?),
        DataComponentKind::OminousBottleAmplifier => {
            Box::new(OminousBottleAmplifier::read_from(buf)?)
        }
        DataComponentKind::Recipes => Box::new(Recipes::read_from(buf)?),
        DataComponentKind::LodestoneTracker => Box::new(LodestoneTracker::read_from(buf)?),
        DataComponentKind::FireworkExplosion => Box::new(FireworkExplosion::read_from(buf)?),
        DataComponentKind::Fireworks => Box::new(Fireworks::read_from(buf)?),
        DataComponentKind::Profile => Box::new(Profile::read_from(buf)?),
        DataComponentKind::NoteBlockSound => Box::new(NoteBlockSound::read_from(buf)?),
        DataComponentKind::BannerPatterns => Box::new(BannerPatterns::read_from(buf)?),
        DataComponentKind::BaseColor => Box::new(BaseColor::read_from(buf)?),
        DataComponentKind::PotDecorations => Box::new(PotDecorations::read_from(buf)?),
        DataComponentKind::Container => Box::new(Container::read_from(buf)?),
        DataComponentKind::BlockState => Box::new(BlockState::read_from(buf)?),
        DataComponentKind::Bees => Box::new(Bees::read_from(buf)?),
        DataComponentKind::Lock => Box::new(Lock::read_from(buf)?),
        DataComponentKind::ContainerLoot => Box::new(ContainerLoot::read_from(buf)?),
        DataComponentKind::JukeboxPlayable => Box::new(JukeboxPlayable::read_from(buf)?),
        DataComponentKind::Consumable => Box::new(Consumable::read_from(buf)?),
        DataComponentKind::UseRemainder => Box::new(UseRemainder::read_from(buf)?),
        DataComponentKind::UseCooldown => Box::new(UseCooldown::read_from(buf)?),
        DataComponentKind::Enchantable => Box::new(Enchantable::read_from(buf)?),
        DataComponentKind::Repairable => Box::new(Repairable::read_from(buf)?),
        DataComponentKind::ItemModel => Box::new(ItemModel::read_from(buf)?),
        DataComponentKind::DamageResistant => Box::new(DamageResistant::read_from(buf)?),
        DataComponentKind::Equippable => Box::new(Equippable::read_from(buf)?),
        DataComponentKind::Glider => Box::new(Glider::read_from(buf)?),
        DataComponentKind::TooltipStyle => Box::new(TooltipStyle::read_from(buf)?),
        DataComponentKind::DeathProtection => Box::new(DeathProtection::read_from(buf)?),
    })
}

#[derive(Clone, PartialEq, McBuf)]
pub struct CustomData {
    pub nbt: Nbt,
}
impl DataComponent for CustomData {}

#[derive(Clone, PartialEq, McBuf)]
pub struct MaxStackSize {
    #[var]
    pub count: i32,
}
impl DataComponent for MaxStackSize {}

#[derive(Clone, PartialEq, McBuf)]
pub struct MaxDamage {
    #[var]
    pub amount: i32,
}
impl DataComponent for MaxDamage {}

#[derive(Clone, PartialEq, McBuf)]
pub struct Damage {
    #[var]
    pub amount: i32,
}

impl DataComponent for Damage {}

#[derive(Clone, PartialEq, McBuf)]
pub struct Unbreakable {
    pub show_in_tooltip: bool,
}
impl DataComponent for Unbreakable {}
impl Default for Unbreakable {
    fn default() -> Self {
        Self {
            show_in_tooltip: true,
        }
    }
}

#[derive(Clone, PartialEq, McBuf)]
pub struct CustomName {
    pub name: FormattedText,
}
impl DataComponent for CustomName {}

#[derive(Clone, PartialEq, McBuf)]
pub struct ItemName {
    pub name: FormattedText,
}
impl DataComponent for ItemName {}

#[derive(Clone, PartialEq, McBuf)]
pub struct Lore {
    pub lines: Vec<FormattedText>,
    // vanilla also has styled_lines here but it doesn't appear to be used for the protocol
}
impl DataComponent for Lore {}

#[derive(Clone, PartialEq, Copy, McBuf)]
pub enum Rarity {
    Common,
    Uncommon,
    Rare,
    Epic,
}
impl DataComponent for Rarity {}

#[derive(Clone, PartialEq, McBuf)]
pub struct Enchantments {
    #[var]
    pub levels: HashMap<Enchantment, u32>,
    pub show_in_tooltip: bool,
}
impl DataComponent for Enchantments {}

#[derive(Clone, PartialEq, McBuf)]
pub enum BlockStateValueMatcher {
    Exact {
        value: String,
    },
    Range {
        min: Option<String>,
        max: Option<String>,
    },
}

#[derive(Clone, PartialEq, McBuf)]
pub struct BlockStatePropertyMatcher {
    pub name: String,
    pub value_matcher: BlockStateValueMatcher,
}

#[derive(Clone, PartialEq, McBuf)]
pub struct BlockPredicate {
    pub blocks: Option<HolderSet<Block, ResourceLocation>>,
    pub properties: Option<Vec<BlockStatePropertyMatcher>>,
    pub nbt: Option<NbtCompound>,
}

#[derive(Clone, PartialEq, McBuf)]
pub struct AdventureModePredicate {
    pub predicates: Vec<BlockPredicate>,
    pub show_in_tooltip: bool,
}

#[derive(Clone, PartialEq, McBuf)]
pub struct CanPlaceOn {
    pub predicate: AdventureModePredicate,
}
impl DataComponent for CanPlaceOn {}

#[derive(Clone, PartialEq, McBuf)]
pub struct CanBreak {
    pub predicate: AdventureModePredicate,
}
impl DataComponent for CanBreak {}

#[derive(Clone, Copy, PartialEq, McBuf)]
pub enum EquipmentSlotGroup {
    Any,
    Mainhand,
    Offhand,
    Hand,
    Feet,
    Legs,
    Chest,
    Head,
    Armor,
    Body,
}

#[derive(Clone, Copy, PartialEq, McBuf)]
pub enum AttributeModifierOperation {
    Addition,
    MultiplyBase,
    MultiplyTotal,
}

// this is duplicated in azalea-entity, BUT the one there has a different
// protocol format (and we can't use it anyways because it would cause a
// circular dependency)
#[derive(Clone, PartialEq, McBuf)]
pub struct AttributeModifier {
    pub uuid: Uuid,
    pub name: String,
    pub amount: f64,
    pub operation: AttributeModifierOperation,
}

#[derive(Clone, PartialEq, McBuf)]
pub struct AttributeModifiersEntry {
    pub attribute: Attribute,
    pub modifier: AttributeModifier,
    pub slot: EquipmentSlotGroup,
}

#[derive(Clone, PartialEq, McBuf)]
pub struct AttributeModifiers {
    pub modifiers: Vec<AttributeModifiersEntry>,
    pub show_in_tooltip: bool,
}
impl DataComponent for AttributeModifiers {}

#[derive(Clone, PartialEq, McBuf)]
pub struct CustomModelData {
    #[var]
    pub value: i32,
}
impl DataComponent for CustomModelData {}

#[derive(Clone, PartialEq, McBuf)]
pub struct HideAdditionalTooltip;
impl DataComponent for HideAdditionalTooltip {}

#[derive(Clone, PartialEq, McBuf)]
pub struct HideTooltip;
impl DataComponent for HideTooltip {}

#[derive(Clone, PartialEq, McBuf)]
pub struct RepairCost {
    #[var]
    pub cost: u32,
}
impl DataComponent for RepairCost {}

#[derive(Clone, PartialEq, McBuf)]
pub struct CreativeSlotLock;
impl DataComponent for CreativeSlotLock {}

#[derive(Clone, PartialEq, McBuf)]
pub struct EnchantmentGlintOverride {
    pub show_glint: bool,
}
impl DataComponent for EnchantmentGlintOverride {}

#[derive(Clone, PartialEq, McBuf)]
pub struct IntangibleProjectile;
impl DataComponent for IntangibleProjectile {}

#[derive(Clone, PartialEq, McBuf)]
pub struct MobEffectDetails {
    #[var]
    pub amplifier: i32,
    #[var]
    pub duration: i32,
    pub ambient: bool,
    pub show_particles: bool,
    pub show_icon: bool,
    pub hidden_effect: Option<Box<MobEffectDetails>>,
}

#[derive(Clone, PartialEq, McBuf)]
pub struct MobEffectInstance {
    pub effect: MobEffect,
    pub details: MobEffectDetails,
}

#[derive(Clone, PartialEq, McBuf)]
pub struct PossibleEffect {
    pub effect: MobEffectInstance,
    pub probability: f32,
}

#[derive(Clone, PartialEq, McBuf)]
pub struct Food {
    #[var]
    pub nutrition: i32,
    pub saturation: f32,
    pub can_always_eat: bool,
    pub eat_seconds: f32,
    pub effects: Vec<PossibleEffect>,
}
impl DataComponent for Food {}

#[derive(Clone, PartialEq, McBuf)]
pub struct ToolRule {
    pub blocks: HolderSet<Block, ResourceLocation>,
    pub speed: Option<f32>,
    pub correct_for_drops: Option<bool>,
}

#[derive(Clone, PartialEq, McBuf)]
pub struct Tool {
    pub rules: Vec<ToolRule>,
    pub default_mining_speed: f32,
    #[var]
    pub damage_per_block: i32,
}
impl DataComponent for Tool {}

#[derive(Clone, PartialEq, McBuf)]
pub struct StoredEnchantments {
    #[var]
    pub enchantments: HashMap<Enchantment, i32>,
    pub show_in_tooltip: bool,
}
impl DataComponent for StoredEnchantments {}

#[derive(Clone, PartialEq, McBuf)]
pub struct DyedColor {
    pub rgb: i32,
    pub show_in_tooltip: bool,
}
impl DataComponent for DyedColor {}

#[derive(Clone, PartialEq, McBuf)]
pub struct MapColor {
    pub color: i32,
}
impl DataComponent for MapColor {}

#[derive(Clone, PartialEq, McBuf)]
pub struct MapId {
    #[var]
    pub id: i32,
}
impl DataComponent for MapId {}

#[derive(Clone, PartialEq, McBuf)]
pub struct MapDecorations {
    pub decorations: NbtCompound,
}
impl DataComponent for MapDecorations {}

#[derive(Clone, Copy, PartialEq, McBuf)]
pub enum MapPostProcessing {
    Lock,
    Scale,
}
impl DataComponent for MapPostProcessing {}

#[derive(Clone, PartialEq, McBuf)]
pub struct ChargedProjectiles {
    pub items: Vec<ItemSlot>,
}
impl DataComponent for ChargedProjectiles {}

#[derive(Clone, PartialEq, McBuf)]
pub struct BundleContents {
    pub items: Vec<ItemSlot>,
}
impl DataComponent for BundleContents {}

#[derive(Clone, PartialEq, McBuf)]
pub struct PotionContents {
    pub potion: Option<Potion>,
    pub custom_color: Option<i32>,
    pub custom_effects: Vec<MobEffectInstance>,
}
impl DataComponent for PotionContents {}

#[derive(Clone, PartialEq, McBuf)]
pub struct SuspiciousStewEffect {
    pub effect: MobEffect,
    #[var]
    pub duration: i32,
}

#[derive(Clone, PartialEq, McBuf)]
pub struct SuspiciousStewEffects {
    pub effects: Vec<SuspiciousStewEffect>,
}
impl DataComponent for SuspiciousStewEffects {}

#[derive(Clone, PartialEq, McBuf)]
pub struct WritableBookContent {
    pub pages: Vec<String>,
}
impl DataComponent for WritableBookContent {}

#[derive(Clone, PartialEq, McBuf)]
pub struct WrittenBookContent {
    pub title: String,
    pub author: String,
    #[var]
    pub generation: i32,
    pub pages: Vec<FormattedText>,
    pub resolved: bool,
}
impl DataComponent for WrittenBookContent {}

#[derive(Clone, PartialEq, McBuf)]
pub struct Trim {
    pub material: TrimMaterial,
    pub pattern: TrimPattern,
    pub show_in_tooltip: bool,
}
impl DataComponent for Trim {}

#[derive(Clone, PartialEq, McBuf)]
pub struct DebugStickState {
    pub properties: NbtCompound,
}
impl DataComponent for DebugStickState {}

#[derive(Clone, PartialEq, McBuf)]
pub struct EntityData {
    pub entity: NbtCompound,
}
impl DataComponent for EntityData {}

#[derive(Clone, PartialEq, McBuf)]
pub struct BucketEntityData {
    pub entity: NbtCompound,
}
impl DataComponent for BucketEntityData {}

#[derive(Clone, PartialEq, McBuf)]
pub struct BlockEntityData {
    pub entity: NbtCompound,
}
impl DataComponent for BlockEntityData {}

#[derive(Clone, PartialEq, McBuf)]
pub struct Instrument {
    pub instrument: azalea_registry::Instrument,
}
impl DataComponent for Instrument {}

#[derive(Clone, PartialEq, McBuf)]
pub struct OminousBottleAmplifier {
    #[var]
    pub amplifier: i32,
}
impl DataComponent for OminousBottleAmplifier {}

#[derive(Clone, PartialEq, McBuf)]
pub struct Recipes {
    pub recipes: Vec<ResourceLocation>,
}
impl DataComponent for Recipes {}

#[derive(Clone, PartialEq, McBuf)]
pub struct LodestoneTracker {
    pub target: Option<GlobalPos>,
    pub tracked: bool,
}
impl DataComponent for LodestoneTracker {}

#[derive(Clone, Copy, PartialEq, McBuf)]
pub enum FireworkExplosionShape {
    SmallBall,
    LargeBall,
    Star,
    Creeper,
    Burst,
}

#[derive(Clone, PartialEq, McBuf)]
pub struct FireworkExplosion {
    pub shape: FireworkExplosionShape,
    pub colors: Vec<i32>,
    pub fade_colors: Vec<i32>,
    pub has_trail: bool,
    pub has_twinkle: bool,
}
impl DataComponent for FireworkExplosion {}

#[derive(Clone, PartialEq, McBuf)]
pub struct Fireworks {
    #[var]
    pub flight_duration: i32,
    pub explosions: Vec<FireworkExplosion>,
}
impl DataComponent for Fireworks {}

#[derive(Clone, PartialEq, McBuf)]
pub struct GameProfileProperty {
    pub name: String,
    pub value: String,
    pub signature: Option<String>,
}

#[derive(Clone, PartialEq, McBuf)]
pub struct Profile {
    pub name: String,
    pub id: Option<Uuid>,
    pub properties: Vec<GameProfileProperty>,
}
impl DataComponent for Profile {}

#[derive(Clone, PartialEq, McBuf)]
pub struct NoteBlockSound {
    pub sound: ResourceLocation,
}
impl DataComponent for NoteBlockSound {}

#[derive(Clone, PartialEq, McBuf)]
pub struct BannerPattern {
    #[var]
    pub pattern: i32,
    #[var]
    pub color: i32,
}

#[derive(Clone, PartialEq, McBuf)]
pub struct BannerPatterns {
    pub patterns: Vec<BannerPattern>,
}
impl DataComponent for BannerPatterns {}

#[derive(Clone, Copy, PartialEq, McBuf)]
pub enum DyeColor {
    White,
    Orange,
    Magenta,
    LightBlue,
    Yellow,
    Lime,
    Pink,
    Gray,
    LightGray,
    Cyan,
    Purple,
    Blue,
    Brown,
    Green,
    Red,
    Black,
}

#[derive(Clone, PartialEq, McBuf)]
pub struct BaseColor {
    pub color: DyeColor,
}
impl DataComponent for BaseColor {}

#[derive(Clone, PartialEq, McBuf)]
pub struct PotDecorations {
    pub items: Vec<Item>,
}
impl DataComponent for PotDecorations {}

#[derive(Clone, PartialEq, McBuf)]
pub struct Container {
    pub items: Vec<ItemSlot>,
}
impl DataComponent for Container {}

#[derive(Clone, PartialEq, McBuf)]
pub struct BlockState {
    pub properties: HashMap<String, String>,
}
impl DataComponent for BlockState {}

#[derive(Clone, PartialEq, McBuf)]
pub struct BeehiveOccupant {
    pub entity_data: NbtCompound,
    #[var]
    pub ticks_in_hive: i32,
    #[var]
    pub min_ticks_in_hive: i32,
}

#[derive(Clone, PartialEq, McBuf)]
pub struct Bees {
    pub occupants: Vec<BeehiveOccupant>,
}
impl DataComponent for Bees {}

#[derive(Clone, PartialEq, McBuf)]
pub struct Lock {
    pub key: String,
}
impl DataComponent for Lock {}

#[derive(Clone, PartialEq, McBuf)]
pub struct ContainerLoot {
    pub loot: NbtCompound,
}
impl DataComponent for ContainerLoot {}

#[derive(Clone, PartialEq, McBuf)]
pub struct JukeboxPlayable {
    pub song: azalea_registry::JukeboxSong,
    pub show_in_tooltip: bool,
}
impl DataComponent for JukeboxPlayable {}

#[derive(Clone, PartialEq, McBuf)]
pub struct Consumable {
    pub consume_seconds: f32,
    pub animation: ItemUseAnimation,
    pub sound: SoundEvent,
    pub has_consume_particles: bool,
    pub on_consuime_effects: Vec<ConsumeEffectKind>,
}
impl DataComponent for Consumable {}

#[derive(Clone, Copy, PartialEq, McBuf)]
pub enum ItemUseAnimation {
    None,
    Eat,
    Drink,
    Block,
    Bow,
    Spear,
    Crossbow,
    Spyglass,
    TootHorn,
    Brush,
}

#[derive(Clone, PartialEq, McBuf)]
pub struct UseRemainder {
    pub convert_into: ItemSlot,
}
impl DataComponent for UseRemainder {}

#[derive(Clone, PartialEq, McBuf)]
pub struct UseCooldown {
    pub seconds: f32,
    pub cooldown_group: Option<ResourceLocation>,
}
impl DataComponent for UseCooldown {}

#[derive(Clone, PartialEq, McBuf)]
pub struct Enchantable {
    #[var]
    pub value: u32,
}
impl DataComponent for Enchantable {}

#[derive(Clone, PartialEq, McBuf)]
pub struct Repairable {
    pub items: HolderSet<Item, ResourceLocation>,
}
impl DataComponent for Repairable {}

#[derive(Clone, PartialEq, McBuf)]
pub struct ItemModel {
    pub resource_location: ResourceLocation,
}
impl DataComponent for ItemModel {}

#[derive(Clone, PartialEq, McBuf)]
pub struct DamageResistant {
    // in the vanilla code this is
    // ```
    // StreamCodec.composite(
    //   TagKey.streamCodec(Registries.DAMAGE_TYPE), DamageResistant::types, DamageResistant::new
    // );
    // ```
    // i'm not entirely sure if this is meant to be a vec or something, i just made it a
    // resourcelocation for now
    pub types: ResourceLocation,
}
impl DataComponent for DamageResistant {}

#[derive(Clone, PartialEq, McBuf)]
pub struct Equippable {
    pub slot: EquipmentSlot,
    pub equip_sound: SoundEvent,
    pub model: Option<ResourceLocation>,
    pub allowed_entities: HolderSet<EntityKind, ResourceLocation>,
}
impl DataComponent for Equippable {}

#[derive(Clone, Copy, Debug, PartialEq, McBuf)]
pub enum EquipmentSlot {
    Mainhand,
    Offhand,
    Hand,
    Feet,
    Legs,
    Chest,
    Head,
    Armor,
    Body,
}

#[derive(Clone, PartialEq, McBuf)]
pub struct Glider;
impl DataComponent for Glider {}

#[derive(Clone, PartialEq, McBuf)]
pub struct TooltipStyle {
    pub resource_location: ResourceLocation,
}
impl DataComponent for TooltipStyle {}

#[derive(Clone, PartialEq, McBuf)]
pub struct DeathProtection {
    pub death_effects: Vec<ConsumeEffectKind>,
}
impl DataComponent for DeathProtection {}