Skip to content

PatrolSpawner 5.46.0 ​

final class · pocketmine\world\mobs\PatrolSpawner · source

Spawns pillager patrols (vanilla Bedrock spawn_rules/pillager_patrol.json):

  • once the world time has reached 120000 ticks (5 days), every 12000-13200 ticks an attempt is made, which goes ahead 20% of the time, in the Overworld and not in peaceful;
  • a random player (not a spectator) is picked; the patrol spawns on the surface 24-48 blocks away from them (48-64 when they are in a village), where the light level is 7 or less, outside mushroom fields;
  • it is 2-5 pillagers: the first is the captain (ominous banner), the others follow it.

Patrollers are not persistent: they despawn like other monsters.

Constants ​

MAX_DISTANCE ​

php
public const MAX_DISTANCE = 48

MAX_LIGHT ​

php
public const MAX_LIGHT = 7

MAX_SIZE ​

php
public const MAX_SIZE = 5

MIN_DISTANCE ​

php
public const MIN_DISTANCE = 24

MIN_SIZE ​

php
public const MIN_SIZE = 2

VILLAGE_MAX_DISTANCE ​

php
public const VILLAGE_MAX_DISTANCE = 64

Methods ​

__construct() ​

php
public function __construct(\pocketmine\world\World $world)

getDelay() ​

php
public function getDelay() : int

Ticks left before the next spawn attempt.

spawnPatrol() ​

php
public function spawnPatrol(\pocketmine\player\Player $player, bool $checkConditions = true) : array

Tries to spawn a patrol around the player. With $checkConditions false, the light level and the biome are not checked (for tests and plugins). Returns the patrol, captain first (empty if no spot was found).

tick() ​

php
public function tick(int $currentTick) : void

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