mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Moved creative inventory sync to NetworkSession
This commit is contained in:
@ -30,6 +30,7 @@ use pocketmine\event\server\DataPacketReceiveEvent;
|
||||
use pocketmine\event\server\DataPacketSendEvent;
|
||||
use pocketmine\form\Form;
|
||||
use pocketmine\GameMode;
|
||||
use pocketmine\inventory\CreativeInventory;
|
||||
use pocketmine\inventory\Inventory;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\BadPacketException;
|
||||
@ -774,6 +775,17 @@ class NetworkSession{
|
||||
}
|
||||
}
|
||||
|
||||
public function syncCreativeInventoryContents() : void{
|
||||
$items = [];
|
||||
if(!$this->player->isSpectator()){ //fill it for all gamemodes except spectator
|
||||
foreach(CreativeInventory::getAll() as $i => $item){
|
||||
$items[$i] = clone $item;
|
||||
}
|
||||
}
|
||||
|
||||
$this->sendDataPacket(InventoryContentPacket::create(ContainerIds::CREATIVE, $items));
|
||||
}
|
||||
|
||||
public function onMobArmorChange(Living $mob) : void{
|
||||
$inv = $mob->getArmorInventory();
|
||||
$this->sendDataPacket(MobArmorEquipmentPacket::create($mob->getId(), $inv->getHelmet(), $inv->getChestplate(), $inv->getLeggings(), $inv->getBoots()));
|
||||
|
Reference in New Issue
Block a user