Add flint-steel light sound, close #1434

This commit is contained in:
Dylan K. Taylor 2017-10-03 19:39:01 +01:00
parent fc9c264e77
commit 4dfd171af0

View File

@ -28,6 +28,7 @@ use pocketmine\block\BlockFactory;
use pocketmine\block\Solid;
use pocketmine\level\Level;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
use pocketmine\Player;
class FlintSteel extends Tool{
@ -38,6 +39,8 @@ class FlintSteel extends Tool{
public function onActivate(Level $level, Player $player, Block $block, Block $target, int $face, Vector3 $facePos) : bool{
if($block->getId() === self::AIR and ($target instanceof Solid)){
$level->setBlock($block, BlockFactory::get(Block::FIRE), true);
$level->broadcastLevelSoundEvent($block->add(0.5, 0.5, 0.5), LevelSoundEventPacket::SOUND_IGNITE);
if(($player->gamemode & 0x01) === 0 and $this->useOn($block)){
if($this->getDamage() >= $this->getMaxDurability()){
$player->getInventory()->setItemInHand(Item::get(Item::AIR, 0, 0));