mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-23 00:55:57 +00:00
Arrow: added shake effect and strike sound
This commit is contained in:
parent
8cc6a32a04
commit
83a3c6f614
@ -23,13 +23,17 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\entity\projectile;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\entity\Entity;
|
||||
use pocketmine\event\entity\ProjectileHitEvent;
|
||||
use pocketmine\event\inventory\InventoryPickupArrowEvent;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\item\ItemFactory;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\math\RayTraceResult;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\network\mcpe\protocol\EntityEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\TakeItemEntityPacket;
|
||||
use pocketmine\Player;
|
||||
|
||||
@ -83,6 +87,12 @@ class Arrow extends Projectile{
|
||||
|
||||
protected function onHit(ProjectileHitEvent $event) : void{
|
||||
$this->setCritical(false);
|
||||
$this->level->broadcastLevelSoundEvent($this, LevelSoundEventPacket::SOUND_BOW_HIT);
|
||||
}
|
||||
|
||||
protected function onHitBlock(Block $blockHit, RayTraceResult $hitResult) : void{
|
||||
parent::onHitBlock($blockHit, $hitResult);
|
||||
$this->broadcastEntityEvent(EntityEventPacket::ARROW_SHAKE, 7); //7 ticks
|
||||
}
|
||||
|
||||
public function onCollideWithPlayer(Player $player){
|
||||
|
@ -66,6 +66,7 @@ class EntityEventPacket extends DataPacket{
|
||||
public const AGENT_ARM_SWING = 36;
|
||||
public const ENDER_DRAGON_DEATH = 37;
|
||||
public const DUST_PARTICLES = 38; //not sure what this is
|
||||
public const ARROW_SHAKE = 39;
|
||||
|
||||
public const EATING_ITEM = 57;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user