Skip to content

TakeFlowerGoal 5.47.0 ​

class · pocketmine\entity\golem\TakeFlowerGoal · source

Extends Goal

Walks up to an iron golem holding out a poppy (see IronGolemOfferFlowerGoal) and takes it (vanilla behavior.take_flower: baby villagers, priority 9, and copper golems without a flower, priority 4; daytime only). Defaults of the behaviour: golems within 6 blocks horizontally and 2 vertically, walks at 0.5 until 2 blocks away, then waits a random time (at most 20 seconds) and takes the flower: the golem withdraws it.

Golems register here while they offer a flower, so that the takers don't look for golems at all while none does (one count() per goal evaluation).

Constants ​

MAX_WAIT_TICKS ​

php
public const MAX_WAIT_TICKS = 400

Longest wait next to the golem (vanilla max_wait_time 20 s).

SPEED ​

php
public const SPEED = 0.5

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\Mob $mob, ?\Closure $condition = null, ?\Closure $onTake = null)

canContinue() ​

php
public function canContinue() : bool

canStart() ​

php
public function canStart() : bool

getFlags() ​

php
public function getFlags() : int

isDaytime() ​

php
public static function isDaytime(\pocketmine\world\World $world) : bool

Whether it is day for take_flower and offer_flower (vanilla is_daytime).

start() ​

php
public function start() : void

stop() ​

php
public function stop() : void

takeFlower() ​

php
public function takeFlower(\pocketmine\entity\golem\IronGolem $golem) : void

Takes the flower from the golem right away.

tick() ​

php
public function tick() : void

VanillaMine is a fork of PocketMine-MP. Not affiliated with the PMMP team or Mojang.