mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 02:42:58 +00:00
This now removes the need for recursing around for structures comprised of multiple blocks. Instead, override getAffectedBlocks() to return all blocks that need to be deleted when the current block is deleted, and make sure that only one half of the block drops something. When a player breaks one of the blocks, all the blocks affected by that block will also be destroyed, creating particles and sounds where appropriate. This fixes creative drops for double plants and beds.
This commit is contained in:
@ -45,16 +45,20 @@ class BlockBreakEvent extends BlockEvent implements Cancellable{
|
||||
/** @var Item[] */
|
||||
protected $blockDrops = [];
|
||||
|
||||
public function __construct(Player $player, Block $block, Item $item, bool $instaBreak = false){
|
||||
/**
|
||||
* @param Player $player
|
||||
* @param Block $block
|
||||
* @param Item $item
|
||||
* @param bool $instaBreak
|
||||
* @param Item[] $drops
|
||||
*/
|
||||
public function __construct(Player $player, Block $block, Item $item, bool $instaBreak = false, array $drops){
|
||||
parent::__construct($block);
|
||||
$this->item = $item;
|
||||
$this->player = $player;
|
||||
|
||||
$this->instaBreak = $instaBreak;
|
||||
|
||||
if($player->isSurvival()){
|
||||
$this->setDrops($block->getDrops($item));
|
||||
}
|
||||
$this->setDrops($drops);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user