feat(client)!: replace score with experience
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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<i32> {
|
||||
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> {
|
||||
Ok(client.health())
|
||||
}
|
||||
@@ -25,10 +32,6 @@ pub fn hunger(lua: &Lua, client: &Client) -> Result<Table> {
|
||||
Ok(table)
|
||||
}
|
||||
|
||||
pub fn score(_lua: &Lua, client: &Client) -> Result<i32> {
|
||||
Ok(client.component::<Score>().0)
|
||||
}
|
||||
|
||||
pub async fn set_client_information(
|
||||
_lua: Lua,
|
||||
client: UserDataRef<Client>,
|
||||
|
||||
Reference in New Issue
Block a user