LightningBolt 5.46.0
Extends Entity
Implements NeverSavedWithChunkEntity
Lightning bolt (minecraft:lightning_bolt), vanilla behaviour: thunder and impact sounds, then the bolt lives 2 ticks plus 0-2 extra flashes. While it lives it strikes every entity within 3 blocks (up to 6 above), once each: Entity::onStruckByLightning() (5 damage and 8 seconds of fire by default, conversions for some mobs). On Normal and Hard it sets fire to the block it hits and up to 4 around it (one more on each flash). The block below is struck: a lightning rod gets a redstone pulse, and the copper it is attached to (or copper struck directly) loses its oxidation, along with a few random copper blocks around it.
A visual-only bolt (skeleton trap) only shows and sounds. Never saved.
Constants
DAMAGE
public const DAMAGE = 5.0FIRE_SECONDS
public const FIRE_SECONDS = 8STRIKE_HEIGHT
public const STRIKE_HEIGHT = 6.0STRIKE_RADIUS
public const STRIKE_RADIUS = 3.0Entities this far away horizontally (and up to 6 more above) are struck.
Methods
__construct()
public function __construct(\pocketmine\entity\Location $location, bool $visualOnly = false, ?\pocketmine\nbt\tag\CompoundTag $nbt = null)attack()
public function attack(\pocketmine\event\entity\EntityDamageEvent $source) : voidcanBeCollidedWith()
public function canBeCollidedWith() : boolcanSaveWithChunk()
public function canSaveWithChunk() : boolentityBaseTick() protected
protected function entityBaseTick(int $tickDiff = 1) : boolgetInitialDragMultiplier() protected
protected function getInitialDragMultiplier() : floatgetInitialGravity() protected
protected function getInitialGravity() : floatgetInitialSizeInfo() protected
protected function getInitialSizeInfo() : \pocketmine\entity\EntitySizeInfogetNetworkTypeId()
public static function getNetworkTypeId() : stringgetStrikePosition()
public function getStrikePosition() : \pocketmine\math\Vector3The block the bolt strikes (the one below it).
hasMovementUpdate()
public function hasMovementUpdate() : boolisFireProof()
public function isFireProof() : boolisVisualOnly()
public function isVisualOnly() : boolstrike()
public static function strike(\pocketmine\entity\Location $location, bool $visualOnly = false, int $cause = \pocketmine\event\world\LightningStrikeEvent::CAUSE_CUSTOM) : ?selfSpawns a lightning bolt at the given position, after a LightningStrikeEvent. Returns null if a plugin cancelled it.
