-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IronGolem: Broadcast throw sound on attacks
- Loading branch information
1 parent
2a94357
commit 2e0b64e
Showing
3 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
/* | ||
* __ __ _ _____ _ _ | ||
* | \/ | | | | __ \| | (_) | ||
* | \ / | ___ | |__ | |__) | |_ _ __ _ _ _ __ | ||
* | |\/| |/ _ \| '_ \| ___/| | | | |/ _` | | '_ \ | ||
* | | | | (_) | |_) | | | | |_| | (_| | | | | | | ||
* |_| |_|\___/|_.__/|_| |_|\__,_|\__, |_|_| |_| | ||
* __/ | | ||
* |___/ | ||
* | ||
* A PocketMine-MP plugin that implements mobs AI. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* | ||
* @author IvanCraft623 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace IvanCraft623\MobPlugin\sound; | ||
|
||
use pocketmine\entity\Entity; | ||
use pocketmine\math\Vector3; | ||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; | ||
use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; | ||
use pocketmine\world\sound\Sound; | ||
|
||
class ThrowSound implements Sound{ | ||
|
||
public function __construct(private Entity $entity){} | ||
|
||
public function encode(Vector3 $pos) : array{ | ||
return [LevelSoundEventPacket::create( | ||
LevelSoundEvent::THROW, | ||
$pos, | ||
-1, | ||
$this->entity::getNetworkTypeId(), | ||
false, | ||
false | ||
)]; | ||
} | ||
} |