feat(client)!: replace score with experience

This commit is contained in:
2026-04-13 00:32:17 -04:00
parent 63cfc7c9c0
commit 04bfd733b1
2 changed files with 11 additions and 8 deletions

View File

@@ -40,6 +40,7 @@ impl UserData for Client {
f.add_field_method_get("container", container::container); f.add_field_method_get("container", container::container);
f.add_field_method_get("dimension", world::dimension); f.add_field_method_get("dimension", world::dimension);
f.add_field_method_get("direction", movement::direction); 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("eye_position", movement::eye_position);
f.add_field_method_get("go_to_reached", movement::go_to_reached); f.add_field_method_get("go_to_reached", movement::go_to_reached);
f.add_field_method_get("has_attack_cooldown", interaction::has_attack_cooldown); 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("menu", container::menu);
f.add_field_method_get("pathfinder", movement::pathfinder); f.add_field_method_get("pathfinder", movement::pathfinder);
f.add_field_method_get("position", movement::position); 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("tab_list", tab_list);
f.add_field_method_get("username", username); f.add_field_method_get("username", username);
f.add_field_method_get("uuid", uuid); f.add_field_method_get("uuid", uuid);

View File

@@ -1,7 +1,5 @@
use azalea::{ use azalea::{
ClientInformation, ClientInformation, entity::metadata::AirSupply, pathfinder::debug::PathfinderDebugParticles,
entity::metadata::{AirSupply, Score},
pathfinder::debug::PathfinderDebugParticles,
protocol::common::client_information::ModelCustomization, protocol::common::client_information::ModelCustomization,
}; };
use azalea_hax::AntiKnockback; use azalea_hax::AntiKnockback;
@@ -13,6 +11,15 @@ pub fn air_supply(_lua: &Lua, client: &Client) -> Result<i32> {
Ok(client.component::<AirSupply>().0) Ok(client.component::<AirSupply>().0)
} }
pub fn experience(lua: &Lua, client: &Client) -> Result<Table> {
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<f32> { pub fn health(_lua: &Lua, client: &Client) -> Result<f32> {
Ok(client.health()) Ok(client.health())
} }
@@ -25,10 +32,6 @@ pub fn hunger(lua: &Lua, client: &Client) -> Result<Table> {
Ok(table) Ok(table)
} }
pub fn score(_lua: &Lua, client: &Client) -> Result<i32> {
Ok(client.component::<Score>().0)
}
pub async fn set_client_information( pub async fn set_client_information(
_lua: Lua, _lua: Lua,
client: UserDataRef<Client>, client: UserDataRef<Client>,