Skip to content

MobConversion 5.46.0 ​

final class · pocketmine\entity\monster\MobConversion · source

Helpers for mobs turning into other mobs (husk -> zombie, piglin -> zombified piglin, hoglin -> zoglin, zombie villager -> villager): what the new mob keeps from the old one (vanilla transformation component).

Methods ​

convertByLightning() ​

php
public static function convertByLightning(\pocketmine\entity\Living $from, \pocketmine\entity\Living $to) : void

Replaces $from by $to after a lightning strike (pig -> zombified piglin, villager -> witch): the new mob keeps the state of the old one (see MobConversion::copyState()), never despawns (vanilla setPersistenceRequired) and the old one's riders get off.

copyState() ​

php
public static function copyState(\pocketmine\entity\Living $from, \pocketmine\entity\Living $to) : void

Copies the name, persistence and armor of $from to $to (vanilla "keep_level"/"preserve_equipment" keeps the worn equipment; held items are handled by the caller).

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