diff --git a/crates/core/item/src/edcode.rs b/crates/core/item/src/edcode.rs index 5860f3c0..ce05c06c 100644 --- a/crates/core/item/src/edcode.rs +++ b/crates/core/item/src/edcode.rs @@ -6,7 +6,7 @@ use crate::{stack::ItemStackCx, ItemStack, RawItem}; impl Encode for ItemStack<'_, Cx> where - Cx: ItemStackCx + for<'a> WriteNbt<&'a Cx::Compound>, + Cx: ItemStackCx + for<'a> WriteNbt>, { fn encode(&self, mut buf: B) -> Result<(), std::io::Error> where @@ -20,12 +20,7 @@ where item.encode(&mut buf)?; self.count().encode(&mut buf)?; if item.settings().max_damage.is_some() || item.settings().sync_nbt { - if let Some(x) = self.nbt() { - Cx::write_nbt(x, buf.writer())? - } else { - // @TODO: Write empty nbt tag. - todo!() - } + Cx::write_nbt(self.nbt(), buf.writer())? } } Ok(()) @@ -34,7 +29,7 @@ where impl<'r, Cx> Decode for ItemStack<'r, Cx> where - Cx: ItemStackCx + for<'a> ReadNbt<&'a Cx::Compound> + ProvideRegistry<'r, Cx::Id, RawItem>, + Cx: ItemStackCx + ReadNbt> + ProvideRegistry<'r, Cx::Id, RawItem>, { fn decode(mut buf: B) -> Result where @@ -43,9 +38,8 @@ where if bool::decode(&mut buf)? { let item = Reg::<'r, Cx::Id, RawItem>::decode(&mut buf)?; let count = u8::decode(&mut buf)?; - // @TODO: Handle null tags. - let nbt = todo!(); - // Ok(ItemStack::with_nbt(item, count, nbt)) + let nbt = Cx::read_nbt(buf.reader())?; + Ok(ItemStack::with_nbt(item, count, nbt)) } else { Ok(ItemStack::empty()) }