mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-08-20 10:00:31 +00:00
added PaintingPlaceSound
This commit is contained in:
parent
6bbae4b2df
commit
73938486fc
@ -29,8 +29,8 @@ use pocketmine\entity\object\Painting;
|
|||||||
use pocketmine\entity\object\PaintingMotive;
|
use pocketmine\entity\object\PaintingMotive;
|
||||||
use pocketmine\math\Facing;
|
use pocketmine\math\Facing;
|
||||||
use pocketmine\math\Vector3;
|
use pocketmine\math\Vector3;
|
||||||
use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|
||||||
use pocketmine\player\Player;
|
use pocketmine\player\Player;
|
||||||
|
use pocketmine\world\sound\PaintingPlaceSound;
|
||||||
use function array_rand;
|
use function array_rand;
|
||||||
|
|
||||||
class PaintingItem extends Item{
|
class PaintingItem extends Item{
|
||||||
@ -95,7 +95,7 @@ class PaintingItem extends Item{
|
|||||||
$this->pop();
|
$this->pop();
|
||||||
$entity->spawnToAll();
|
$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();
|
return ItemUseResult::SUCCESS();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
33
src/pocketmine/world/sound/PaintingPlaceSound.php
Normal file
33
src/pocketmine/world/sound/PaintingPlaceSound.php
Normal 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
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user