Prepare ChatType registry

This commit is contained in:
Snowiiii committed 2024-08-11 17:55:41 +02:00
1 parent 41442c5b5d
commit 5b636111e4
10 files changed
+99 -46

No files matched your search

+3 -4
View File
@@ -15,7 +15,6 @@ use pumpkin_protocol::{
},
ConnectionState, KnownPack, RawBytes,
};
use pumpkin_registry::Registry;
use pumpkin_text::TextComponent;
use rsa::Pkcs1v15Encrypt;
use sha1::{Digest, Sha1};
@@ -150,7 +149,7 @@ impl Client {
}
if let Some(profile) = self.gameprofile.as_ref().cloned() {
let packet = CLoginSuccess::new(profile.id, profile.name, &profile.properties, false);
let packet = CLoginSuccess::new(profile.id, &profile.name, &profile.properties, false);
self.send_packet(packet);
} else {
self.kick("game profile is none");
@@ -225,8 +224,8 @@ impl Client {
}
}
pub fn handle_known_packs(&mut self, _server: &mut Server, _config_acknowledged: SKnownPacks) {
for registry in Registry::get_static() {
pub fn handle_known_packs(&mut self, server: &mut Server, _config_acknowledged: SKnownPacks) {
for registry in &server.cached_registry {
self.send_packet(CRegistryData::new(
&registry.registry_id,
&registry.registry_entries,
+22 -22
View File
@@ -2,8 +2,8 @@ use num_traits::FromPrimitive;
use pumpkin_inventory::WindowType;
use pumpkin_protocol::{
client::play::{
Animation, CEntityAnimation, CHeadRot, COpenScreen, CSystemChatMessge, CUpdateEntityPos,
CUpdateEntityPosRot, CUpdateEntityRot,
Animation, CEntityAnimation, CHeadRot, COpenScreen, CPlayerChatMessage, CUpdateEntityPos,
CUpdateEntityPosRot, CUpdateEntityRot, FilterType,
},
server::play::{
SChatCommand, SChatMessage, SConfirmTeleport, SPlayerCommand, SPlayerPosition,
@@ -203,30 +203,30 @@ impl Client {
let gameprofile = self.gameprofile.as_ref().unwrap();
dbg!("got message");
// yeah a "raw system message", the ugly way to do that, but it works
// server.broadcast_packet(
// self,
// CSystemChatMessge::new(
// TextComponent::from(format!("{}: {}", gameprofile.name, message)),
// false,
// ),
// );
server.broadcast_packet(
self,
CSystemChatMessge::new(
TextComponent::from(format!("{}: {}", gameprofile.name, message)),
false,
CPlayerChatMessage::new(
gameprofile.id,
0.into(),
None,
message.clone(),
chat_message.timestamp,
chat_message.salt,
&[],
Some(TextComponent::from(message.clone())),
pumpkin_protocol::VarInt(FilterType::PassThrough as i32),
0.into(),
TextComponent::from(gameprofile.name.clone()),
None,
),
)
/*server.broadcast_packet(
self,
CPlayerChatMessage::new(
gameprofile.id,
0.into(),
None,
message.clone(),
chat_message.timestamp,
chat_message.salt,
&[],
Some(TextComponent::from(message.clone())),
pumpkin_protocol::VarInt(FilterType::PassThrough as i32),
0.into(),
TextComponent::from(gameprofile.name.clone()),
None,
),
) */
/* server.broadcast_packet(
self,
CDisguisedChatMessage::new(