Skip to content

BreakDoorGoal 5.47.0 ​

final class · pocketmine\entity\ai\goal\BreakDoorGoal · source

Extends Goal

Breaks a closed wooden door on the mob's path (vanilla minecraft:annotation.break_door with navigation can_break_doors; Java BreakDoorGoal): when the mob bumps into a wall and a closed door other than an iron door is in the next nodes of its path within 1.5 blocks (or in its own block), it hits the door (door bump sound and an arm swing 1 tick in 20) while the block cracks, and after the break time the door is gone, with the door crash sound and its break particles, and drops nothing. It gives up when the door opens, the mob gets 2 blocks away from it or the difficulty falls below the minimum. Needs the mobGriefing game rule.

The mob's paths must go through closed doors for it to walk into them (see \pocketmine\entity\ai\navigation\PathFinder::setCanBreakDoors()). The goal holds no control flag: the mob keeps chasing its target into the door while it breaks it.

Constants ​

DEFAULT_BREAK_TICKS ​

php
public const DEFAULT_BREAK_TICKS = 240

Vanilla annotation.break_door break_time (12 seconds) and min_difficulty (hard) defaults

DEFAULT_MIN_DIFFICULTY ​

php
public const DEFAULT_MIN_DIFFICULTY = \pocketmine\world\World::DIFFICULTY_HARD

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\Mob $mob, int $breakTime = self::DEFAULT_BREAK_TICKS, int $minDifficulty = self::DEFAULT_MIN_DIFFICULTY, ?\Closure $condition = null)

canContinue() ​

php
public function canContinue() : bool

canStart() ​

php
public function canStart() : bool

getBreakTicks() ​

php
public function getBreakTicks() : int

getBreakTime() ​

php
public function getBreakTime() : int

getDoor() ​

php
public function getDoor() : ?\pocketmine\math\Vector3

Returns the lower half of the door being broken, or null.

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. Not affiliated with the PMMP team or Mojang.