PortalTravel 5.46.0
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
public const CONTACT_GRACE_TICKS = 4Ticks without portal contact after which an entity counts as having left the portal.
COOLDOWN_TICKS
public const COOLDOWN_TICKS = 20NETHER_PORTAL_DELAY_TICKS
public const NETHER_PORTAL_DELAY_TICKS = 80NETHER_SEARCH_RADIUS
public const NETHER_SEARCH_RADIUS = 16OVERWORLD_SEARCH_RADIUS
public const OVERWORLD_SEARCH_RADIUS = 128RETRY_TICKS
public const RETRY_TICKS = 100Ticks to wait before trying again when the destination doesn't exist.
Methods
__construct()
public function __construct()getScaledArrival()
public static function getScaledArrival(\pocketmine\math\Vector3 $pos, \pocketmine\world\dimension\Dimension $source, \pocketmine\world\World $target) : \pocketmine\math\Vector3Returns 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()
public function onEntityInsidePortal(\pocketmine\entity\Entity $entity, \pocketmine\world\dimension\Dimension $portal, \pocketmine\math\Vector3 $portalPos) : voidCalled every tick an entity is inside a portal block (possibly several times per tick when it touches several).
