EnderDragon 5.46.0
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
public const ACTIVE_RANGE = 200The dragon's AI keeps running while a player is within this distance (the fight area).
BREATH_TICKS
public const BREATH_TICKS = 60CHARGE_RANGE
public const CHARGE_RANGE = 150.0CRYSTAL_DESTROYED_DAMAGE
public const CRYSTAL_DESTROYED_DAMAGE = 10.0DEATH_TICKS
public const DEATH_TICKS = 200FIRST_KILL_XP
public const FIRST_KILL_XP = 12000HEAD_DAMAGE
public const HEAD_DAMAGE = 10.0HEAD_HIT_RADIUS
public const HEAD_HIT_RADIUS = 4.0HEAD_OFFSET
public const HEAD_OFFSET = 6.0Distance from the dragon's centre to its head, in the direction it flies.
HEAL_RANGE
public const HEAL_RANGE = 32.0HUD_RANGE
public const HUD_RANGE = 125.0MAX_BREATHS
public const MAX_BREATHS = 4MAX_HEALTH
public const MAX_HEALTH = 200MODIFIER_BODY_HIT
public const MODIFIER_BODY_HIT = 1001Damage modifier type used for the reduction of hits away from the head.
PERCH_ESCAPE_DAMAGE
public const PERCH_ESCAPE_DAMAGE = 50.0PHASE_CHARGING
public const PHASE_CHARGING = 2PHASE_HOLDING
public const PHASE_HOLDING = 0PHASE_LANDING
public const PHASE_LANDING = 3PHASE_PERCHED
public const PHASE_PERCHED = 4PHASE_STRAFING
public const PHASE_STRAFING = 1PHASE_TAKEOFF
public const PHASE_TAKEOFF = 5PORTAL_PLAYER_RANGE
public const PORTAL_PLAYER_RANGE = 20.0STRAFE_RANGE
public const STRAFE_RANGE = 64.0WING_DAMAGE
public const WING_DAMAGE = 5.0XP
public const XP = 500Methods
attack()
public function attack(\pocketmine\event\entity\EntityDamageEvent $source) : voidbreathe()
public function breathe() : voidBreathes dragon's breath in front of its head for 3 seconds (perched).
canBeRenamed()
public function canBeRenamed() : boolcanBreathe()
public function canBreathe() : boolcanDespawn()
public function canDespawn() : boolcheckBlockIntersections() protected
protected function checkBlockIntersections() : voidentityBaseTick() protected
protected function entityBaseTick(int $tickDiff = 1) : boolgetBossBar()
public function getBossBar() : \pocketmine\entity\boss\BossBargetCrystalsAlive()
public function getCrystalsAlive() : intgetDrops()
public function getDrops() : arraygetFightCenter()
public function getFightCenter() : \pocketmine\math\Vector3Centre of the fight: the exit portal's origin in the End, otherwise where the dragon was spawned.
getHeadPosition()
public function getHeadPosition() : \pocketmine\math\Vector3getHeadingVector()
public function getHeadingVector() : \pocketmine\math\Vector3Direction 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()
public function getHealingCrystal() : ?\pocketmine\entity\object\EndCrystalgetHome()
public function getHome() : \pocketmine\math\Vector3getInitialDragMultiplier() protected
protected function getInitialDragMultiplier() : floatgetInitialGravity() protected
protected function getInitialGravity() : floatgetInitialSizeInfo() protected
protected function getInitialSizeInfo() : \pocketmine\entity\EntitySizeInfogetName()
public function getName() : stringgetNetworkTypeId()
public static function getNetworkTypeId() : stringgetPerchPosition()
public function getPerchPosition() : ?\pocketmine\math\Vector3Where the dragon perches (on top of the exit portal pillar), or null outside the End.
getPhase()
public function getPhase() : intgetXpDropAmount()
public function getXpDropAmount() : inthasMovementUpdate()
public function hasMovementUpdate() : boolinitEntity() protected
protected function initEntity(\pocketmine\nbt\tag\CompoundTag $nbt) : voidisFireProof()
public function isFireProof() : boolisImmuneBlock()
public static function isImmuneBlock(int $typeId) : boolBlocks the dragon can't destroy (vanilla dragon_immune tag), besides unbreakable blocks.
isInEnd()
public function isInEnd() : boolWhether the dragon fights in an End world (the fight is centred on the exit portal at 0,0 and it can perch).
onDeath() protected
protected function onDeath() : voidonDeathUpdate() protected
protected function onDeathUpdate(int $tickDiff) : boolonDispose() protected
protected function onDispose() : voidregisterGoals() protected
protected function registerGoals() : voidsaveNBT()
public function saveNBT() : \pocketmine\nbt\tag\CompoundTagsetPhase()
public function setPhase(int $phase) : voidshootFireball()
public function shootFireball(\pocketmine\math\Vector3 $at) : ?\pocketmine\entity\projectile\DragonFireballFires a dragon fireball from the head at the position.
startCharging()
public function startCharging(\pocketmine\math\Vector3 $target) : voidstartStrafing()
public function startStrafing(\pocketmine\entity\Living $target) : voidtickAi() protected
protected function tickAi(int $currentTick) : voidtryChangeMovement() protected
protected function tryChangeMovement() : voidupdateActivation() protected
protected function updateActivation() : bool