diff options
| author | mat <git@matdoes.dev> | 2025-02-21 17:22:00 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-02-21 17:22:00 +0000 |
| commit | 63b1036a96c45b0fefc6ca2501f1cc479acc95de (patch) | |
| tree | a0a06a5b1111d335c4e3c92695a3673f534a7769 /azalea-inventory/src | |
| parent | c285fadd34df2a43a5cfe1d3c02a3cc47bf69e9e (diff) | |
| download | azalea-drasl-63b1036a96c45b0fefc6ca2501f1cc479acc95de.tar.xz | |
fix CustomModelData and WrittenBookContent datacomponents
Diffstat (limited to 'azalea-inventory/src')
| -rw-r--r-- | azalea-inventory/src/components.rs | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/azalea-inventory/src/components.rs b/azalea-inventory/src/components.rs index 262cf215..6dd60819 100644 --- a/azalea-inventory/src/components.rs +++ b/azalea-inventory/src/components.rs @@ -3,12 +3,15 @@ use std::{any::Any, collections::HashMap, io::Cursor}; use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError}; use azalea_chat::FormattedText; -use azalea_core::{position::GlobalPos, resource_location::ResourceLocation}; +use azalea_core::{ + filterable::Filterable, 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 tracing::trace; use uuid::Uuid; use crate::ItemStack; @@ -54,6 +57,8 @@ pub fn from_kind( // if this is causing a compile-time error, look at DataComponents.java in the // decompiled vanilla code to see how to implement new components + trace!("Reading data component {kind}"); + // note that this match statement is updated by genitemcomponents.py Ok(match kind { DataComponentKind::CustomData => Box::new(CustomData::azalea_read(buf)?), @@ -328,8 +333,10 @@ impl DataComponent for AttributeModifiers { #[derive(Clone, PartialEq, AzBuf)] pub struct CustomModelData { - #[var] - pub value: i32, + pub floats: Vec<f32>, + pub flags: Vec<bool>, + pub strings: Vec<String>, + pub colors: Vec<i32>, } impl DataComponent for CustomModelData { const KIND: DataComponentKind = DataComponentKind::CustomModelData; @@ -535,13 +542,15 @@ impl DataComponent for WritableBookContent { #[derive(Clone, PartialEq, AzBuf)] pub struct WrittenBookContent { - pub title: String, + #[limit(32)] + pub title: Filterable<String>, pub author: String, #[var] pub generation: i32, - pub pages: Vec<FormattedText>, + pub pages: Vec<Filterable<FormattedText>>, pub resolved: bool, } + impl DataComponent for WrittenBookContent { const KIND: DataComponentKind = DataComponentKind::WrittenBookContent; } |
