fix nbt
This commit is contained in:
parent
b48d558112
commit
b6d1dd7dfb
3
Cargo.lock
generated
3
Cargo.lock
generated
@ -196,8 +196,7 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "fastnbt"
|
name = "fastnbt"
|
||||||
version = "2.5.0"
|
version = "2.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/owengage/fastnbt.git#0ea1a338671e51e62277645fbfffbdcaf2d2ec60"
|
||||||
checksum = "7d4a73a95dc65551ccd98e1ecd1adb5d1ba5361146963b31f481ca42fc0520a3"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"cesu8",
|
"cesu8",
|
||||||
|
|||||||
@ -29,7 +29,7 @@ mio = { version = "1.0.1", features = ["os-poll", "net"]}
|
|||||||
crossbeam-channel = "0.5.13"
|
crossbeam-channel = "0.5.13"
|
||||||
uuid = "1.10"
|
uuid = "1.10"
|
||||||
toml = "0.8.17"
|
toml = "0.8.17"
|
||||||
fastnbt = "2.5.0"
|
fastnbt = { git = "https://github.com/owengage/fastnbt.git" }
|
||||||
fastsnbt = "0.2"
|
fastsnbt = "0.2"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
BIN
pumpkin/icon.png
BIN
pumpkin/icon.png
Binary file not shown.
|
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 835 KiB |
@ -3,24 +3,24 @@ use serde::{Deserialize, Serialize};
|
|||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct Dimension {
|
pub struct Dimension {
|
||||||
pub ambient_light: f32,
|
pub ambient_light: f32,
|
||||||
bed_works: bool,
|
bed_works: i32,
|
||||||
coordinate_scale: f64,
|
coordinate_scale: f64,
|
||||||
effects: DimensionEffects,
|
effects: DimensionEffects,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
fixed_time: Option<i32>,
|
fixed_time: Option<i32>,
|
||||||
has_ceiling: bool,
|
has_ceiling: i32,
|
||||||
has_raids: bool,
|
has_raids: i32,
|
||||||
has_skylight: bool,
|
has_skylight: i32,
|
||||||
height: i32,
|
height: i32,
|
||||||
infiniburn: String,
|
infiniburn: String,
|
||||||
logical_height: i32,
|
logical_height: i32,
|
||||||
min_y: i32,
|
min_y: i32,
|
||||||
monster_spawn_block_light_limit: i32,
|
monster_spawn_block_light_limit: i32,
|
||||||
monster_spawn_light_level: MonsterSpawnLightLevel,
|
monster_spawn_light_level: MonsterSpawnLightLevel,
|
||||||
natural: bool,
|
natural: i32,
|
||||||
piglin_safe: bool,
|
piglin_safe: i32,
|
||||||
respawn_anchor_works: bool,
|
respawn_anchor_works: i32,
|
||||||
ultrawarm: bool,
|
ultrawarm: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Debug)]
|
||||||
@ -38,23 +38,23 @@ impl Default for Dimension {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
ambient_light: 0.0,
|
ambient_light: 0.0,
|
||||||
bed_works: true,
|
bed_works: 1,
|
||||||
coordinate_scale: 1.0,
|
coordinate_scale: 1.0,
|
||||||
effects: DimensionEffects::default(),
|
effects: DimensionEffects::default(),
|
||||||
fixed_time: None,
|
fixed_time: None,
|
||||||
has_ceiling: false,
|
has_ceiling: 0,
|
||||||
has_raids: true,
|
has_raids: 1,
|
||||||
has_skylight: true,
|
has_skylight: 1,
|
||||||
height: 384,
|
height: 384,
|
||||||
infiniburn: "#minecraft:infiniburn_overworld".into(),
|
infiniburn: "#minecraft:infiniburn_overworld".into(),
|
||||||
logical_height: 384,
|
logical_height: 384,
|
||||||
min_y: -64,
|
min_y: -64,
|
||||||
monster_spawn_block_light_limit: 0,
|
monster_spawn_block_light_limit: 0,
|
||||||
monster_spawn_light_level: MonsterSpawnLightLevel::Int(7),
|
monster_spawn_light_level: MonsterSpawnLightLevel::Int(7),
|
||||||
natural: true,
|
natural: 1,
|
||||||
piglin_safe: false,
|
piglin_safe: 0,
|
||||||
respawn_anchor_works: false,
|
respawn_anchor_works: 0,
|
||||||
ultrawarm: false,
|
ultrawarm: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 serde::Serialize;
|
||||||
|
|
||||||
use super::bytebuf::ByteBuffer;
|
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);
|
dbg!(val);
|
||||||
// Dimension codec
|
// Dimension codec
|
||||||
out.put_string(val);
|
out.put_slice(val);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -118,6 +118,7 @@ impl Server {
|
|||||||
))
|
))
|
||||||
.unwrap_or_else(|e| client.kick(&e.to_string()));
|
.unwrap_or_else(|e| client.kick(&e.to_string()));
|
||||||
|
|
||||||
|
dbg!("spawning player");
|
||||||
client.player = Some(player);
|
client.player = Some(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user