diff --git a/Cargo.lock b/Cargo.lock index 5a1b19f32..7b2c8b357 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -196,8 +196,7 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "fastnbt" version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d4a73a95dc65551ccd98e1ecd1adb5d1ba5361146963b31f481ca42fc0520a3" +source = "git+https://github.com/owengage/fastnbt.git#0ea1a338671e51e62277645fbfffbdcaf2d2ec60" dependencies = [ "byteorder", "cesu8", diff --git a/pumpkin/Cargo.toml b/pumpkin/Cargo.toml index 42d1f7926..1e0d87025 100644 --- a/pumpkin/Cargo.toml +++ b/pumpkin/Cargo.toml @@ -29,7 +29,7 @@ mio = { version = "1.0.1", features = ["os-poll", "net"]} crossbeam-channel = "0.5.13" uuid = "1.10" toml = "0.8.17" -fastnbt = "2.5.0" +fastnbt = { git = "https://github.com/owengage/fastnbt.git" } fastsnbt = "0.2" diff --git a/pumpkin/icon.png b/pumpkin/icon.png index 944a32268..09f0b275f 100644 Binary files a/pumpkin/icon.png and b/pumpkin/icon.png differ diff --git a/pumpkin/src/protocol/registry/dimensions.rs b/pumpkin/src/protocol/registry/dimensions.rs index 9e539028f..7264790a2 100644 --- a/pumpkin/src/protocol/registry/dimensions.rs +++ b/pumpkin/src/protocol/registry/dimensions.rs @@ -3,24 +3,24 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Dimension { pub ambient_light: f32, - bed_works: bool, + bed_works: i32, coordinate_scale: f64, effects: DimensionEffects, #[serde(skip_serializing_if = "Option::is_none")] fixed_time: Option, - has_ceiling: bool, - has_raids: bool, - has_skylight: bool, + has_ceiling: i32, + has_raids: i32, + has_skylight: i32, height: i32, infiniburn: String, logical_height: i32, min_y: i32, monster_spawn_block_light_limit: i32, monster_spawn_light_level: MonsterSpawnLightLevel, - natural: bool, - piglin_safe: bool, - respawn_anchor_works: bool, - ultrawarm: bool, + natural: i32, + piglin_safe: i32, + respawn_anchor_works: i32, + ultrawarm: i32, } #[derive(Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Debug)] @@ -38,23 +38,23 @@ impl Default for Dimension { fn default() -> Self { Self { ambient_light: 0.0, - bed_works: true, + bed_works: 1, coordinate_scale: 1.0, effects: DimensionEffects::default(), fixed_time: None, - has_ceiling: false, - has_raids: true, - has_skylight: true, + has_ceiling: 0, + has_raids: 1, + has_skylight: 1, height: 384, infiniburn: "#minecraft:infiniburn_overworld".into(), logical_height: 384, min_y: -64, monster_spawn_block_light_limit: 0, monster_spawn_light_level: MonsterSpawnLightLevel::Int(7), - natural: true, - piglin_safe: false, - respawn_anchor_works: false, - ultrawarm: false, + natural: 1, + piglin_safe: 0, + respawn_anchor_works: 0, + ultrawarm: 0, } } } diff --git a/pumpkin/src/protocol/registry/mod.rs b/pumpkin/src/protocol/registry/mod.rs index 39b3b9495..a17e04264 100644 --- a/pumpkin/src/protocol/registry/mod.rs +++ b/pumpkin/src/protocol/registry/mod.rs @@ -1,4 +1,9 @@ -use dimensions::Dimension; +use core::str; +use std::{fs::File, io::Read}; + +use dimensions::{Dimension, DimensionEffects, MonsterSpawnLightLevel}; +use fastnbt::{nbt, to_bytes_with_opts, SerOpts}; +use flate2::read::GzDecoder; use serde::Serialize; use super::bytebuf::ByteBuffer; @@ -59,8 +64,8 @@ pub fn write_codec(out: &mut ByteBuffer, world_min_y: i32, world_height: u32) { }, */ }; - let val = &fastsnbt::to_string(&info).unwrap(); + let val = &fastnbt::to_bytes_with_opts(&info, SerOpts::network_nbt()).unwrap(); dbg!(val); // Dimension codec - out.put_string(val); + out.put_slice(val); } diff --git a/pumpkin/src/server.rs b/pumpkin/src/server.rs index dd84555a7..76602c4fc 100644 --- a/pumpkin/src/server.rs +++ b/pumpkin/src/server.rs @@ -118,6 +118,7 @@ impl Server { )) .unwrap_or_else(|e| client.kick(&e.to_string())); + dbg!("spawning player"); client.player = Some(player); }