Level: fixed blocks not dropping when not broken by player

closes #2172
This commit is contained in:
Dylan K. Taylor 2018-05-05 21:50:28 +01:00
parent f497e43db3
commit 197102ca3d

View File

@ -1666,10 +1666,12 @@ class Level implements ChunkManager, Metadatable{
}
$drops = [];
$xpDrop = 0;
if($player !== null and !$player->isCreative()){
if($player === null or !$player->isCreative()){
$drops = array_merge(...array_map(function(Block $block) use ($item) : array{ return $block->getDrops($item); }, $affectedBlocks));
}
$xpDrop = 0;
if($player !== null and !$player->isCreative()){
$xpDrop = array_sum(array_map(function(Block $block) use ($item) : int{ return $block->getXpDropForTool($item); }, $affectedBlocks));
}