Skip to content

PortalTravel 5.46.0 ​

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

Takes players through Nether and End portals.

Nether portal: a player who stays in the portal for 4 seconds (80 ticks; 1 tick in creative) goes to the linked world of the other dimension (Overworld <-> Nether, see WorldManager::getLinkedWorld()). The arrival point is the player's position scaled 8:1, and they come out of the closest known portal within 128 blocks (Overworld) or 16 blocks (Nether) of it, or a new 2x3 portal built nearby. End portal: instant; to the End spawn platform, or from the End to the player's spawn point in the Overworld.

After travelling, a player must step out of the portal before it works again, and portals do nothing for 1 second. Only players travel for now: other entities ignore portals.

Constants ​

CONTACT_GRACE_TICKS ​

php
public const CONTACT_GRACE_TICKS = 4

Ticks without portal contact after which an entity counts as having left the portal.

COOLDOWN_TICKS ​

php
public const COOLDOWN_TICKS = 20

NETHER_PORTAL_DELAY_TICKS ​

php
public const NETHER_PORTAL_DELAY_TICKS = 80

NETHER_SEARCH_RADIUS ​

php
public const NETHER_SEARCH_RADIUS = 16

OVERWORLD_SEARCH_RADIUS ​

php
public const OVERWORLD_SEARCH_RADIUS = 128

RETRY_TICKS ​

php
public const RETRY_TICKS = 100

Ticks to wait before trying again when the destination doesn't exist.

Methods ​

__construct() ​

php
public function __construct()

getScaledArrival() ​

php
public static function getScaledArrival(\pocketmine\math\Vector3 $pos, \pocketmine\world\dimension\Dimension $source, \pocketmine\world\World $target) : \pocketmine\math\Vector3

Returns where an entity at the given position in a world of the source dimension arrives in the target dimension before looking for a portal: X and Z scaled 8:1 between the Overworld and the Nether, Y clamped to where a portal can be built.

onEntityInsidePortal() ​

php
public function onEntityInsidePortal(\pocketmine\entity\Entity $entity, \pocketmine\world\dimension\Dimension $portal, \pocketmine\math\Vector3 $portalPos) : void

Called every tick an entity is inside a portal block (possibly several times per tick when it touches several).

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