mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
InventoryManager: give more detailed information on failure to get info for held item
This commit is contained in:
parent
3ee62d8440
commit
af385668c2
@ -576,9 +576,13 @@ class InventoryManager{
|
||||
$playerInventory = $this->player->getInventory();
|
||||
$selected = $playerInventory->getHeldItemIndex();
|
||||
if($selected !== $this->clientSelectedHotbarSlot){
|
||||
$itemStackInfo = $this->getItemStackInfo($playerInventory, $selected);
|
||||
$inventoryEntry = $this->inventories[spl_object_id($playerInventory)] ?? null;
|
||||
if($inventoryEntry === null){
|
||||
throw new AssumptionFailedError("Player inventory should always be tracked");
|
||||
}
|
||||
$itemStackInfo = $inventoryEntry->itemStackInfos[$selected] ?? null;
|
||||
if($itemStackInfo === null){
|
||||
throw new AssumptionFailedError("Player inventory slots should always be tracked");
|
||||
throw new AssumptionFailedError("Untracked player inventory slot $selected");
|
||||
}
|
||||
|
||||
$this->session->sendDataPacket(MobEquipmentPacket::create(
|
||||
|
Loading…
x
Reference in New Issue
Block a user