mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 03:47:16 +00:00
XpLevelUpSound: fixed crash on non-multiples of 5
This commit is contained in:
parent
3ea5260935
commit
004e81ea35
@ -25,6 +25,7 @@ namespace pocketmine\level\sound;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use function intdiv;
|
||||
use function min;
|
||||
|
||||
class XpLevelUpSound implements Sound{
|
||||
@ -46,6 +47,6 @@ class XpLevelUpSound implements Sound{
|
||||
public function encode(Vector3 $pos){
|
||||
//No idea why such odd numbers, but this works...
|
||||
//TODO: check arbitrary volume
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_LEVELUP, $pos, 0x10000000 * (min(30, $this->xpLevel) / 5));
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_LEVELUP, $pos, 0x10000000 * intdiv(min(30, $this->xpLevel), 5));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user