added PaintingPlaceSound

This commit is contained in:
Dylan K. Taylor 2019-06-25 18:39:02 +01:00
parent 6bbae4b2df
commit 73938486fc
2 changed files with 35 additions and 2 deletions

View File

@ -29,8 +29,8 @@ use pocketmine\entity\object\Painting;
use pocketmine\entity\object\PaintingMotive;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
use pocketmine\player\Player;
use pocketmine\world\sound\PaintingPlaceSound;
use function array_rand;
class PaintingItem extends Item{
@ -95,7 +95,7 @@ class PaintingItem extends Item{
$this->pop();
$entity->spawnToAll();
$player->getWorld()->broadcastLevelEvent($blockReplace->add(0.5, 0.5, 0.5), LevelEventPacket::EVENT_SOUND_ITEMFRAME_PLACE); //item frame and painting have the same sound
$player->getWorld()->addSound($blockReplace->add(0.5, 0.5, 0.5), new PaintingPlaceSound());
return ItemUseResult::SUCCESS();
}
}

View File

@ -0,0 +1,33 @@
<?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\network\mcpe\protocol\LevelEventPacket;
class PaintingPlaceSound extends LevelEventSound{
protected function getLevelEventId() : int{
return LevelEventPacket::EVENT_SOUND_ITEMFRAME_PLACE; //item frame and painting have the same sound
}
}