Skip to content

Commit

Permalink
inventory interact
Browse files Browse the repository at this point in the history
  • Loading branch information
suprohub committed Dec 31, 2024
1 parent acfe4c2 commit 79ae392
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pumpkin/src/net/packet/play.rs
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,18 @@ impl Player {
.send_packet(&CEntityStatus::new(player.entity_id(), 9))
.await;

if player.gamemode.load() != GameMode::Creative {
let mut inventory = player.inventory().lock().await;
let item_count = &mut inventory.held_item_mut().as_mut().unwrap().item_count;
*item_count -= 1;

if *item_count == 0 {
*inventory.held_item_mut() = None;
}

drop(inventory);
}

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

0 comments on commit 79ae392

Please sign in to comment.