fix issues

This commit is contained in:
Edvin Bryntesson
2024-08-24 18:09:13 +02:00
parent 67dd35e0cb
commit bae9198980
3 changed files with 5 additions and 4 deletions

View File

@@ -88,7 +88,8 @@ impl Player {
/// The official Minecraft client is weird, and will always just close *any* window that is opened when this gets sent
pub fn close_container(&mut self, window_type: WindowType) {
self.send_packet(&CCloseContainer::new(window_type as u8))
self.client
.send_packet(&CCloseContainer::new(window_type as u8))
}
pub fn set_container_property<T: WindowPropertyTrait>(
@@ -97,6 +98,7 @@ impl Player {
window_property: WindowProperty<T>,
) {
let (id, value) = window_property.into_packet();
self.send_packet(&CSetContainerProperty::new(window_type as u8, id, value));
self.client
.send_packet(&CSetContainerProperty::new(window_type as u8, id, value));
}
}

View File

@@ -228,7 +228,6 @@ impl Client {
}
}
// Reads the connection until our buffer of len 4096 is full, then decode
/// Close connection when an error occurs
pub async fn poll(&mut self, event: &Event) {

View File

@@ -415,7 +415,7 @@ impl Player {
pub fn handle_close_container(&mut self, _server: &mut Server, packet: SCloseContainer) {
// window_id 0 represents both 9x1 Generic AND inventory here
let Some(_window_type) = WindowType::from_u8(packet.window_id) else {
self.kick("Invalid window ID");
self.kick(TextComponent::text("Invalid window ID"));
return;
};
}