fix lints
This commit is contained in:
3 files changed
+15
-23
No files matched your search
@@ -1,5 +1,4 @@
|
|||||||
use crate::container_click::MouseClick;
|
use crate::{Container, WindowType};
|
||||||
use crate::{handle_item_change, Container, WindowType};
|
|
||||||
use pumpkin_world::item::ItemStack;
|
use pumpkin_world::item::ItemStack;
|
||||||
use std::sync::{Mutex, MutexGuard};
|
use std::sync::{Mutex, MutexGuard};
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
use num_traits::FromPrimitive;
|
use num_traits::FromPrimitive;
|
||||||
use pumpkin_core::text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
use pumpkin_inventory::container_click::{KeyClick, MouseClick};
|
use pumpkin_inventory::container_click::{KeyClick, MouseClick};
|
||||||
use pumpkin_inventory::player::PlayerInventory;
|
|
||||||
use pumpkin_inventory::window_property::{WindowProperty, WindowPropertyTrait};
|
use pumpkin_inventory::window_property::{WindowProperty, WindowPropertyTrait};
|
||||||
use pumpkin_inventory::{
|
use pumpkin_inventory::{container_click, handle_item_change, OptionallyCombinedContainer};
|
||||||
container_click, handle_item_change, ContainerStruct, OptionallyCombinedContainer,
|
|
||||||
};
|
|
||||||
use pumpkin_inventory::{Container, WindowType};
|
use pumpkin_inventory::{Container, WindowType};
|
||||||
use pumpkin_protocol::client::play::{
|
use pumpkin_protocol::client::play::{
|
||||||
CCloseContainer, COpenScreen, CSetContainerContent, CSetContainerProperty, CSetContainerSlot,
|
CCloseContainer, COpenScreen, CSetContainerContent, CSetContainerProperty, CSetContainerSlot,
|
||||||
@@ -37,7 +34,7 @@ impl Player {
|
|||||||
.into();
|
.into();
|
||||||
let title = TextComponent::text(window_title.unwrap_or(window_type.default_title()));
|
let title = TextComponent::text(window_title.unwrap_or(window_type.default_title()));
|
||||||
self.client.send_packet(&COpenScreen::new(
|
self.client.send_packet(&COpenScreen::new(
|
||||||
(window_type.clone() as u8 + 1).into(),
|
(*window_type as u8 + 1).into(),
|
||||||
menu_protocol_id,
|
menu_protocol_id,
|
||||||
title,
|
title,
|
||||||
));
|
));
|
||||||
@@ -113,7 +110,7 @@ impl Player {
|
|||||||
pub fn handle_click_container(&mut self, server: &mut Server, packet: SClickContainer) {
|
pub fn handle_click_container(&mut self, server: &mut Server, packet: SClickContainer) {
|
||||||
use container_click::*;
|
use container_click::*;
|
||||||
let mut opened_container = if let Some(id) = self.open_container {
|
let mut opened_container = if let Some(id) = self.open_container {
|
||||||
server.try_get_container(self.entity_id(), self.open_container.unwrap())
|
server.try_get_container(self.entity_id(), id)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
@@ -168,24 +165,21 @@ impl Player {
|
|||||||
self.creative_pick_item(opened_container, slot)
|
self.creative_pick_item(opened_container, slot)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ClickType::DoubleClick => {}
|
ClickType::DoubleClick => {
|
||||||
|
if let container_click::Slot::Normal(slot) = click.mode.slot {
|
||||||
|
self.double_click(slot)
|
||||||
|
}
|
||||||
|
}
|
||||||
ClickType::MouseDrag {
|
ClickType::MouseDrag {
|
||||||
drag_state,
|
drag_state: _,
|
||||||
drag_type,
|
drag_type: _,
|
||||||
} => {
|
} => {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
ClickType::DropType(drop_type) => {
|
ClickType::DropType(_drop_type) => {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let filled_inventory_slots = self
|
|
||||||
.inventory
|
|
||||||
.slots()
|
|
||||||
.into_iter()
|
|
||||||
.enumerate()
|
|
||||||
.filter_map(|(slot, item)| item.map(|item| (slot, item.item_count)))
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mouse_click(
|
fn mouse_click(
|
||||||
@@ -214,7 +208,7 @@ impl Player {
|
|||||||
window_type: WindowType,
|
window_type: WindowType,
|
||||||
slot: container_click::Slot,
|
slot: container_click::Slot,
|
||||||
) {
|
) {
|
||||||
let mut container = OptionallyCombinedContainer::new(&mut self.inventory, opened_container);
|
let container = OptionallyCombinedContainer::new(&mut self.inventory, opened_container);
|
||||||
if container.window_type() != &window_type {
|
if container.window_type() != &window_type {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -279,7 +273,7 @@ impl Player {
|
|||||||
|
|
||||||
fn creative_pick_item(
|
fn creative_pick_item(
|
||||||
&mut self,
|
&mut self,
|
||||||
mut opened_container: Option<&mut Box<dyn Container>>,
|
opened_container: Option<&mut Box<dyn Container>>,
|
||||||
slot: usize,
|
slot: usize,
|
||||||
) {
|
) {
|
||||||
let mut container = OptionallyCombinedContainer::new(&mut self.inventory, opened_container);
|
let mut container = OptionallyCombinedContainer::new(&mut self.inventory, opened_container);
|
||||||
@@ -288,5 +282,5 @@ impl Player {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn double_click(&mut self, slot: usize) {}
|
fn double_click(&mut self, _slot: usize) {}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,6 @@ use num_traits::ToPrimitive;
|
|||||||
use pumpkin_core::text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
use pumpkin_entity::{entity_type::EntityType, pose::EntityPose, Entity, EntityId};
|
use pumpkin_entity::{entity_type::EntityType, pose::EntityPose, Entity, EntityId};
|
||||||
use pumpkin_inventory::player::PlayerInventory;
|
use pumpkin_inventory::player::PlayerInventory;
|
||||||
use pumpkin_inventory::Container;
|
|
||||||
use pumpkin_protocol::{
|
use pumpkin_protocol::{
|
||||||
bytebuf::{packet_id::Packet, DeserializerError},
|
bytebuf::{packet_id::Packet, DeserializerError},
|
||||||
client::play::{
|
client::play::{
|
||||||
|
|||||||
Reference in new issue
Block a user