mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-29 14:49:59 +00:00
Add flint-steel light sound, close #1434
This commit is contained in:
parent
fc9c264e77
commit
4dfd171af0
@ -28,6 +28,7 @@ use pocketmine\block\BlockFactory;
|
|||||||
use pocketmine\block\Solid;
|
use pocketmine\block\Solid;
|
||||||
use pocketmine\level\Level;
|
use pocketmine\level\Level;
|
||||||
use pocketmine\math\Vector3;
|
use pocketmine\math\Vector3;
|
||||||
|
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||||
use pocketmine\Player;
|
use pocketmine\Player;
|
||||||
|
|
||||||
class FlintSteel extends Tool{
|
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{
|
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)){
|
if($block->getId() === self::AIR and ($target instanceof Solid)){
|
||||||
$level->setBlock($block, BlockFactory::get(Block::FIRE), true);
|
$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(($player->gamemode & 0x01) === 0 and $this->useOn($block)){
|
||||||
if($this->getDamage() >= $this->getMaxDurability()){
|
if($this->getDamage() >= $this->getMaxDurability()){
|
||||||
$player->getInventory()->setItemInHand(Item::get(Item::AIR, 0, 0));
|
$player->getInventory()->setItemInHand(Item::get(Item::AIR, 0, 0));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user