refactor: random fixes and usage improvements

This commit is contained in:
2025-02-17 17:01:23 -05:00
parent 8f2fbf11da
commit dde489a8ed
15 changed files with 203 additions and 90 deletions

View File

@@ -6,6 +6,15 @@ use azalea::{
use log::error;
use mlua::{Lua, Result, UserDataRef};
pub fn container(_lua: &Lua, client: &Client) -> Result<Option<ContainerRef>> {
Ok(client
.inner
.as_ref()
.unwrap()
.get_open_container()
.map(|c| ContainerRef { inner: c }))
}
pub fn held_item(_lua: &Lua, client: &Client) -> Result<ItemStack> {
Ok(ItemStack {
inner: client
@@ -26,15 +35,6 @@ pub fn held_slot(_lua: &Lua, client: &Client) -> Result<u8> {
.selected_hotbar_slot)
}
pub fn open_container(_lua: &Lua, client: &Client) -> Result<Option<ContainerRef>> {
Ok(client
.inner
.as_ref()
.unwrap()
.get_open_container()
.map(|c| ContainerRef { inner: c }))
}
pub async fn open_container_at(
_lua: Lua,
client: UserDataRef<Client>,