Jukebox: fix music not stopping when destroyed by explosion

closes #5794
This commit is contained in:
Dylan K. Taylor 2023-06-03 21:22:26 +01:00
parent 6678360c00
commit c715efb18e
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -26,6 +26,7 @@ namespace pocketmine\block\tile;
use pocketmine\item\Item;
use pocketmine\item\Record;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\world\sound\RecordStopSound;
class Jukebox extends Spawnable{
private const TAG_RECORD = "RecordItem"; //Item CompoundTag
@ -61,4 +62,8 @@ class Jukebox extends Spawnable{
$nbt->setTag(self::TAG_RECORD, $this->record->nbtSerialize());
}
}
protected function onBlockDestroyedHook() : void{
$this->position->getWorld()->addSound($this->position, new RecordStopSound());
}
}