diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2024-11-27 19:31:40 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-27 19:31:40 -0600 |
| commit | 08958c2278b15ebeac8a964f392ebb792e479b61 (patch) | |
| tree | 4ae3664cea38d7fd1a8f1e95ed06fac04ffe519e /azalea-inventory/src/components.rs | |
| parent | 139d77d3c2b0922fba5e9d4fa2bd9819d78bd773 (diff) | |
| download | azalea-drasl-08958c2278b15ebeac8a964f392ebb792e479b61.tar.xz | |
Refactor azalea-protocol (#190)
* start updating to 1.21.4
* fix block codegen and stop using block data from burger
* rename packet related modules and structs to be simpler
* ItemSlot -> ItemStack for more consistency with mojmap
* .get() -> .into_packet()
* simplify declare_state_packets by removing packet ids
* rename read_from and write_into to azalea_read and azalea_write
* rename McBufReadable and McBufWritable to AzaleaRead and AzaleaWrite
* McBuf -> AzBuf
* remove most uses of into_variant
* update codegen and use resourcelocation names for packets
* implement #[limit(i)] attribute for AzBuf derive macro
* fixes for 1.21.4
* fix examples
* update some physics code and fix ChatType
* remove unused imports in codegen
* re-add some things to migrate.py and update +mc version numbers automatically
* downgrade to 1.21.3 lol
Diffstat (limited to 'azalea-inventory/src/components.rs')
| -rw-r--r-- | azalea-inventory/src/components.rs | 326 |
1 files changed, 164 insertions, 162 deletions
diff --git a/azalea-inventory/src/components.rs b/azalea-inventory/src/components.rs index d7adf2c9..10b00b36 100644 --- a/azalea-inventory/src/components.rs +++ b/azalea-inventory/src/components.rs @@ -1,7 +1,7 @@ use core::f64; use std::{any::Any, collections::HashMap, io::Cursor}; -use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable}; +use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError}; use azalea_chat::FormattedText; use azalea_core::{position::GlobalPos, resource_location::ResourceLocation}; use azalea_registry::{ @@ -11,7 +11,7 @@ use azalea_registry::{ use simdnbt::owned::{Nbt, NbtCompound}; use uuid::Uuid; -use crate::ItemSlot; +use crate::ItemStack; pub trait DataComponent: Send + Sync + Any {} @@ -26,10 +26,10 @@ pub trait EncodableDataComponent: Send + Sync + Any { impl<T> EncodableDataComponent for T where - T: DataComponent + Clone + McBufWritable + McBufReadable + PartialEq, + T: DataComponent + Clone + AzaleaWrite + AzaleaRead + PartialEq, { fn encode(&self, buf: &mut Vec<u8>) -> Result<(), std::io::Error> { - self.write_into(buf) + self.azalea_write(buf) } fn clone(&self) -> Box<dyn EncodableDataComponent> { let cloned = self.clone(); @@ -54,105 +54,107 @@ pub fn from_kind( // 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::CustomData => Box::new(CustomData::azalea_read(buf)?), + DataComponentKind::MaxStackSize => Box::new(MaxStackSize::azalea_read(buf)?), + DataComponentKind::MaxDamage => Box::new(MaxDamage::azalea_read(buf)?), + DataComponentKind::Damage => Box::new(Damage::azalea_read(buf)?), + DataComponentKind::Unbreakable => Box::new(Unbreakable::azalea_read(buf)?), + DataComponentKind::CustomName => Box::new(CustomName::azalea_read(buf)?), + DataComponentKind::ItemName => Box::new(ItemName::azalea_read(buf)?), + DataComponentKind::Lore => Box::new(Lore::azalea_read(buf)?), + DataComponentKind::Rarity => Box::new(Rarity::azalea_read(buf)?), + DataComponentKind::Enchantments => Box::new(Enchantments::azalea_read(buf)?), + DataComponentKind::CanPlaceOn => Box::new(CanPlaceOn::azalea_read(buf)?), + DataComponentKind::CanBreak => Box::new(CanBreak::azalea_read(buf)?), + DataComponentKind::AttributeModifiers => Box::new(AttributeModifiers::azalea_read(buf)?), + DataComponentKind::CustomModelData => Box::new(CustomModelData::azalea_read(buf)?), DataComponentKind::HideAdditionalTooltip => { - Box::new(HideAdditionalTooltip::read_from(buf)?) + Box::new(HideAdditionalTooltip::azalea_read(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::HideTooltip => Box::new(HideTooltip::azalea_read(buf)?), + DataComponentKind::RepairCost => Box::new(RepairCost::azalea_read(buf)?), + DataComponentKind::CreativeSlotLock => Box::new(CreativeSlotLock::azalea_read(buf)?), DataComponentKind::EnchantmentGlintOverride => { - Box::new(EnchantmentGlintOverride::read_from(buf)?) + Box::new(EnchantmentGlintOverride::azalea_read(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::IntangibleProjectile => { + Box::new(IntangibleProjectile::azalea_read(buf)?) + } + DataComponentKind::Food => Box::new(Food::azalea_read(buf)?), + DataComponentKind::Tool => Box::new(Tool::azalea_read(buf)?), + DataComponentKind::StoredEnchantments => Box::new(StoredEnchantments::azalea_read(buf)?), + DataComponentKind::DyedColor => Box::new(DyedColor::azalea_read(buf)?), + DataComponentKind::MapColor => Box::new(MapColor::azalea_read(buf)?), + DataComponentKind::MapId => Box::new(MapId::azalea_read(buf)?), + DataComponentKind::MapDecorations => Box::new(MapDecorations::azalea_read(buf)?), + DataComponentKind::MapPostProcessing => Box::new(MapPostProcessing::azalea_read(buf)?), + DataComponentKind::ChargedProjectiles => Box::new(ChargedProjectiles::azalea_read(buf)?), + DataComponentKind::BundleContents => Box::new(BundleContents::azalea_read(buf)?), + DataComponentKind::PotionContents => Box::new(PotionContents::azalea_read(buf)?), DataComponentKind::SuspiciousStewEffects => { - Box::new(SuspiciousStewEffects::read_from(buf)?) + Box::new(SuspiciousStewEffects::azalea_read(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::WritableBookContent => Box::new(WritableBookContent::azalea_read(buf)?), + DataComponentKind::WrittenBookContent => Box::new(WrittenBookContent::azalea_read(buf)?), + DataComponentKind::Trim => Box::new(Trim::azalea_read(buf)?), + DataComponentKind::DebugStickState => Box::new(DebugStickState::azalea_read(buf)?), + DataComponentKind::EntityData => Box::new(EntityData::azalea_read(buf)?), + DataComponentKind::BucketEntityData => Box::new(BucketEntityData::azalea_read(buf)?), + DataComponentKind::BlockEntityData => Box::new(BlockEntityData::azalea_read(buf)?), + DataComponentKind::Instrument => Box::new(Instrument::azalea_read(buf)?), DataComponentKind::OminousBottleAmplifier => { - Box::new(OminousBottleAmplifier::read_from(buf)?) + Box::new(OminousBottleAmplifier::azalea_read(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)?), + DataComponentKind::Recipes => Box::new(Recipes::azalea_read(buf)?), + DataComponentKind::LodestoneTracker => Box::new(LodestoneTracker::azalea_read(buf)?), + DataComponentKind::FireworkExplosion => Box::new(FireworkExplosion::azalea_read(buf)?), + DataComponentKind::Fireworks => Box::new(Fireworks::azalea_read(buf)?), + DataComponentKind::Profile => Box::new(Profile::azalea_read(buf)?), + DataComponentKind::NoteBlockSound => Box::new(NoteBlockSound::azalea_read(buf)?), + DataComponentKind::BannerPatterns => Box::new(BannerPatterns::azalea_read(buf)?), + DataComponentKind::BaseColor => Box::new(BaseColor::azalea_read(buf)?), + DataComponentKind::PotDecorations => Box::new(PotDecorations::azalea_read(buf)?), + DataComponentKind::Container => Box::new(Container::azalea_read(buf)?), + DataComponentKind::BlockState => Box::new(BlockState::azalea_read(buf)?), + DataComponentKind::Bees => Box::new(Bees::azalea_read(buf)?), + DataComponentKind::Lock => Box::new(Lock::azalea_read(buf)?), + DataComponentKind::ContainerLoot => Box::new(ContainerLoot::azalea_read(buf)?), + DataComponentKind::JukeboxPlayable => Box::new(JukeboxPlayable::azalea_read(buf)?), + DataComponentKind::Consumable => Box::new(Consumable::azalea_read(buf)?), + DataComponentKind::UseRemainder => Box::new(UseRemainder::azalea_read(buf)?), + DataComponentKind::UseCooldown => Box::new(UseCooldown::azalea_read(buf)?), + DataComponentKind::Enchantable => Box::new(Enchantable::azalea_read(buf)?), + DataComponentKind::Repairable => Box::new(Repairable::azalea_read(buf)?), + DataComponentKind::ItemModel => Box::new(ItemModel::azalea_read(buf)?), + DataComponentKind::DamageResistant => Box::new(DamageResistant::azalea_read(buf)?), + DataComponentKind::Equippable => Box::new(Equippable::azalea_read(buf)?), + DataComponentKind::Glider => Box::new(Glider::azalea_read(buf)?), + DataComponentKind::TooltipStyle => Box::new(TooltipStyle::azalea_read(buf)?), + DataComponentKind::DeathProtection => Box::new(DeathProtection::azalea_read(buf)?), }) } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct CustomData { pub nbt: Nbt, } impl DataComponent for CustomData {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct MaxStackSize { #[var] pub count: i32, } impl DataComponent for MaxStackSize {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct MaxDamage { #[var] pub amount: i32, } impl DataComponent for MaxDamage {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct Damage { #[var] pub amount: i32, @@ -160,7 +162,7 @@ pub struct Damage { impl DataComponent for Damage {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct Unbreakable { pub show_in_tooltip: bool, } @@ -173,26 +175,26 @@ impl Default for Unbreakable { } } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct CustomName { pub name: FormattedText, } impl DataComponent for CustomName {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct ItemName { pub name: FormattedText, } impl DataComponent for ItemName {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] 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)] +#[derive(Clone, PartialEq, Copy, AzBuf)] pub enum Rarity { Common, Uncommon, @@ -201,7 +203,7 @@ pub enum Rarity { } impl DataComponent for Rarity {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct Enchantments { #[var] pub levels: HashMap<Enchantment, u32>, @@ -209,7 +211,7 @@ pub struct Enchantments { } impl DataComponent for Enchantments {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub enum BlockStateValueMatcher { Exact { value: String, @@ -220,38 +222,38 @@ pub enum BlockStateValueMatcher { }, } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct BlockStatePropertyMatcher { pub name: String, pub value_matcher: BlockStateValueMatcher, } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct BlockPredicate { pub blocks: Option<HolderSet<Block, ResourceLocation>>, pub properties: Option<Vec<BlockStatePropertyMatcher>>, pub nbt: Option<NbtCompound>, } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct AdventureModePredicate { pub predicates: Vec<BlockPredicate>, pub show_in_tooltip: bool, } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct CanPlaceOn { pub predicate: AdventureModePredicate, } impl DataComponent for CanPlaceOn {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct CanBreak { pub predicate: AdventureModePredicate, } impl DataComponent for CanBreak {} -#[derive(Clone, Copy, PartialEq, McBuf)] +#[derive(Clone, Copy, PartialEq, AzBuf)] pub enum EquipmentSlotGroup { Any, Mainhand, @@ -265,7 +267,7 @@ pub enum EquipmentSlotGroup { Body, } -#[derive(Clone, Copy, PartialEq, McBuf)] +#[derive(Clone, Copy, PartialEq, AzBuf)] pub enum AttributeModifierOperation { Addition, MultiplyBase, @@ -275,7 +277,7 @@ pub enum AttributeModifierOperation { // 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)] +#[derive(Clone, PartialEq, AzBuf)] pub struct AttributeModifier { pub uuid: Uuid, pub name: String, @@ -283,57 +285,57 @@ pub struct AttributeModifier { pub operation: AttributeModifierOperation, } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct AttributeModifiersEntry { pub attribute: Attribute, pub modifier: AttributeModifier, pub slot: EquipmentSlotGroup, } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct AttributeModifiers { pub modifiers: Vec<AttributeModifiersEntry>, pub show_in_tooltip: bool, } impl DataComponent for AttributeModifiers {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct CustomModelData { #[var] pub value: i32, } impl DataComponent for CustomModelData {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct HideAdditionalTooltip; impl DataComponent for HideAdditionalTooltip {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct HideTooltip; impl DataComponent for HideTooltip {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct RepairCost { #[var] pub cost: u32, } impl DataComponent for RepairCost {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct CreativeSlotLock; impl DataComponent for CreativeSlotLock {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct EnchantmentGlintOverride { pub show_glint: bool, } impl DataComponent for EnchantmentGlintOverride {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct IntangibleProjectile; impl DataComponent for IntangibleProjectile {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct MobEffectDetails { #[var] pub amplifier: i32, @@ -345,19 +347,19 @@ pub struct MobEffectDetails { pub hidden_effect: Option<Box<MobEffectDetails>>, } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct MobEffectInstance { pub effect: MobEffect, pub details: MobEffectDetails, } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct PossibleEffect { pub effect: MobEffectInstance, pub probability: f32, } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct Food { #[var] pub nutrition: i32, @@ -368,14 +370,14 @@ pub struct Food { } impl DataComponent for Food {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct ToolRule { pub blocks: HolderSet<Block, ResourceLocation>, pub speed: Option<f32>, pub correct_for_drops: Option<bool>, } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct Tool { pub rules: Vec<ToolRule>, pub default_mining_speed: f32, @@ -384,7 +386,7 @@ pub struct Tool { } impl DataComponent for Tool {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct StoredEnchantments { #[var] pub enchantments: HashMap<Enchantment, i32>, @@ -392,52 +394,52 @@ pub struct StoredEnchantments { } impl DataComponent for StoredEnchantments {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct DyedColor { pub rgb: i32, pub show_in_tooltip: bool, } impl DataComponent for DyedColor {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct MapColor { pub color: i32, } impl DataComponent for MapColor {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct MapId { #[var] pub id: i32, } impl DataComponent for MapId {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct MapDecorations { pub decorations: NbtCompound, } impl DataComponent for MapDecorations {} -#[derive(Clone, Copy, PartialEq, McBuf)] +#[derive(Clone, Copy, PartialEq, AzBuf)] pub enum MapPostProcessing { Lock, Scale, } impl DataComponent for MapPostProcessing {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct ChargedProjectiles { - pub items: Vec<ItemSlot>, + pub items: Vec<ItemStack>, } impl DataComponent for ChargedProjectiles {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct BundleContents { - pub items: Vec<ItemSlot>, + pub items: Vec<ItemStack>, } impl DataComponent for BundleContents {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct PotionContents { pub potion: Option<Potion>, pub custom_color: Option<i32>, @@ -445,26 +447,26 @@ pub struct PotionContents { } impl DataComponent for PotionContents {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct SuspiciousStewEffect { pub effect: MobEffect, #[var] pub duration: i32, } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct SuspiciousStewEffects { pub effects: Vec<SuspiciousStewEffect>, } impl DataComponent for SuspiciousStewEffects {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct WritableBookContent { pub pages: Vec<String>, } impl DataComponent for WritableBookContent {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct WrittenBookContent { pub title: String, pub author: String, @@ -475,7 +477,7 @@ pub struct WrittenBookContent { } impl DataComponent for WrittenBookContent {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct Trim { pub material: TrimMaterial, pub pattern: TrimPattern, @@ -483,57 +485,57 @@ pub struct Trim { } impl DataComponent for Trim {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct DebugStickState { pub properties: NbtCompound, } impl DataComponent for DebugStickState {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct EntityData { pub entity: NbtCompound, } impl DataComponent for EntityData {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct BucketEntityData { pub entity: NbtCompound, } impl DataComponent for BucketEntityData {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct BlockEntityData { pub entity: NbtCompound, } impl DataComponent for BlockEntityData {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct Instrument { pub instrument: azalea_registry::Instrument, } impl DataComponent for Instrument {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct OminousBottleAmplifier { #[var] pub amplifier: i32, } impl DataComponent for OminousBottleAmplifier {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct Recipes { pub recipes: Vec<ResourceLocation>, } impl DataComponent for Recipes {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct LodestoneTracker { pub target: Option<GlobalPos>, pub tracked: bool, } impl DataComponent for LodestoneTracker {} -#[derive(Clone, Copy, PartialEq, McBuf)] +#[derive(Clone, Copy, PartialEq, AzBuf)] pub enum FireworkExplosionShape { SmallBall, LargeBall, @@ -542,7 +544,7 @@ pub enum FireworkExplosionShape { Burst, } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct FireworkExplosion { pub shape: FireworkExplosionShape, pub colors: Vec<i32>, @@ -552,7 +554,7 @@ pub struct FireworkExplosion { } impl DataComponent for FireworkExplosion {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct Fireworks { #[var] pub flight_duration: i32, @@ -560,14 +562,14 @@ pub struct Fireworks { } impl DataComponent for Fireworks {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct GameProfileProperty { pub name: String, pub value: String, pub signature: Option<String>, } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct Profile { pub name: String, pub id: Option<Uuid>, @@ -575,13 +577,13 @@ pub struct Profile { } impl DataComponent for Profile {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct NoteBlockSound { pub sound: ResourceLocation, } impl DataComponent for NoteBlockSound {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct BannerPattern { #[var] pub pattern: i32, @@ -589,13 +591,13 @@ pub struct BannerPattern { pub color: i32, } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct BannerPatterns { pub patterns: Vec<BannerPattern>, } impl DataComponent for BannerPatterns {} -#[derive(Clone, Copy, PartialEq, McBuf)] +#[derive(Clone, Copy, PartialEq, AzBuf)] pub enum DyeColor { White, Orange, @@ -615,31 +617,31 @@ pub enum DyeColor { Black, } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct BaseColor { pub color: DyeColor, } impl DataComponent for BaseColor {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct PotDecorations { pub items: Vec<Item>, } impl DataComponent for PotDecorations {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct Container { - pub items: Vec<ItemSlot>, + pub items: Vec<ItemStack>, } impl DataComponent for Container {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct BlockState { pub properties: HashMap<String, String>, } impl DataComponent for BlockState {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct BeehiveOccupant { pub entity_data: NbtCompound, #[var] @@ -648,32 +650,32 @@ pub struct BeehiveOccupant { pub min_ticks_in_hive: i32, } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct Bees { pub occupants: Vec<BeehiveOccupant>, } impl DataComponent for Bees {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct Lock { pub key: String, } impl DataComponent for Lock {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct ContainerLoot { pub loot: NbtCompound, } impl DataComponent for ContainerLoot {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct JukeboxPlayable { pub song: azalea_registry::JukeboxSong, pub show_in_tooltip: bool, } impl DataComponent for JukeboxPlayable {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct Consumable { pub consume_seconds: f32, pub animation: ItemUseAnimation, @@ -683,7 +685,7 @@ pub struct Consumable { } impl DataComponent for Consumable {} -#[derive(Clone, Copy, PartialEq, McBuf)] +#[derive(Clone, Copy, PartialEq, AzBuf)] pub enum ItemUseAnimation { None, Eat, @@ -697,39 +699,39 @@ pub enum ItemUseAnimation { Brush, } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct UseRemainder { - pub convert_into: ItemSlot, + pub convert_into: ItemStack, } impl DataComponent for UseRemainder {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct UseCooldown { pub seconds: f32, pub cooldown_group: Option<ResourceLocation>, } impl DataComponent for UseCooldown {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct Enchantable { #[var] pub value: u32, } impl DataComponent for Enchantable {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct Repairable { pub items: HolderSet<Item, ResourceLocation>, } impl DataComponent for Repairable {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct ItemModel { pub resource_location: ResourceLocation, } impl DataComponent for ItemModel {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct DamageResistant { // in the vanilla code this is // ``` @@ -743,7 +745,7 @@ pub struct DamageResistant { } impl DataComponent for DamageResistant {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct Equippable { pub slot: EquipmentSlot, pub equip_sound: SoundEvent, @@ -752,7 +754,7 @@ pub struct Equippable { } impl DataComponent for Equippable {} -#[derive(Clone, Copy, Debug, PartialEq, McBuf)] +#[derive(Clone, Copy, Debug, PartialEq, AzBuf)] pub enum EquipmentSlot { Mainhand, Offhand, @@ -765,17 +767,17 @@ pub enum EquipmentSlot { Body, } -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct Glider; impl DataComponent for Glider {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct TooltipStyle { pub resource_location: ResourceLocation, } impl DataComponent for TooltipStyle {} -#[derive(Clone, PartialEq, McBuf)] +#[derive(Clone, PartialEq, AzBuf)] pub struct DeathProtection { pub death_effects: Vec<ConsumeEffectKind>, } |
