EndGateways 5.46.0
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
public const ARRIVAL_RADIUS = 5Radius around the exit gateway searched for the highest block entities arrive on.
COUNT
public const COUNT = 20EXIT_SEARCH_DISTANCE
public const EXIT_SEARCH_DISTANCE = 1024Distance from 0,0 where the exit search starts.
EXIT_SEARCH_STEPS
public const EXIT_SEARCH_STEPS = 16Steps of 16 blocks the exit search makes inwards (and then outwards).
EXIT_TALLEST_RADIUS
public const EXIT_TALLEST_RADIUS = 16Radius around the found spot searched for the highest block (vanilla findTallestBlock()).
RING_RADIUS
public const RING_RADIUS = 96RING_Y
public const RING_Y = 75Methods
build()
public static function build(\pocketmine\world\World $world, \pocketmine\math\Vector3 $origin, ?\pocketmine\math\Vector3 $exit, bool $exact) : voidBuilds 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()
public static function findExitXZ(\pocketmine\math\Vector3 $gateway, \Closure $isChunkEmpty) : arrayVanilla'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()
public static function findTallestBlock(\pocketmine\world\World $world, \pocketmine\math\Vector3 $around, int $radius, bool $allowBedrock) : \pocketmine\math\Vector3Vanilla'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()
public static function findValidSpawnInChunk(\pocketmine\world\World $world, int $chunkX, int $chunkZ) : ?\pocketmine\math\Vector3Vanilla'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()
public static function getArrivalPosition(\pocketmine\world\World $world, \pocketmine\math\Vector3 $exit) : \pocketmine\math\Vector3Vanilla'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()
public static function getRingOrder(int $seed) : arrayIndices (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()
public static function getRingPosition(int $index) : \pocketmine\math\Vector3Position of the gateway with the given index (0-19) around the main island.
getSearchDirection()
public static function getSearchDirection(\pocketmine\math\Vector3 $gateway) : arrayDirection of the exit search of a gateway: from 0,0 through the gateway, horizontally.
isChunkEmpty()
public static function isChunkEmpty(\pocketmine\world\format\Chunk $chunk) : boolWhether a chunk has no blocks at all (vanilla: no filled section).
placeIsland()
public static function placeIsland(\pocketmine\world\World $world, \pocketmine\math\Vector3 $origin) : voidVanilla'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.
