Skip to content

LeashKnot 5.46.0 ​

class · pocketmine\entity\object\LeashKnot · source

Extends Entity
Implements NeverSavedWithChunkEntity

The knot of leads tied to a fence (vanilla LeashFenceKnotEntity). It holds the leashed mobs until it is punched, a player uses it (taking the mobs back or untying the leads), or the fence is gone; then the leads drop. Knots are not saved: mobs remember the fence and tie themselves to a new knot when loaded (see Mob::setLeashHolder()).

Constants ​

TIE_RANGE ​

php
public const TIE_RANGE = 7.0

Mobs a player leads within this range get tied to the fence they use.

Methods ​

attack() ​

php
public function attack(\pocketmine\event\entity\EntityDamageEvent $source) : void

canTieTo() ​

php
public static function canTieTo(\pocketmine\world\World $world, \pocketmine\math\Vector3 $pos) : bool

Whether leads can be tied to the block (fences).

entityBaseTick() protected ​

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

getFencePosition() ​

php
public function getFencePosition() : \pocketmine\math\Vector3

getInitialDragMultiplier() protected ​

php
protected function getInitialDragMultiplier() : float

getInitialGravity() protected ​

php
protected function getInitialGravity() : float

getInitialSizeInfo() protected ​

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

getMobsLeashedTo() ​

php
public static function getMobsLeashedTo(\pocketmine\entity\Entity $holder, float $range) : array

getNetworkTypeId() ​

php
public static function getNetworkTypeId() : string

getOrCreate() ​

php
public static function getOrCreate(\pocketmine\world\World $world, \pocketmine\math\Vector3 $fence) : self

Returns the knot on the fence, creating it if needed.

onInteract() ​

php
public function onInteract(\pocketmine\player\Player $player, \pocketmine\math\Vector3 $clickPos) : bool

tieMobsOf() ​

php
public function tieMobsOf(\pocketmine\player\Player $player) : bool

Ties the mobs the player leads to this knot. Returns whether there were any.

untie() ​

php
public function untie() : void

Unties every mob (their leads drop) and removes the knot.

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