Clean up LevelSoundEvent handling

This commit is contained in:
Dylan K. Taylor
2019-03-26 19:53:40 +00:00
parent e1504c668e
commit 0aebb3f4fb
38 changed files with 693 additions and 85 deletions

View File

@@ -26,8 +26,8 @@ namespace pocketmine\item;
use pocketmine\block\Block;
use pocketmine\block\BlockFactory;
use pocketmine\block\BlockLegacyIds;
use pocketmine\level\sound\FlintSteelSound;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
use pocketmine\Player;
use function assert;
@@ -41,7 +41,7 @@ class FlintSteel extends Tool{
$level = $player->getLevel();
assert($level !== null);
$level->setBlock($blockReplace, BlockFactory::get(BlockLegacyIds::FIRE));
$level->broadcastLevelSoundEvent($blockReplace->add(0.5, 0.5, 0.5), LevelSoundEventPacket::SOUND_IGNITE);
$level->addSound($blockReplace->add(0.5, 0.5, 0.5), new FlintSteelSound());
$this->applyDamage(1);