mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-30 07:09:56 +00:00
Fixed invalid fix for block updates that corrupted state
This commit is contained in:
parent
d429992f5b
commit
f91a3a2666
@ -52,8 +52,6 @@ class Explosion{
|
|||||||
* @var Block[]
|
* @var Block[]
|
||||||
*/
|
*/
|
||||||
public $affectedBlocks = [];
|
public $affectedBlocks = [];
|
||||||
/** @var bool[] */
|
|
||||||
public $updatedHashes = [];
|
|
||||||
public $stepLen = 0.3;
|
public $stepLen = 0.3;
|
||||||
/** @var Entity|Block */
|
/** @var Entity|Block */
|
||||||
private $what;
|
private $what;
|
||||||
@ -133,6 +131,8 @@ class Explosion{
|
|||||||
|
|
||||||
public function explodeB(){
|
public function explodeB(){
|
||||||
$send = [];
|
$send = [];
|
||||||
|
$updateBlocks = [];
|
||||||
|
|
||||||
$source = (new Vector3($this->source->x, $this->source->y, $this->source->z))->floor();
|
$source = (new Vector3($this->source->x, $this->source->y, $this->source->z))->floor();
|
||||||
$yield = (1 / $this->size) * 100;
|
$yield = (1 / $this->size) * 100;
|
||||||
|
|
||||||
@ -209,19 +209,24 @@ class Explosion{
|
|||||||
$this->level->dropItem($block->add(0.5, 0.5, 0.5), Item::get(...$drop));
|
$this->level->dropItem($block->add(0.5, 0.5, 0.5), Item::get(...$drop));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->level->setBlockIdAt($block->x, $block->y, $block->z, 0);
|
$this->level->setBlockIdAt($block->x, $block->y, $block->z, 0);
|
||||||
for($side = 0; $side <= 6; $side++){
|
|
||||||
$sideBlock = $block->getSide($side);
|
$pos = new Vector3($block->x, $block->y, $block->z);
|
||||||
if($sideBlock instanceof Block and !isset($this->affectedBlocks[$index = Level::blockHash($sideBlock->x, $sideBlock->y, $sideBlock->z)]) and !isset($this->updatedHashes[$index])){
|
|
||||||
$this->updatedHashes[$index] = true;
|
for($side = 0; $side < 5; $side++){
|
||||||
$this->level->getServer()->getPluginManager()->callEvent($ev = new BlockUpdateEvent($sideBlock));
|
$sideBlock = $pos->getSide($side);
|
||||||
|
if(!isset($this->affectedBlocks[$index = Level::blockHash($sideBlock->x, $sideBlock->y, $sideBlock->z)]) and !isset($updateBlocks[$index])){
|
||||||
|
$this->level->getServer()->getPluginManager()->callEvent($ev = new BlockUpdateEvent($this->level->getBlock($sideBlock)));
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
$ev->getBlock()->onUpdate(Level::BLOCK_UPDATE_NORMAL);
|
$ev->getBlock()->onUpdate(Level::BLOCK_UPDATE_NORMAL);
|
||||||
}
|
}
|
||||||
|
$updateBlocks[$index] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$send[] = new Vector3($block->x - $source->x, $block->y - $source->y, $block->z - $source->z);
|
$send[] = new Vector3($block->x - $source->x, $block->y - $source->y, $block->z - $source->z);
|
||||||
}
|
}
|
||||||
|
|
||||||
$pk = new ExplodePacket();
|
$pk = new ExplodePacket();
|
||||||
$pk->x = $this->source->x;
|
$pk->x = $this->source->x;
|
||||||
$pk->y = $this->source->y;
|
$pk->y = $this->source->y;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user