mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
add method to set container property
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use pumpkin_core::text::TextComponent;
|
||||
use pumpkin_inventory::window_property::{WindowProperty, WindowPropertyTrait};
|
||||
use pumpkin_inventory::WindowType;
|
||||
use pumpkin_protocol::client::play::{CCloseContainer, COpenScreen, CSetContainerContent, CSetContainerSlot};
|
||||
use pumpkin_protocol::client::play::{CCloseContainer, COpenScreen, CSetContainerContent, CSetContainerProperty, CSetContainerSlot};
|
||||
use pumpkin_protocol::slot::Slot;
|
||||
use pumpkin_world::item::Item;
|
||||
|
||||
@@ -90,4 +91,9 @@ impl super::Client {
|
||||
) {
|
||||
self.send_packet(&CCloseContainer::new(window_type as u8))
|
||||
}
|
||||
|
||||
pub fn set_container_property<T: WindowPropertyTrait>(&mut self, window_type: WindowType, window_property: WindowProperty<T>) {
|
||||
let (id,value) = window_property.into_packet();
|
||||
self.send_packet(&CSetContainerProperty::new(window_type as u8,id,value));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user