Compare commits
No commits in common. "8d7d802c45ac631120b82b541d7381d146425421" and "18d1f3f5668175db98eafcbaae92bc5b22ad8423" have entirely different histories.
8d7d802c45
...
18d1f3f566
10
src/data.rs
10
src/data.rs
@ -71,16 +71,6 @@ impl NbtItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<NbtValue> for NbtItem {
|
|
||||||
#[inline]
|
|
||||||
fn from(value: NbtValue) -> Self { Self::Value(value) }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<NbtList> for NbtItem {
|
|
||||||
#[inline]
|
|
||||||
fn from(value: NbtList) -> Self { Self::Array(value) }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<Vec<NbtItem>> for NbtList {
|
impl From<Vec<NbtItem>> for NbtList {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from(value: Vec<NbtItem>) -> Self { Self::List(Rc::new(RefCell::new(value))) }
|
fn from(value: Vec<NbtItem>) -> Self { Self::List(Rc::new(RefCell::new(value))) }
|
||||||
|
@ -14,9 +14,9 @@ use std::rc::Rc;
|
|||||||
/// (0x0C) Vec<i64>
|
/// (0x0C) Vec<i64>
|
||||||
pub mod read {
|
pub mod read {
|
||||||
use crate::data::{NbtItem, NbtLength, NbtList, NbtValue, Reader};
|
use crate::data::{NbtItem, NbtLength, NbtList, NbtValue, Reader};
|
||||||
|
use std::cell::RefCell;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::collections::HashMap;
|
use std::rc::Rc;
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
/// 直接读取长度和值 不带名称
|
/// 直接读取长度和值 不带名称
|
||||||
/// 反正名字都在外面读过
|
/// 反正名字都在外面读过
|
||||||
@ -62,7 +62,6 @@ pub mod read {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// 直接读取长度和值 不带名称
|
/// 直接读取长度和值 不带名称
|
||||||
/// 主要是为了可以直接递归 (
|
|
||||||
pub fn read_nbt_list(value: &mut Reader) -> Vec<NbtItem> {
|
pub fn read_nbt_list(value: &mut Reader) -> Vec<NbtItem> {
|
||||||
// 读取长度
|
// 读取长度
|
||||||
let mut buff = [0_u8; 4];
|
let mut buff = [0_u8; 4];
|
||||||
@ -74,7 +73,6 @@ pub mod read {
|
|||||||
_ = value.read(&mut type_buff).unwrap();
|
_ = value.read(&mut type_buff).unwrap();
|
||||||
match type_buff {
|
match type_buff {
|
||||||
[0x00] => {
|
[0x00] => {
|
||||||
// End
|
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
[0x01] => {
|
[0x01] => {
|
||||||
@ -130,9 +128,6 @@ pub mod read {
|
|||||||
[0x0A] => {
|
[0x0A] => {
|
||||||
// Compound
|
// Compound
|
||||||
// 他甚至不告诉你有多少个元素,要命
|
// 他甚至不告诉你有多少个元素,要命
|
||||||
for _ in 0..len {
|
|
||||||
vec.push(NbtItem::Array(NbtList::from(from_compound(value))));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
[0x0B] => {
|
[0x0B] => {
|
||||||
// IntArray
|
// IntArray
|
||||||
|
Loading…
Reference in New Issue
Block a user