mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 17:59:41 +00:00
Signed-off-by: Michael Yoo <michael@yoo.id.au>
This commit is contained in:
parent
76c27fc18b
commit
d429992f5b
@ -27,6 +27,7 @@ use pocketmine\event\entity\EntityDamageByBlockEvent;
|
|||||||
use pocketmine\event\entity\EntityDamageByEntityEvent;
|
use pocketmine\event\entity\EntityDamageByEntityEvent;
|
||||||
use pocketmine\event\entity\EntityDamageEvent;
|
use pocketmine\event\entity\EntityDamageEvent;
|
||||||
use pocketmine\event\entity\EntityExplodeEvent;
|
use pocketmine\event\entity\EntityExplodeEvent;
|
||||||
|
use pocketmine\event\block\BlockUpdateEvent;
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
use pocketmine\math\AxisAlignedBB;
|
use pocketmine\math\AxisAlignedBB;
|
||||||
use pocketmine\math\Math;
|
use pocketmine\math\Math;
|
||||||
@ -51,6 +52,8 @@ 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;
|
||||||
@ -207,6 +210,16 @@ class Explosion{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$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);
|
||||||
|
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;
|
||||||
|
$this->level->getServer()->getPluginManager()->callEvent($ev = new BlockUpdateEvent($sideBlock));
|
||||||
|
if(!$ev->isCancelled()){
|
||||||
|
$ev->getBlock()->onUpdate(Level::BLOCK_UPDATE_NORMAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$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();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user