mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-21 04:54:41 +00:00
InventoryManager: avoid use of PlayerHotbarPacket
it doesn't work so well when the selected slot is empty.
This commit is contained in:
parent
85ad78dda8
commit
399f9242e0
@ -36,7 +36,7 @@ use pocketmine\network\mcpe\protocol\ContainerOpenPacket;
|
|||||||
use pocketmine\network\mcpe\protocol\ContainerSetDataPacket;
|
use pocketmine\network\mcpe\protocol\ContainerSetDataPacket;
|
||||||
use pocketmine\network\mcpe\protocol\InventoryContentPacket;
|
use pocketmine\network\mcpe\protocol\InventoryContentPacket;
|
||||||
use pocketmine\network\mcpe\protocol\InventorySlotPacket;
|
use pocketmine\network\mcpe\protocol\InventorySlotPacket;
|
||||||
use pocketmine\network\mcpe\protocol\PlayerHotbarPacket;
|
use pocketmine\network\mcpe\protocol\MobEquipmentPacket;
|
||||||
use pocketmine\network\mcpe\protocol\types\inventory\ContainerIds;
|
use pocketmine\network\mcpe\protocol\types\inventory\ContainerIds;
|
||||||
use pocketmine\network\mcpe\protocol\types\inventory\WindowTypes;
|
use pocketmine\network\mcpe\protocol\types\inventory\WindowTypes;
|
||||||
use pocketmine\player\Player;
|
use pocketmine\player\Player;
|
||||||
@ -146,7 +146,12 @@ class InventoryManager{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function syncSelectedHotbarSlot() : void{
|
public function syncSelectedHotbarSlot() : void{
|
||||||
$this->session->sendDataPacket(PlayerHotbarPacket::create($this->player->getInventory()->getHeldItemIndex(), ContainerIds::INVENTORY));
|
$this->session->sendDataPacket(MobEquipmentPacket::create(
|
||||||
|
$this->player->getId(),
|
||||||
|
$this->player->getInventory()->getItemInHand(),
|
||||||
|
$this->player->getInventory()->getHeldItemIndex(),
|
||||||
|
ContainerIds::INVENTORY
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function syncCreative() : void{
|
public function syncCreative() : void{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user