diff --git a/src/lua/client/mod.rs b/src/lua/client/mod.rs index 7988bb1..48adea7 100644 --- a/src/lua/client/mod.rs +++ b/src/lua/client/mod.rs @@ -40,6 +40,7 @@ impl UserData for Client { f.add_field_method_get("container", container::container); f.add_field_method_get("dimension", world::dimension); f.add_field_method_get("direction", movement::direction); + f.add_field_method_get("experience", state::experience); f.add_field_method_get("eye_position", movement::eye_position); f.add_field_method_get("go_to_reached", movement::go_to_reached); f.add_field_method_get("has_attack_cooldown", interaction::has_attack_cooldown); @@ -52,7 +53,6 @@ impl UserData for Client { f.add_field_method_get("menu", container::menu); f.add_field_method_get("pathfinder", movement::pathfinder); f.add_field_method_get("position", movement::position); - f.add_field_method_get("score", state::score); f.add_field_method_get("tab_list", tab_list); f.add_field_method_get("username", username); f.add_field_method_get("uuid", uuid); diff --git a/src/lua/client/state.rs b/src/lua/client/state.rs index eb5318e..8054432 100644 --- a/src/lua/client/state.rs +++ b/src/lua/client/state.rs @@ -1,7 +1,5 @@ use azalea::{ - ClientInformation, - entity::metadata::{AirSupply, Score}, - pathfinder::debug::PathfinderDebugParticles, + ClientInformation, entity::metadata::AirSupply, pathfinder::debug::PathfinderDebugParticles, protocol::common::client_information::ModelCustomization, }; use azalea_hax::AntiKnockback; @@ -13,6 +11,15 @@ pub fn air_supply(_lua: &Lua, client: &Client) -> Result { Ok(client.component::().0) } +pub fn experience(lua: &Lua, client: &Client) -> Result { + let experience = client.experience(); + let table = lua.create_table()?; + table.set("progress", experience.progress)?; + table.set("total", experience.total)?; + table.set("level", experience.level)?; + Ok(table) +} + pub fn health(_lua: &Lua, client: &Client) -> Result { Ok(client.health()) } @@ -25,10 +32,6 @@ pub fn hunger(lua: &Lua, client: &Client) -> Result
{ Ok(table) } -pub fn score(_lua: &Lua, client: &Client) -> Result { - Ok(client.component::().0) -} - pub async fn set_client_information( _lua: Lua, client: UserDataRef,