added PunchBlockParticle, encapsulate more network logic

This commit is contained in:
Dylan K. Taylor
2019-05-09 15:40:58 +01:00
parent 51a8c2be9d
commit 5eb3c52a37
2 changed files with 50 additions and 5 deletions

View File

@ -113,6 +113,7 @@ use pocketmine\utils\UUID;
use pocketmine\world\ChunkListener;
use pocketmine\world\ChunkLoader;
use pocketmine\world\format\Chunk;
use pocketmine\world\particle\PunchBlockParticle;
use pocketmine\world\Position;
use pocketmine\world\World;
use function abs;
@ -1932,11 +1933,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
public function continueBreakBlock(Vector3 $pos, int $face) : void{
$block = $this->world->getBlock($pos);
$this->world->broadcastLevelEvent(
$pos,
LevelEventPacket::EVENT_PARTICLE_PUNCH_BLOCK,
$block->getRuntimeId() | ($face << 24)
);
$this->world->addParticle($pos, new PunchBlockParticle($block, $face));
//TODO: destroy-progress level event
}