mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-18 12:04:46 +00:00
box up TakeItemActorPacket sending behind NetworkSession API
we need to start thinking about moving this into interfaces.
This commit is contained in:
@@ -31,7 +31,6 @@ use pocketmine\item\Item;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\network\mcpe\convert\TypeConverter;
|
||||
use pocketmine\network\mcpe\protocol\AddItemActorPacket;
|
||||
use pocketmine\network\mcpe\protocol\TakeItemActorPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\entity\EntityLegacyIds;
|
||||
use pocketmine\player\Player;
|
||||
use function get_class;
|
||||
@@ -235,7 +234,9 @@ class ItemEntity extends Entity{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->server->broadcastPackets($this->getViewers(), [TakeItemActorPacket::create($player->getId(), $this->getId())]);
|
||||
foreach($this->getViewers() as $viewer){
|
||||
$viewer->getNetworkSession()->onPlayerPickUpItem($player, $this);
|
||||
}
|
||||
|
||||
$playerInventory->addItem(clone $item);
|
||||
$this->flagForDespawn();
|
||||
|
@@ -31,7 +31,6 @@ use pocketmine\item\VanillaItems;
|
||||
use pocketmine\math\RayTraceResult;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\network\mcpe\protocol\ActorEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\TakeItemActorPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\entity\EntityLegacyIds;
|
||||
use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataFlags;
|
||||
use pocketmine\player\Player;
|
||||
@@ -185,7 +184,9 @@ class Arrow extends Projectile{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->server->broadcastPackets($this->getViewers(), [TakeItemActorPacket::create($player->getId(), $this->getId())]);
|
||||
foreach($this->getViewers() as $viewer){
|
||||
$viewer->getNetworkSession()->onPlayerPickUpItem($player, $this);
|
||||
}
|
||||
|
||||
$playerInventory->addItem(clone $item);
|
||||
$this->flagForDespawn();
|
||||
|
Reference in New Issue
Block a user