Skip to content

LongJumpGoal 5.46.0 ​

class · pocketmine\entity\ai\goal\LongJumpGoal · source

Extends Goal

Jumps up onto a high block (vanilla behavior.jump_to_block, used by goats): every 30-60 seconds an idle mob on the ground looks for a standable block 2 to 10 blocks higher within 10 blocks sideways which it couldn't simply walk up to, and leaps there in one ballistic jump (JUMP_GOAL_JUMP flag while in the air). The jump is computed with the server's physics (gravity 0.08, drag 0.02 per tick) and only made if nothing is in the way.

Simplification: Bedrock's minimum_path_length (the block must be at least 8 path nodes away) is approximated by requiring a height difference of at least 2 blocks, which a walking mob can't climb in one step.

Constants ​

ATTEMPTS ​

php
public const ATTEMPTS = 24

Candidate positions tried per search.

MAX_FLIGHT_TICKS ​

php
public const MAX_FLIGHT_TICKS = 60

MAX_VELOCITY ​

php
public const MAX_VELOCITY = 1.5

MIN_HEIGHT ​

php
public const MIN_HEIGHT = 2

SEARCH_HEIGHT ​

php
public const SEARCH_HEIGHT = 10

SEARCH_WIDTH ​

php
public const SEARCH_WIDTH = 10

Properties ​

$maxCooldownTicks ​

php
public int $maxCooldownTicks

$minCooldownTicks ​

php
public int $minCooldownTicks

$mob ​

php
public \pocketmine\entity\Mob $mob

$onJumpingChanged ​

php
public ?\Closure $onJumpingChanged

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\Mob $mob, int $minCooldownTicks = 600, int $maxCooldownTicks = 1200, ?\Closure $onJumpingChanged = null)

canContinue() ​

php
public function canContinue() : bool

canStart() ​

php
public function canStart() : bool

computeJump() ​

php
public function computeJump(\pocketmine\math\Vector3 $from, \pocketmine\math\Vector3 $to) : ?\pocketmine\math\Vector3

Returns the launch velocity of a jump from $from landing on $to, or null if there is none within the maximum velocity or something is in the way.

getFlags() ​

php
public function getFlags() : int

isJumping() ​

php
public function isJumping() : bool

resetCooldown() ​

php
public function resetCooldown() : void

Makes the next search happen right away (tests, plugins).

start() ​

php
public function start() : void

stop() ​

php
public function stop() : void

tick() ​

php
public function tick() : void

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