mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 17:29:44 +00:00
Fixed destroyblock particle duplicating on clients
This commit is contained in:
parent
f21e457dc0
commit
c882df7465
@ -368,13 +368,17 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
$this->temporalPosition = null;
|
$this->temporalPosition = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addParticle(Particle $particle){
|
public function addParticle(Particle $particle, array $players = null){
|
||||||
$pk = $particle->encode();
|
$pk = $particle->encode();
|
||||||
|
|
||||||
|
if($players === null){
|
||||||
|
$players = $this->getUsingChunk($particle->x >> 4, $particle->z >> 4);
|
||||||
|
}
|
||||||
|
|
||||||
if($pk !== null){
|
if($pk !== null){
|
||||||
if(!is_array($pk)){
|
if(!is_array($pk)){
|
||||||
Server::broadcastPacket($this->getUsingChunk($particle->x >> 4, $particle->z >> 4), $pk);
|
Server::broadcastPacket($players, $pk);
|
||||||
}else{
|
}else{
|
||||||
$players = $this->getUsingChunk($particle->x >> 4, $particle->z >> 4);
|
|
||||||
foreach($pk as $p){
|
foreach($pk as $p){
|
||||||
Server::broadcastPacket($players, $p);
|
Server::broadcastPacket($players, $p);
|
||||||
}
|
}
|
||||||
@ -1288,7 +1292,11 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
$drops = $target->getDrops($item); //Fixes tile entities being deleted before getting drops
|
$drops = $target->getDrops($item); //Fixes tile entities being deleted before getting drops
|
||||||
|
|
||||||
$this->addParticle(new DestroyBlockParticle($target->add(0.5, 0.5, 0.5), $target));
|
$players = $this->getUsingChunk($target->x >> 4, $target->z >> 4);
|
||||||
|
if($player !== null){
|
||||||
|
unset($players[$player->getId()]);
|
||||||
|
}
|
||||||
|
$this->addParticle(new DestroyBlockParticle($target->add(0.5, 0.5, 0.5), $target), $players);
|
||||||
|
|
||||||
$target->onBreak($item);
|
$target->onBreak($item);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user