mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
Fix reading from invalid level.data
Also use Spawn x and z now !
This commit is contained in:
@@ -25,7 +25,6 @@ and customizable experience. It prioritizes performance and player enjoyment whi
|
||||
## What Pumpkin will not
|
||||
|
||||
- Be compatible with plugins or mods for other servers
|
||||
- Function as a framework for building a server from scratch.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Pumpkin is currently under heavy development.
|
||||
@@ -87,7 +86,7 @@ and customizable experience. It prioritizes performance and player enjoyment whi
|
||||
- [x] Bungeecord
|
||||
- [x] Velocity
|
||||
|
||||
Check out our [Github Project](https://github.com/users/Snowiiii/projects/12/views/3) to see current progress
|
||||
Check out our [Github Project](https://github.com/orgs/Pumpkin-MC/projects/3) to see current progress
|
||||
|
||||
## How to run
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ impl WorldInfoWriter for AnvilLevelInfo {
|
||||
spawn_x: info.spawn_x,
|
||||
spawn_y: info.spawn_y,
|
||||
spawn_z: info.spawn_z,
|
||||
spawn_angle: info.spawn_angle,
|
||||
nbt_version: info.nbt_version,
|
||||
version: info.version,
|
||||
},
|
||||
|
||||
@@ -21,13 +21,14 @@ pub(crate) trait WorldInfoWriter: Sync + Send {
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
#[serde(default)]
|
||||
pub struct LevelData {
|
||||
// true if cheats are enabled.
|
||||
pub allow_commands: bool,
|
||||
// An integer displaying the data version.
|
||||
pub data_version: i32,
|
||||
// The current difficulty setting.
|
||||
pub difficulty: Difficulty,
|
||||
pub difficulty: u8,
|
||||
// the generation settings for each dimension.
|
||||
pub world_gen_settings: WorldGenSettings,
|
||||
// The Unix time in milliseconds when the level was last loaded.
|
||||
@@ -40,6 +41,8 @@ pub struct LevelData {
|
||||
pub spawn_y: i32,
|
||||
// The Z coordinate of the world spawn.
|
||||
pub spawn_z: i32,
|
||||
// The Yaw rotation of the world spawn.
|
||||
pub spawn_angle: f32,
|
||||
#[serde(rename = "version")]
|
||||
// The NBT version of the level
|
||||
pub nbt_version: i32,
|
||||
@@ -97,13 +100,14 @@ impl Default for LevelData {
|
||||
allow_commands: true,
|
||||
// TODO
|
||||
data_version: -1,
|
||||
difficulty: Difficulty::Normal,
|
||||
difficulty: Difficulty::Normal as u8,
|
||||
world_gen_settings: Default::default(),
|
||||
last_played: -1,
|
||||
level_name: "world".to_string(),
|
||||
spawn_x: 0,
|
||||
spawn_y: 200,
|
||||
spawn_z: 0,
|
||||
spawn_angle: 0.0,
|
||||
nbt_version: -1,
|
||||
version: Default::default(),
|
||||
}
|
||||
|
||||
@@ -306,8 +306,9 @@ impl World {
|
||||
player.send_permission_lvl_update().await;
|
||||
client_cmd_suggestions::send_c_commands_packet(&player, &server.command_dispatcher).await;
|
||||
// teleport
|
||||
let mut position = Vector3::new(10.0, 120.0, 10.0);
|
||||
let yaw = 10.0;
|
||||
let info = &self.level.level_info;
|
||||
let mut position = Vector3::new(f64::from(info.spawn_x), 120.0, f64::from(info.spawn_z));
|
||||
let yaw = info.spawn_angle;
|
||||
let pitch = 10.0;
|
||||
|
||||
let top = self
|
||||
@@ -498,8 +499,9 @@ impl World {
|
||||
player.send_permission_lvl_update().await;
|
||||
|
||||
// teleport
|
||||
let mut position = Vector3::new(10.0, 120.0, 10.0);
|
||||
let yaw = 10.0;
|
||||
let info = &self.level.level_info;
|
||||
let mut position = Vector3::new(f64::from(info.spawn_x), 120.0, f64::from(info.spawn_z));
|
||||
let yaw = info.spawn_angle;
|
||||
let pitch = 10.0;
|
||||
|
||||
let top = self
|
||||
|
||||
Reference in New Issue
Block a user