LeashKnot 5.46.0
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.0Mobs a player leads within this range get tied to the fence they use.
Methods
attack()
php
public function attack(\pocketmine\event\entity\EntityDamageEvent $source) : voidcanTieTo()
php
public static function canTieTo(\pocketmine\world\World $world, \pocketmine\math\Vector3 $pos) : boolWhether leads can be tied to the block (fences).
entityBaseTick() protected
php
protected function entityBaseTick(int $tickDiff = 1) : boolgetFencePosition()
php
public function getFencePosition() : \pocketmine\math\Vector3getInitialDragMultiplier() protected
php
protected function getInitialDragMultiplier() : floatgetInitialGravity() protected
php
protected function getInitialGravity() : floatgetInitialSizeInfo() protected
php
protected function getInitialSizeInfo() : \pocketmine\entity\EntitySizeInfogetMobsLeashedTo()
php
public static function getMobsLeashedTo(\pocketmine\entity\Entity $holder, float $range) : arraygetNetworkTypeId()
php
public static function getNetworkTypeId() : stringgetOrCreate()
php
public static function getOrCreate(\pocketmine\world\World $world, \pocketmine\math\Vector3 $fence) : selfReturns the knot on the fence, creating it if needed.
onInteract()
php
public function onInteract(\pocketmine\player\Player $player, \pocketmine\math\Vector3 $clickPos) : booltieMobsOf()
php
public function tieMobsOf(\pocketmine\player\Player $player) : boolTies the mobs the player leads to this knot. Returns whether there were any.
untie()
php
public function untie() : voidUnties every mob (their leads drop) and removes the knot.
