Remove unused deps

to mention is the take_mut dep i removed. Its heavily outdated and uses unsafe combined with pointer magic.
This commit is contained in:
Alexander Medvedev 2024-09-06 13:30:57 +01:00
parent dad4798844
commit 91d190c212
9 changed files with 16 additions and 41 deletions

21
Cargo.lock generated
View File

@ -534,15 +534,6 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "crossbeam-channel"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-deque"
version = "0.8.5"
@ -1856,7 +1847,6 @@ version = "0.1.0-dev"
dependencies = [
"base64 0.22.1",
"bytes",
"crossbeam-channel",
"ctrlc",
"digest 0.11.0-pre.9",
"hmac",
@ -1886,7 +1876,6 @@ dependencies = [
"simple_logger",
"thiserror",
"tokio",
"toml",
"uuid",
]
@ -1917,8 +1906,6 @@ dependencies = [
name = "pumpkin-entity"
version = "0.1.0"
dependencies = [
"num-derive",
"num-traits",
"pumpkin-core",
]
@ -1966,8 +1953,6 @@ dependencies = [
"pumpkin-macros",
"pumpkin-world",
"serde",
"serde_json",
"take_mut",
"thiserror",
"uuid",
]
@ -2657,12 +2642,6 @@ dependencies = [
"winx",
]
[[package]]
name = "take_mut"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60"
[[package]]
name = "target-lexicon"
version = "0.12.16"

View File

@ -5,6 +5,3 @@ edition.workspace = true
[dependencies]
pumpkin-core = { path = "../pumpkin-core"}
num-traits = "0.2"
num-derive = "0.4"

View File

@ -13,8 +13,6 @@ bytes = "1.7"
uuid.workspace = true
serde.workspace = true
# to parse strings to json responses
serde_json = "1.0"
flate2 = "1.0.33"
@ -26,6 +24,6 @@ num-derive = "0.4"
# encryption
aes = "0.8.4"
cfb8 = "0.8.1"
take_mut = "0.2.2"
itertools = "0.13.0"
fastnbt = { git = "https://github.com/owengage/fastnbt.git" }

View File

@ -83,12 +83,13 @@ where
P: Packet + Serialize,
{
fn write(&self, bytebuf: &mut ByteBuffer) {
take_mut::take(bytebuf, |bytebuf| {
let mut serializer = serializer::Serializer::new(bytebuf);
self.serialize(&mut serializer)
.expect("Could not serialize packet");
serializer.into()
});
let mut serializer = serializer::Serializer::new(ByteBuffer::empty());
self.serialize(&mut serializer)
.expect("Could not serialize packet");
// We write the packet in an empty bytebuffer and then put it into our current one.
// In the future we may do packet batching thats the reason i don't let every packet create a new bytebuffer and use
// an existing instead
bytebuf.put(serializer.output.buf());
}
}

View File

@ -9,7 +9,7 @@ use thiserror::Error;
use super::ByteBuffer;
pub struct Serializer {
output: ByteBuffer,
pub output: ByteBuffer,
}
impl Serializer {

View File

@ -33,12 +33,12 @@ impl Registry {
registry_id: "minecraft:worldgen/biome".to_string(),
registry_entries: vec![
RegistryEntry {
entry_id: "minecraft:snowy_taiga",
entry_id: "minecraft:plains",
data: fastnbt::to_bytes_with_opts(&Biome::default(), SerOpts::network_nbt())
.unwrap(),
},
RegistryEntry {
entry_id: "minecraft:plains",
entry_id: "minecraft:snowy_taiga",
data: fastnbt::to_bytes_with_opts(&Biome::default(), SerOpts::network_nbt())
.unwrap(),
},

View File

@ -1,9 +1,11 @@
use serde::{Deserialize, Serialize};
// TODO make this work with the protocol
// Send by the registry
#[derive(Serialize, Deserialize, Clone, Copy)]
#[non_exhaustive]
pub enum Biome {
Plains,
SnowyTiga,
// TODO list all Biomes
}

View File

@ -277,7 +277,7 @@ impl Level {
match compression {
Compression::Gzip => {
let mut z = GzDecoder::new(&compressed_data[..]);
let mut chunk_data = Vec::new();
let mut chunk_data = Vec::with_capacity(compressed_data.len());
match z.read_to_end(&mut chunk_data) {
Ok(_) => {}
Err(e) => {
@ -288,7 +288,7 @@ impl Level {
}
Compression::Zlib => {
let mut z = ZlibDecoder::new(&compressed_data[..]);
let mut chunk_data = Vec::new();
let mut chunk_data = Vec::with_capacity(compressed_data.len());
match z.read_to_end(&mut chunk_data) {
Ok(_) => {}
Err(e) => {

View File

@ -21,7 +21,6 @@ pumpkin-registry = { path = "../pumpkin-registry"}
# config
serde.workspace = true
serde_json = "1.0"
toml = "0.8"
bytes = "1.7"
@ -59,7 +58,6 @@ log.workspace = true
# networking
mio = { version = "1.0.2", features = ["os-poll", "net"]}
crossbeam-channel = "0.5.13"
uuid.workspace = true
tokio.workspace = true