Skip to content

Commit

Permalink
fix nbt
Browse files Browse the repository at this point in the history
  • Loading branch information
Snowiiii committed Aug 1, 2024
1 parent b48d558 commit b6d1dd7
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 22 deletions.
3 changes: 1 addition & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion pumpkin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Binary file modified pumpkin/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 16 additions & 16 deletions pumpkin/src/protocol/registry/dimensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<i32>,
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)]
Expand All @@ -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,
}
}
}
Expand Down
11 changes: 8 additions & 3 deletions pumpkin/src/protocol/registry/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
}
1 change: 1 addition & 0 deletions pumpkin/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ impl Server {
))
.unwrap_or_else(|e| client.kick(&e.to_string()));

dbg!("spawning player");
client.player = Some(player);
}

Expand Down

0 comments on commit b6d1dd7

Please sign in to comment.