diff options
| author | Luuk van Oijen <lazyluuk.channel@gmail.com> | 2023-08-22 05:50:21 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-21 22:50:21 -0500 |
| commit | a81c4c060b9a32d1dccf451158750fac52349acc (patch) | |
| tree | fc0760495c1197b0e6ef1c743ebcc0f2edb766ae /azalea-client/src/client.rs | |
| parent | 1b6e0244606cf7917e68918d32928550aabf85b0 (diff) | |
| download | azalea-drasl-a81c4c060b9a32d1dccf451158750fac52349acc.tar.xz | |
Food/saturation component support (#97)
* modified for food stuff
* moved food/saturation to a separate file
* hunger component
* simplify some logic
---------
Co-authored-by: mat <git@matdoes.dev>
Diffstat (limited to 'azalea-client/src/client.rs')
| -rw-r--r-- | azalea-client/src/client.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index a7cceaed..e2ca6c4e 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -7,7 +7,7 @@ use crate::{ inventory::{InventoryComponent, InventoryPlugin}, local_player::{ death_event, handle_send_packet_event, update_in_loaded_chunk, GameProfileComponent, - LocalPlayer, PhysicsState, SendPacketEvent, + Hunger, LocalPlayer, PhysicsState, SendPacketEvent, }, mining::{self, MinePlugin}, movement::{LastSentLookDirection, PlayerMovePlugin}, @@ -565,6 +565,14 @@ impl Client { pub fn health(&self) -> f32 { *self.component::<Health>() } + + /// Get the hunger level of this client, which includes both food and + /// saturation. + /// + /// This is a shortcut for `self.component::<Hunger>().to_owned()`. + pub fn hunger(&self) -> Hunger { + self.component::<Hunger>().to_owned() + } } /// A bundle for the components that are present on a local player that received |
