Skip to content

NetherPortalRegistry 5.46.0 ​

final class · pocketmine\world\dimension\NetherPortalRegistry · source

Known lit Nether portals of each world, so travelling entities find the portal linked to the one they used without scanning hundreds of chunks. This is what vanilla keeps in the "portals" record of the world's LevelDB; PocketMine keeps one table for all worlds in nether_portals.json in the server data folder. Portals lit before this existed are added the first time an entity travels through them.

Methods ​

__construct() ​

php
public function __construct(?string $path = null)

add() ​

php
public function add(\pocketmine\world\World $world, \pocketmine\world\dimension\NetherPortalShape $shape) : void

Records a lit portal. A portal already recorded at the same origin is replaced.

findNearest() ​

php
public function findNearest(\pocketmine\world\World $world, \pocketmine\math\Vector3 $pos, int $radius) : ?\pocketmine\world\dimension\NetherPortalShape

Returns the recorded portal closest to the given position whose origin is within the given horizontal distance (per axis, like vanilla's square search area). Records whose portal no longer exists are dropped.

getAll() ​

php
public function getAll(\pocketmine\world\World $world) : array

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