Skip to content

Commit

Permalink
fmt & clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
suprohub committed Dec 31, 2024
1 parent 0a503a0 commit acfe4c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions pumpkin/src/entity/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ use pumpkin_world::{
ItemStack,
},
};
use tokio::{sync::{Mutex, Notify, RwLock}, task::JoinHandle};
use tokio::{
sync::{Mutex, Notify, RwLock},
task::JoinHandle,
};

use super::Entity;
use crate::{
Expand Down Expand Up @@ -555,7 +558,8 @@ impl Player {

pub async fn set_health(&self, health: f32, food: u32, food_saturation: f32) {
self.living_entity.set_health(health.min(20.0)).await;
self.food.store(food.min(20), std::sync::atomic::Ordering::Relaxed);
self.food
.store(food.min(20), std::sync::atomic::Ordering::Relaxed);
self.food_saturation.store(food_saturation.min(20.0));
self.client
.send_packet(&CSetHealth::new(health, food.into(), food_saturation))
Expand Down
6 changes: 3 additions & 3 deletions pumpkin/src/net/packet/play.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use pumpkin_entity::entity_type::EntityType;
use pumpkin_inventory::player::PlayerInventory;
use pumpkin_inventory::InventoryError;
use pumpkin_protocol::client::play::{
CEntityStatus, CSetContainerSlot, CSetEntityMetadata, CSetHeldItem, CSpawnEntity, Metadata,
CEntityStatus, CSetContainerSlot, CSetHeldItem, CSpawnEntity,
};
use pumpkin_protocol::codec::slot::Slot;
use pumpkin_protocol::codec::var_int::VarInt;
Expand Down Expand Up @@ -923,13 +923,13 @@ impl Player {
let player = self.clone();

*self.eating.lock().await = Some(tokio::spawn(async move {
sleep(Duration::from_millis(1600)).await;
sleep(Duration::from_millis(1610)).await;

player
.client
.send_packet(&CEntityStatus::new(player.entity_id(), 9))
.await;

player
.set_health(
player.living_entity.health.load(),
Expand Down

0 comments on commit acfe4c2

Please sign in to comment.