1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Fixing Client issues?

Discussion in 'Development' started by minijaham, May 26, 2021.

  1. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Hey! A while ago, I've encountered a client-sided issue that was confirmed by Dylan.
    So the problem was that when I used LevelEventSoundPacket with disableRelativeVolume as true wasn't working at all.
    What disableRelativeVolume was supposed to do is that the sound that is playing should be able to be heard by every player with the same volume, regardless of the position.

    Here's the OS and the PM version I was using:
    PocketMine-MP: 3.19.1
    PHP: 7.4
    Server OS: Windows
    Game version: Win10

    And this is the code
    PHP:
    $packet = new LevelSoundEventPacket();
    $packet->sound 290// ID of the sound
    $packet->disableRelativeVolume true;
    $packet->position $player;
    $player->sendDataPacket($packet);
    Any idea on how to fix these "client issues"?

    And for those who want my discord, please do add me because I made a new account for cleaning up things.
    minijaham#3259
     
  2. Axon

    Axon Zombie

    Messages:
    276
    What I've done is to send a audio packet to all the players with their location, this won't solve the location error though.
     
    Agent likes this.
  3. Axon

    Axon Zombie

    Messages:
    276
    Maybe it's possible to update the packet for the player every time it moves?
     
    Agent and minijaham like this.
  4. Primus

    Primus Zombie Pigman

    Messages:
    749
    I think that it would reset the sound.
     
    minijaham likes this.
  5. Axon

    Axon Zombie

    Messages:
    276
    Hmm,
    We can use the broadcastLevelSoundEvent from Level
    PHP:
    $player->getServer()->getLevelByName("Hub")->broadcastLevelSoundEvent(new \pocketmine\math\Vector3(0,0,0), 290, -1, -1falsetrue);
    Only problem is that the sound will not broadcast to the player if the chunks aren't visible to the player.
    And yes, this works with disableRelativeVolume.
     
    Agent likes this.
  6. Axon

    Axon Zombie

    Messages:
    276
    I also did this but it's the same issue as above, It doesn't work if the player is outside the render distance.
    PHP:
    $packet = new \pocketmine\network\mcpe\protocol\LevelSoundEventPacket();
              
    $packet->sound 290// ID of the sound
              
    $packet->disableRelativeVolume true;
              
    $packet->position = new \pocketmine\math\Vector3(0,0,0);
              
    $player->handleLevelSoundEvent($packet);
    What are your thoughts @Primus xD
     
    Last edited: May 26, 2021
    Agent likes this.
  7. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Hmm...I might just not be getting what client issues exactly are. Are they caused by the device? The OS?
    I've tried every possible workaround I can think of, but they were either super inefficient or failed.
     
  8. Axon

    Axon Zombie

    Messages:
    276
    It may be from both ?? Not sure, but the two codes I showed does work. Which is a bit weird.
     
    Agent likes this.
  9. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    They do work, except that the disableRelativeVolume isn't functioning the way I want it to. Does it work for you?
     
  10. Axon

    Axon Zombie

    Messages:
    276
    Your code doesn't work, but the code's I posted does work.
     
    Agent likes this.
  11. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Hmm...my code and your code functions the same for me. What could actually be wrong with my client?
     
  12. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Bump!
     
    Axon likes this.
  13. Axon

    Axon Zombie

    Messages:
    276
    It could be outdated protocols?
    Maybe minecraft 1.16 uses different packets?
     
    Agent and minijaham like this.
  14. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Hmm...could be. Considering that I purchased minecraft on my IOS device, and the same thing happened....
     
  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.