Sounds

Discussion in 'Development' started by yBriisMC, Jul 27, 2022.

  1. yBriisMC

    yBriisMC Silverfish

    Messages:
    17
    How do I have a sound that doesn't exist in pmmp 3 API only in 4 *XpLevelUpdate* among others. if you have explain it to me please
     
  2. FurkanYks

    FurkanYks Creeper

    Messages:
    5
    GitHub:
    FurkanYks
    PHP:
     public function onBlockBreakSound(BlockBreakEvent $event): void
        
    {
            
    $player $event->getPlayer();
            
    $name $player->getName();
            
    $world $player->getWorld();
            
    $blockx $event->getPlayer()->getPosition()->getFloorX();
            
    $blocky $event->getPlayer()->getPosition()->getFloorY();
            
    $blockz $event->getPlayer()->getPosition()->getFloorZ();

    $pk = new PlaySoundPacket;
    $pk->soundName "note.didgeridoo"// sound name
    $pk->volume 100// numeric
    $pk->pitch 1// numeric
    $pk->$blockx;
    $pk->$blocky;
    $pk->$blockz;
    $player->getNetworkSession()->sendDataPacket($pk);
    #you can add sounds like this in api4. you can change sound name with bedrock edition original sounds name.
    }
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.