I've done setting the index to the hotbar slot with setHotbarSlotIndex();. Now it doesn't wanna update it for me. The hotbar looks the same on the client, like client-side doesn't receive the hotbar change. Using PMMP mcpe-1.0, MCPE version. Just to make sure if I missed something.
Inventory is very buggy currently, it is due for a rewrite, but I'm waiting to see what @shoghicp comes up with for vanilla before I mess with PocketMine. I ought to warn that setHotbarSlotIndex() will be removed in the future due to bugs that it causes with desktop GUI. It has already been deprecated in some spoons.
Really ? You normally don't need this function. The first 9 Items in the Inventory will be displayed on the hotbar This works for me PHP: $inventory = $player->getInventory();$inventory->setItem(0, new Item(345, 0, 1));$inventory->setItem(8, new Item(331, 0, 1));$inventory->sendContents($player); //You may not need this
Try PHP: $player->getInventory()->getItemInHand($item); I'm not sure about the other slots. I guess it's PHP: $p->getInventory()->addItem(8, $item); Please define $item
I mean really, if i was joined the server already and try to mess with the hotbar for awhile (Matching hotbar index 0 to inventory index 4 for instance), then if I set the inventory index 0 with an item, it doesn't show up at hotbar index 0. Even if you quit the game and join again, the hotbar pair with the inventory is the same, doesn't seem to be reset.