mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 11:45:30 +00:00
added fire extinguishing sound, closes #2777
This commit is contained in:
parent
f67ab094f2
commit
68f5eada32
@ -108,6 +108,7 @@ use pocketmine\world\format\Chunk;
|
||||
use pocketmine\world\Position;
|
||||
use pocketmine\world\sound\EntityAttackNoDamageSound;
|
||||
use pocketmine\world\sound\EntityAttackSound;
|
||||
use pocketmine\world\sound\FireExtinguishSound;
|
||||
use pocketmine\world\World;
|
||||
use function abs;
|
||||
use function assert;
|
||||
@ -1572,6 +1573,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
$block = $target->getSide($face);
|
||||
if($block->getId() === BlockLegacyIds::FIRE){
|
||||
$this->getWorld()->setBlock($block->getPos(), VanillaBlocks::AIR());
|
||||
$this->getWorld()->addSound($block->getPos()->add(0.5, 0.5, 0.5), new FireExtinguishSound());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
34
src/world/sound/FireExtinguishSound.php
Normal file
34
src/world/sound/FireExtinguishSound.php
Normal 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)];
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user