Port bedrock to 1.26
still some bugs :c
This commit is contained in:
parent
004a41625f
commit
a0b8bbebfb
@ -55,6 +55,33 @@ pub struct CStartGame {
|
|||||||
pub enable_clientside_generation: bool,
|
pub enable_clientside_generation: bool,
|
||||||
pub blocknetwork_ids_are_hashed: bool,
|
pub blocknetwork_ids_are_hashed: bool,
|
||||||
pub server_auth_sounds: bool,
|
pub server_auth_sounds: bool,
|
||||||
|
|
||||||
|
// 2 Optionals is what we need Mojang :cap:
|
||||||
|
pub server_join_information: Option<ServerJoinInformation>,
|
||||||
|
pub telemetry: ServerTelemetryData,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(PacketWrite)]
|
||||||
|
pub struct ServerJoinInformation {
|
||||||
|
gathering_info: Option<GatheringJoinInfo>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(PacketWrite)]
|
||||||
|
pub struct GatheringJoinInfo {
|
||||||
|
experience_id: String,
|
||||||
|
experience_name: String,
|
||||||
|
experience_world_id: String,
|
||||||
|
experience_world_name: String,
|
||||||
|
creator_id: String,
|
||||||
|
store_id: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(PacketWrite)]
|
||||||
|
pub struct ServerTelemetryData {
|
||||||
|
pub server_id: String,
|
||||||
|
pub scenario_id: String,
|
||||||
|
pub world_id: String,
|
||||||
|
pub owner_id: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PacketWrite)]
|
#[derive(PacketWrite)]
|
||||||
@ -120,10 +147,6 @@ pub struct LevelSettings {
|
|||||||
pub override_force_experimental_gameplay_has_value: bool,
|
pub override_force_experimental_gameplay_has_value: bool,
|
||||||
pub chat_restriction_level: i8,
|
pub chat_restriction_level: i8,
|
||||||
pub disable_player_interactions: bool,
|
pub disable_player_interactions: bool,
|
||||||
pub server_id: String,
|
|
||||||
pub world_id: String,
|
|
||||||
pub scenario_id: String,
|
|
||||||
pub owner_id: String,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, PacketWrite)]
|
#[derive(Default, PacketWrite)]
|
||||||
|
|||||||
@ -55,22 +55,6 @@ impl SText {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const fn get_dummy_strings(category: u8) -> &'static [&'static str] {
|
|
||||||
match category {
|
|
||||||
0 => &[
|
|
||||||
"raw",
|
|
||||||
"tip",
|
|
||||||
"systemMessage",
|
|
||||||
"textObjectWhisper",
|
|
||||||
"textObjectAnnouncement",
|
|
||||||
"textObject",
|
|
||||||
],
|
|
||||||
1 => &["chat", "whisper", "announcement"],
|
|
||||||
2 => &["translate", "popup", "jukeboxPopup"],
|
|
||||||
_ => &[],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const fn get_category(&self) -> u8 {
|
const fn get_category(&self) -> u8 {
|
||||||
match self.r#type {
|
match self.r#type {
|
||||||
TextPacketType::Raw
|
TextPacketType::Raw
|
||||||
@ -91,18 +75,7 @@ impl PacketRead for SText {
|
|||||||
fn read<R: Read>(reader: &mut R) -> Result<Self, Error> {
|
fn read<R: Read>(reader: &mut R) -> Result<Self, Error> {
|
||||||
let needs_translation = bool::read(reader)?;
|
let needs_translation = bool::read(reader)?;
|
||||||
|
|
||||||
let category = u8::read(reader)?;
|
let _category = u8::read(reader)?;
|
||||||
|
|
||||||
let expected_dummies = Self::get_dummy_strings(category);
|
|
||||||
for &expected in expected_dummies {
|
|
||||||
let actual = String::read(reader)?;
|
|
||||||
if actual != expected {
|
|
||||||
return Err(Error::new(
|
|
||||||
ErrorKind::InvalidData,
|
|
||||||
format!("Dummy string mismatch: expected {expected}, got {actual}"),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let r#type = TextPacketType::read(reader)?;
|
let r#type = TextPacketType::read(reader)?;
|
||||||
|
|
||||||
@ -160,10 +133,6 @@ impl PacketWrite for SText {
|
|||||||
let category = self.get_category();
|
let category = self.get_category();
|
||||||
category.write(writer)?;
|
category.write(writer)?;
|
||||||
|
|
||||||
for &dummy in Self::get_dummy_strings(category) {
|
|
||||||
dummy.to_string().write(writer)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.r#type.write(writer)?;
|
self.r#type.write(writer)?;
|
||||||
|
|
||||||
match self.r#type {
|
match self.r#type {
|
||||||
|
|||||||
@ -26,8 +26,8 @@ pub type BlockStateId = u16;
|
|||||||
|
|
||||||
pub const CURRENT_MC_VERSION: &str = "1.21.11";
|
pub const CURRENT_MC_VERSION: &str = "1.21.11";
|
||||||
|
|
||||||
pub const CURRENT_BEDROCK_MC_VERSION: &str = "1.21.132";
|
pub const CURRENT_BEDROCK_MC_VERSION: &str = "1.26";
|
||||||
pub const CURRENT_BEDROCK_MC_PROTOCOL: u32 = 898;
|
pub const CURRENT_BEDROCK_MC_PROTOCOL: u32 = 924;
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! global_path {
|
macro_rules! global_path {
|
||||||
|
|||||||
@ -62,7 +62,7 @@ use pumpkin_protocol::bedrock::client::set_actor_data::{
|
|||||||
CSetActorData, EntityMetadata, MetadataValue, PropertySyncData, entity_data_flag,
|
CSetActorData, EntityMetadata, MetadataValue, PropertySyncData, entity_data_flag,
|
||||||
entity_data_key,
|
entity_data_key,
|
||||||
};
|
};
|
||||||
use pumpkin_protocol::bedrock::client::start_game::CStartGame;
|
use pumpkin_protocol::bedrock::client::start_game::{CStartGame, ServerTelemetryData};
|
||||||
use pumpkin_protocol::bedrock::frame_set::FrameSet;
|
use pumpkin_protocol::bedrock::frame_set::FrameSet;
|
||||||
use pumpkin_protocol::java::client::play::CPlayerSpawnPosition;
|
use pumpkin_protocol::java::client::play::CPlayerSpawnPosition;
|
||||||
use pumpkin_protocol::java::client::play::{CSetEntityMetadata, Metadata};
|
use pumpkin_protocol::java::client::play::{CSetEntityMetadata, Metadata};
|
||||||
@ -1385,10 +1385,6 @@ impl World {
|
|||||||
override_force_experimental_gameplay_has_value: false,
|
override_force_experimental_gameplay_has_value: false,
|
||||||
chat_restriction_level: 0,
|
chat_restriction_level: 0,
|
||||||
disable_player_interactions: false,
|
disable_player_interactions: false,
|
||||||
server_id: String::new(),
|
|
||||||
world_id: String::new(),
|
|
||||||
scenario_id: String::new(),
|
|
||||||
owner_id: String::new(),
|
|
||||||
};
|
};
|
||||||
drop(level_info);
|
drop(level_info);
|
||||||
drop(weather);
|
drop(weather);
|
||||||
@ -1430,6 +1426,13 @@ impl World {
|
|||||||
enable_clientside_generation: false,
|
enable_clientside_generation: false,
|
||||||
blocknetwork_ids_are_hashed: false,
|
blocknetwork_ids_are_hashed: false,
|
||||||
server_auth_sounds: false,
|
server_auth_sounds: false,
|
||||||
|
server_join_information: None,
|
||||||
|
telemetry: ServerTelemetryData {
|
||||||
|
server_id: String::new(),
|
||||||
|
scenario_id: String::new(),
|
||||||
|
world_id: String::new(),
|
||||||
|
owner_id: String::new(),
|
||||||
|
},
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
chunker::update_position(&player).await;
|
chunker::update_position(&player).await;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user