hotbar is full of air in spectator mode now

This commit is contained in:
GameHerobrine 2025-07-16 14:41:27 +03:00
parent 77a896b18c
commit fc2e104c41

View file

@ -1535,7 +1535,7 @@ class Player{
} }
if($this->sendingInventoryRequired){ if($this->sendingInventoryRequired){
if(($this->gamemode & 0x01) !== CREATIVE){ if($this->gamemode !== CREATIVE){
$hotbar = []; $hotbar = [];
foreach($this->hotbar as $slot){ foreach($this->hotbar as $slot){
$hotbar[] = $slot <= -1 ? -1 : $slot + 9; $hotbar[] = $slot <= -1 ? -1 : $slot + 9;
@ -2381,6 +2381,11 @@ class Player{
$data["slot"] = $packet->slot; $data["slot"] = $packet->slot;
if($this->gamemode == VIEW && $packet->item != AIR){
$this->sendInventory();
break;
}
if($this->server->handle("player.equipment.change", $data) !== false){ if($this->server->handle("player.equipment.change", $data) !== false){
if(!Player::$experimentalHotbar) $this->slot = $packet->slot; if(!Player::$experimentalHotbar) $this->slot = $packet->slot;
if(($this->gamemode & 0x01) === SURVIVAL){ if(($this->gamemode & 0x01) === SURVIVAL){