Skip to content

FishingHook 5.46.0 ​

class · pocketmine\entity\projectile\FishingHook · source

Extends Projectile
Implements NeverSavedWithChunkEntity

Fishing bobber (vanilla FishingHook). Cast with a fishing rod; it floats on water, where after 5 to 30 seconds (5 seconds less per level of Lure; faster in the rain, slower under a roof) a fish swims to it, then bites within 1 to 4 seconds and stays on the hook for 1 to 2 seconds. Reeling in while a fish bites gives an item of the fishing loot table (see FishingLoot; treasure only in open water) thrown towards the player, and 1 to 6 experience. A hooked mob or item is pulled towards the player instead. The rod loses 1 durability per catch, 5 per pulled mob, 3 per pulled item and 2 when the bobber was stuck in a block. The bobber disappears when the player stops holding the rod, dies or goes more than 32 blocks away.

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\Location $location, ?\pocketmine\entity\Entity $shootingEntity, ?\pocketmine\item\Item $rod = null, ?\pocketmine\nbt\tag\CompoundTag $nbt = null)

canCollideWith() ​

php
public function canCollideWith(\pocketmine\entity\Entity $entity) : bool

entityBaseTick() protected ​

php
protected function entityBaseTick(int $tickDiff = 1) : bool

getActive() ​

php
public static function getActive(\pocketmine\player\Player $player) : ?self

Returns the bobber the player has out, if any.

getHookedEntity() ​

php
public function getHookedEntity() : ?\pocketmine\entity\Entity

getInitialDragMultiplier() protected ​

php
protected function getInitialDragMultiplier() : float

getInitialGravity() protected ​

php
protected function getInitialGravity() : float

getInitialSizeInfo() protected ​

php
protected function getInitialSizeInfo() : \pocketmine\entity\EntitySizeInfo

getNetworkTypeId() ​

php
public static function getNetworkTypeId() : string

isBiting() ​

php
public function isBiting() : bool

Whether a fish is on the hook right now (reeling in catches it).

isBobbing() ​

php
public function isBobbing() : bool

onDispose() protected ​

php
protected function onDispose() : void

onHitEntity() protected ​

php
protected function onHitEntity(\pocketmine\entity\Entity $entityHit, \pocketmine\math\RayTraceResult $hitResult) : void

retrieve() ​

php
public function retrieve(\pocketmine\player\Player $player) : int

Reels the line in (the player used the rod again): pulls the hooked entity, or catches the fish that is biting. Returns the durability the rod loses.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.