added fire extinguishing sound, closes #2777

This commit is contained in:
Dylan K. Taylor 2020-10-31 20:18:06 +00:00
parent f67ab094f2
commit 68f5eada32
2 changed files with 36 additions and 0 deletions

View File

@ -108,6 +108,7 @@ use pocketmine\world\format\Chunk;
use pocketmine\world\Position; use pocketmine\world\Position;
use pocketmine\world\sound\EntityAttackNoDamageSound; use pocketmine\world\sound\EntityAttackNoDamageSound;
use pocketmine\world\sound\EntityAttackSound; use pocketmine\world\sound\EntityAttackSound;
use pocketmine\world\sound\FireExtinguishSound;
use pocketmine\world\World; use pocketmine\world\World;
use function abs; use function abs;
use function assert; use function assert;
@ -1572,6 +1573,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
$block = $target->getSide($face); $block = $target->getSide($face);
if($block->getId() === BlockLegacyIds::FIRE){ if($block->getId() === BlockLegacyIds::FIRE){
$this->getWorld()->setBlock($block->getPos(), VanillaBlocks::AIR()); $this->getWorld()->setBlock($block->getPos(), VanillaBlocks::AIR());
$this->getWorld()->addSound($block->getPos()->add(0.5, 0.5, 0.5), new FireExtinguishSound());
return true; return true;
} }

View File

@ -0,0 +1,34 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\world\sound;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
final class FireExtinguishSound implements Sound{
public function encode(?Vector3 $pos) : array{
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_EXTINGUISH_FIRE, $pos)];
}
}