Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/pm5' into pm5
Browse files Browse the repository at this point in the history
  • Loading branch information
dries-c committed Mar 27, 2024
2 parents 9bb5c55 + cd268cb commit 46790fb
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/muqsit/invmenu/type/graphic/BlockInvMenuGraphic.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@

use muqsit\invmenu\type\graphic\network\InvMenuGraphicNetworkTranslator;
use pocketmine\block\Block;
use pocketmine\block\tile\Spawnable;
use pocketmine\inventory\Inventory;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\convert\TypeConverter;
use pocketmine\network\mcpe\protocol\BlockActorDataPacket;
use pocketmine\network\mcpe\protocol\types\BlockPosition;
use pocketmine\network\mcpe\protocol\UpdateBlockPacket;
use pocketmine\player\Player;
Expand Down Expand Up @@ -45,19 +43,9 @@ public function sendInventory(Player $player, Inventory $inventory) : bool{

public function remove(Player $player) : void{
$network = $player->getNetworkSession();
$world = $player->getWorld();
$blockPosition = BlockPosition::fromVector3($this->position);
$block = $world->getBlockAt($this->position->x, $this->position->y, $this->position->z);
$network->sendDataPacket(UpdateBlockPacket::create(
$blockPosition,
$network->getTypeConverter()->getBlockTranslator()->internalIdToNetworkId($block->getStateId()),
UpdateBlockPacket::FLAG_NETWORK,
UpdateBlockPacket::DATA_LAYER_NORMAL
), true);

$tile = $world->getTileAt($this->position->x, $this->position->y, $this->position->z);
if($tile instanceof Spawnable){
$network->sendDataPacket(BlockActorDataPacket::create($blockPosition, $tile->getSerializedSpawnCompound($network->getTypeConverter())), true);
foreach($player->getWorld()->createBlockUpdatePackets($network->getTypeConverter(), [$this->position]) as $packet){
$network->sendDataPacket($packet);
}
}

Expand Down

0 comments on commit 46790fb

Please sign in to comment.