Skip to content

EnderDragon 5.46.0 ​

class · pocketmine\entity\boss\EnderDragon · source

Extends Mob

The ender dragon. Bedrock values (Mojang bedrock-samples behavior_pack/entities/ender_dragon.json and the Minecraft Wiki): 200 health, one 13x4 collision box, flies through blocks destroying them (not End stone, obsidian, bedrock and other dragon-immune blocks), boss bar within 125 blocks, never despawns, immune to fire, falls, drowning, magic, suffocation and the void; only players and explosions hurt it. Hits that don't land near the head deal a quarter of their damage plus one (about 75% less).

Phases (Bedrock behaviours dragonholdingpattern, dragonstrafeplayer, dragonchargeplayer, dragonlanding, dragonflaming/dragonscanning, dragontakeoff, dragondeath):

  • holding: circles the fight centre (0,0 in the End, otherwise where it was spawned) 40-60 blocks away;
  • strafing: flies at a player within 64 blocks and shoots a dragon fireball (also right after a crystal it was healing from is destroyed);
  • charging: dives at a player's position;
  • landing and perched (End only): lands on the exit portal pillar with a chance of 1 in (3 + crystals left) at each waypoint; perched, it breathes dragon's breath at players within 20 blocks of the portal (up to 4 times), charges the nearest player if nobody comes, and takes off after 4 breaths or 50 damage;
  • dying: flies above the exit portal (in the End) or rises, drops its experience during the last 2.5 s of a 10 s animation (12000 the first time in an End, 500 otherwise) and then the exit portal opens.

End crystals within 32 blocks heal it by 1 health every 0.5 s; destroying the crystal it heals from hurts it by 10. Head and wing hits: 10 (6/10/15 by difficulty) at the head, wings knock back and hurt by 5 while flying.

Constants ​

ACTIVE_RANGE ​

php
public const ACTIVE_RANGE = 200

The dragon's AI keeps running while a player is within this distance (the fight area).

BREATH_TICKS ​

php
public const BREATH_TICKS = 60

CHARGE_RANGE ​

php
public const CHARGE_RANGE = 150.0

CRYSTAL_DESTROYED_DAMAGE ​

php
public const CRYSTAL_DESTROYED_DAMAGE = 10.0

DEATH_TICKS ​

php
public const DEATH_TICKS = 200

FIRST_KILL_XP ​

php
public const FIRST_KILL_XP = 12000

HEAD_DAMAGE ​

php
public const HEAD_DAMAGE = 10.0

HEAD_HIT_RADIUS ​

php
public const HEAD_HIT_RADIUS = 4.0

HEAD_OFFSET ​

php
public const HEAD_OFFSET = 6.0

Distance from the dragon's centre to its head, in the direction it flies.

HEAL_RANGE ​

php
public const HEAL_RANGE = 32.0

HUD_RANGE ​

php
public const HUD_RANGE = 125.0

MAX_BREATHS ​

php
public const MAX_BREATHS = 4

MAX_HEALTH ​

php
public const MAX_HEALTH = 200

MODIFIER_BODY_HIT ​

php
public const MODIFIER_BODY_HIT = 1001

Damage modifier type used for the reduction of hits away from the head.

PERCH_ESCAPE_DAMAGE ​

php
public const PERCH_ESCAPE_DAMAGE = 50.0

PHASE_CHARGING ​

php
public const PHASE_CHARGING = 2

PHASE_HOLDING ​

php
public const PHASE_HOLDING = 0

PHASE_LANDING ​

php
public const PHASE_LANDING = 3

PHASE_PERCHED ​

php
public const PHASE_PERCHED = 4

PHASE_STRAFING ​

php
public const PHASE_STRAFING = 1

PHASE_TAKEOFF ​

php
public const PHASE_TAKEOFF = 5

PORTAL_PLAYER_RANGE ​

php
public const PORTAL_PLAYER_RANGE = 20.0

STRAFE_RANGE ​

php
public const STRAFE_RANGE = 64.0

WING_DAMAGE ​

php
public const WING_DAMAGE = 5.0

XP ​

php
public const XP = 500

Methods ​

attack() ​

php
public function attack(\pocketmine\event\entity\EntityDamageEvent $source) : void

breathe() ​

php
public function breathe() : void

Breathes dragon's breath in front of its head for 3 seconds (perched).

canBeRenamed() ​

php
public function canBeRenamed() : bool

canBreathe() ​

php
public function canBreathe() : bool

canDespawn() ​

php
public function canDespawn() : bool

checkBlockIntersections() protected ​

php
protected function checkBlockIntersections() : void

entityBaseTick() protected ​

php
protected function entityBaseTick(int $tickDiff = 1) : bool

getBossBar() ​

php
public function getBossBar() : \pocketmine\entity\boss\BossBar

getCrystalsAlive() ​

php
public function getCrystalsAlive() : int

getDrops() ​

php
public function getDrops() : array

getFightCenter() ​

php
public function getFightCenter() : \pocketmine\math\Vector3

Centre of the fight: the exit portal's origin in the End, otherwise where the dragon was spawned.

getHeadPosition() ​

php
public function getHeadPosition() : \pocketmine\math\Vector3

getHeadingVector() ​

php
public function getHeadingVector() : \pocketmine\math\Vector3

Direction the dragon faces (its head), from the yaw. The dragon's model is turned around: its yaw is 180 degrees off its heading, like in Java (and PowerNukkitX).

getHealingCrystal() ​

php
public function getHealingCrystal() : ?\pocketmine\entity\object\EndCrystal

getHome() ​

php
public function getHome() : \pocketmine\math\Vector3

getInitialDragMultiplier() protected ​

php
protected function getInitialDragMultiplier() : float

getInitialGravity() protected ​

php
protected function getInitialGravity() : float

getInitialSizeInfo() protected ​

php
protected function getInitialSizeInfo() : \pocketmine\entity\EntitySizeInfo

getName() ​

php
public function getName() : string

getNetworkTypeId() ​

php
public static function getNetworkTypeId() : string

getPerchPosition() ​

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

Where the dragon perches (on top of the exit portal pillar), or null outside the End.

getPhase() ​

php
public function getPhase() : int

getXpDropAmount() ​

php
public function getXpDropAmount() : int

hasMovementUpdate() ​

php
public function hasMovementUpdate() : bool

initEntity() protected ​

php
protected function initEntity(\pocketmine\nbt\tag\CompoundTag $nbt) : void

isFireProof() ​

php
public function isFireProof() : bool

isImmuneBlock() ​

php
public static function isImmuneBlock(int $typeId) : bool

Blocks the dragon can't destroy (vanilla dragon_immune tag), besides unbreakable blocks.

isInEnd() ​

php
public function isInEnd() : bool

Whether the dragon fights in an End world (the fight is centred on the exit portal at 0,0 and it can perch).

onDeath() protected ​

php
protected function onDeath() : void

onDeathUpdate() protected ​

php
protected function onDeathUpdate(int $tickDiff) : bool

onDispose() protected ​

php
protected function onDispose() : void

registerGoals() protected ​

php
protected function registerGoals() : void

saveNBT() ​

php
public function saveNBT() : \pocketmine\nbt\tag\CompoundTag

setPhase() ​

php
public function setPhase(int $phase) : void

shootFireball() ​

php
public function shootFireball(\pocketmine\math\Vector3 $at) : ?\pocketmine\entity\projectile\DragonFireball

Fires a dragon fireball from the head at the position.

startCharging() ​

php
public function startCharging(\pocketmine\math\Vector3 $target) : void

startStrafing() ​

php
public function startStrafing(\pocketmine\entity\Living $target) : void

tickAi() protected ​

php
protected function tickAi(int $currentTick) : void

tryChangeMovement() protected ​

php
protected function tryChangeMovement() : void

updateActivation() protected ​

php
protected function updateActivation() : bool

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