TakeFlowerGoal 5.47.0
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
public const MAX_WAIT_TICKS = 400Longest wait next to the golem (vanilla max_wait_time 20 s).
SPEED
public const SPEED = 0.5Methods
__construct()
public function __construct(\pocketmine\entity\Mob $mob, ?\Closure $condition = null, ?\Closure $onTake = null)canContinue()
public function canContinue() : boolcanStart()
public function canStart() : boolgetFlags()
public function getFlags() : intisDaytime()
public static function isDaytime(\pocketmine\world\World $world) : boolWhether it is day for take_flower and offer_flower (vanilla is_daytime).
start()
public function start() : voidstop()
public function stop() : voidtakeFlower()
public function takeFlower(\pocketmine\entity\golem\IronGolem $golem) : voidTakes the flower from the golem right away.
tick()
public function tick() : void