replace crab_nbt with fastnbt

This commit is contained in:
Snowiiii
2024-07-31 18:16:09 +02:00
parent d574553113
commit 2479019443
4 changed files with 30 additions and 38 deletions

55
Cargo.lock generated
View File

@@ -129,18 +129,6 @@ dependencies = [
"libc",
]
[[package]]
name = "crab_nbt"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "469a8a59b4898974c623174c52d1c47b2e21a19e1f6f849a8046aa9ba03af5cf"
dependencies = [
"bytes",
"cesu8",
"derive_more",
"thiserror",
]
[[package]]
name = "crc32fast"
version = "1.4.2"
@@ -195,26 +183,6 @@ dependencies = [
"powerfmt",
]
[[package]]
name = "derive_more"
version = "1.0.0-beta.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7abbfc297053be59290e3152f8cbcd52c8642e0728b69ee187d991d4c1af08d"
dependencies = [
"derive_more-impl",
]
[[package]]
name = "derive_more-impl"
version = "1.0.0-beta.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bba3e9872d7c58ce7ef0fcf1844fcc3e23ef2a58377b50df35dd98e42a5726e"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "digest"
version = "0.10.7"
@@ -231,6 +199,18 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "fastnbt"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d4a73a95dc65551ccd98e1ecd1adb5d1ba5361146963b31f481ca42fc0520a3"
dependencies = [
"byteorder",
"cesu8",
"serde",
"serde_bytes",
]
[[package]]
name = "fdeflate"
version = "0.3.4"
@@ -524,8 +504,8 @@ dependencies = [
"base64",
"bytes",
"cfb8",
"crab_nbt",
"crossbeam-channel",
"fastnbt",
"flate2",
"image",
"log",
@@ -623,6 +603,15 @@ dependencies = [
"serde_derive",
]
[[package]]
name = "serde_bytes"
version = "0.11.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a"
dependencies = [
"serde",
]
[[package]]
name = "serde_derive"
version = "1.0.204"

View File

@@ -29,6 +29,5 @@ mio = { version = "1.0.1", features = ["os-poll", "net"]}
crossbeam-channel = "0.5.13"
uuid = "1.10"
toml = "0.8.17"
crab_nbt = "0.1.2"
fastnbt = "2.5.0"

View File

@@ -1,5 +1,5 @@
use core::str;
use std::io::{self, Error, ErrorKind, Read};
use std::io::{self, Error, ErrorKind, Read, Write};
use bytes::{Buf, BufMut, BytesMut};
@@ -180,13 +180,17 @@ impl ByteBuffer {
self.put_list(v, |p, &v| p.put_var_int(v))
}
pub fn get_nbt(&mut self) -> Option<crab_nbt::NbtTag> {
/* pub fn get_nbt(&mut self) -> Option<crab_nbt::NbtTag> {
match crab_nbt::NbtTag::deserialize(self.buf()) {
Ok(v) => Some(v),
Err(err) => None,
}
}
pub fn put_nbt(&mut self, nbt: NbtTag) {
self.buffer.put_slice(&nbt.serialize());
} */
pub fn buf(&mut self) -> &mut BytesMut {
&mut self.buffer
}

View File

@@ -34,7 +34,7 @@ struct CodecItem<T> {
pub fn write_single_dimension(out: &mut ByteBuffer, world_min_y: i32, world_height: u32) {
let dimension = dimensions::overworld(world_min_y, world_height);
// out.put_slice(&crab_nbt::nbt!("", &dimension).unwrap().serialize());
// out.put_nbt(nbt!(dimension))
}
pub fn write_codec(out: &mut ByteBuffer, world_min_y: i32, world_height: u32) {