Skip to content

EndGateways 5.46.0 ​

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

Placement of End gateways, following vanilla (Java's EndDragonFight, EndGatewayFeature and TheEndGatewayBlockEntity):

  • each dragon kill spawns a gateway at one of 20 spots on a circle of radius 96 around the main island, at y 75, in a seed-dependent order;
  • the first time such a gateway is used, its exit is searched along the line from 0,0 through it: around 1024 blocks out, the first generated chunk with blocks (an outer island); an exit gateway leading back is built 10 blocks above the island surface (on a new small island if the chunk has no spot to stand on).

Constants ​

ARRIVAL_RADIUS ​

php
public const ARRIVAL_RADIUS = 5

Radius around the exit gateway searched for the highest block entities arrive on.

COUNT ​

php
public const COUNT = 20

EXIT_SEARCH_DISTANCE ​

php
public const EXIT_SEARCH_DISTANCE = 1024

Distance from 0,0 where the exit search starts.

EXIT_SEARCH_STEPS ​

php
public const EXIT_SEARCH_STEPS = 16

Steps of 16 blocks the exit search makes inwards (and then outwards).

EXIT_TALLEST_RADIUS ​

php
public const EXIT_TALLEST_RADIUS = 16

Radius around the found spot searched for the highest block (vanilla findTallestBlock()).

RING_RADIUS ​

php
public const RING_RADIUS = 96

RING_Y ​

php
public const RING_Y = 75

Methods ​

build() ​

php
public static function build(\pocketmine\world\World $world, \pocketmine\math\Vector3 $origin, ?\pocketmine\math\Vector3 $exit, bool $exact) : void

Builds a gateway at the given position: the gateway block in a bedrock frame, with air around it. The chunks around the position must be loaded.

findExitXZ() ​

php
public static function findExitXZ(\pocketmine\math\Vector3 $gateway, \Closure $isChunkEmpty) : array

Vanilla's findExitPortalXZPosTentative(): from 1024 blocks out, steps inwards while the chunk there has blocks, then outwards while it is empty. $isChunkEmpty returns null when the chunk is not available yet: then the search stops and returns the chunk it needs instead.

findTallestBlock() ​

php
public static function findTallestBlock(\pocketmine\world\World $world, \pocketmine\math\Vector3 $around, int $radius, bool $allowBedrock) : \pocketmine\math\Vector3

Vanilla's findTallestBlock(): the highest full block within $radius blocks (horizontally) of $around, skipping the centre column unless $allowBedrock, and bedrock unless $allowBedrock; $around itself if there is none. The chunks must be loaded.

findValidSpawnInChunk() ​

php
public static function findValidSpawnInChunk(\pocketmine\world\World $world, int $chunkX, int $chunkZ) : ?\pocketmine\math\Vector3

Vanilla's findValidSpawnInChunk(): the End stone block of the chunk (from y 30 up) with two non-full blocks above it that is closest to 0,0,0, or null if there is none. The chunk must be loaded.

getArrivalPosition() ​

php
public static function getArrivalPosition(\pocketmine\world\World $world, \pocketmine\math\Vector3 $exit) : \pocketmine\math\Vector3

Vanilla's findExitPosition(): where entities arrive through a gateway with a non-exact exit: on top of the highest block (bedrock excluded) around it. The chunks around the exit must be loaded.

getRingOrder() ​

php
public static function getRingOrder(int $seed) : array

Indices (0-19) of the gateways around the main island in vanilla's order for a world seed: the dragon fight takes them from the end of the list.

getRingPosition() ​

php
public static function getRingPosition(int $index) : \pocketmine\math\Vector3

Position of the gateway with the given index (0-19) around the main island.

getSearchDirection() ​

php
public static function getSearchDirection(\pocketmine\math\Vector3 $gateway) : array

Direction of the exit search of a gateway: from 0,0 through the gateway, horizontally.

isChunkEmpty() ​

php
public static function isChunkEmpty(\pocketmine\world\format\Chunk $chunk) : bool

Whether a chunk has no blocks at all (vanilla: no filled section).

placeIsland() ​

php
public static function placeIsland(\pocketmine\world\World $world, \pocketmine\math\Vector3 $origin) : void

Vanilla's end_island feature: a small floating island of End stone, top layer at $origin, seeded by the position like vanilla does for exit islands.

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