Skip to content

Commit

Permalink
Remove unused deps
Browse files Browse the repository at this point in the history
to mention is the take_mut dep i removed. Its heavily outdated and uses unsafe combined with pointer magic.
  • Loading branch information
Snowiiii committed Sep 6, 2024
1 parent dad4798 commit 91d190c
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 41 deletions.
21 changes: 0 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions pumpkin-entity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@ version.workspace = true
edition.workspace = true

[dependencies]
pumpkin-core = { path = "../pumpkin-core"}

num-traits = "0.2"
num-derive = "0.4"
pumpkin-core = { path = "../pumpkin-core"}
4 changes: 1 addition & 3 deletions pumpkin-protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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" }
13 changes: 7 additions & 6 deletions pumpkin-protocol/src/bytebuf/packet_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

Expand Down
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/bytebuf/serializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use thiserror::Error;
use super::ByteBuffer;

pub struct Serializer {
output: ByteBuffer,
pub output: ByteBuffer,
}

impl Serializer {
Expand Down
4 changes: 2 additions & 2 deletions pumpkin-registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
Expand Down
2 changes: 2 additions & 0 deletions pumpkin-world/src/biome.rs
Original file line number Diff line number Diff line change
@@ -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
}
4 changes: 2 additions & 2 deletions pumpkin-world/src/level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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) => {
Expand Down
2 changes: 0 additions & 2 deletions pumpkin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pumpkin-registry = { path = "../pumpkin-registry"}
# config
serde.workspace = true
serde_json = "1.0"
toml = "0.8"

bytes = "1.7"

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 91d190c

Please sign in to comment.