End gateway

End gateways are two sets of portals generated in the End, one around the central island and another scattered throughout the outer islands.

On the central island, up to 20 gateways can be generated by defeating the Ender dragon multiple times. Activating them generates their corresponding gateways on the outer islands. They are useful to quickly traverse the different parts in the End dimension.

On the central island
Near the edge of the central island, a new End gateway is generated each time the Ender dragon is defeated. In this set of gateways, a maximum of twenty can be generated within each world. They form a circle, equally distributed around the island at Y-level 75, at a distance of 96 blocks (regardless of angle) away from the center (0,0) in random order.

Gateways do not generate after the Ender dragon has been defeated 20 times.

These gateways always have fixed generation positions as follows:

On the outer islands
The second set of End gateways are generated randomly throughout the outer islands further away from the central island, after the gateways there having been first activated. As each of them has a direct connection to one of the gateways on the central island, they can teleport the player back to the locations of their corresponding End gateways or the original obsidian platform. Thus allowing the player to easily teleport back and forth between the different islands.

These gateways generate at any Y-level above 30, and always above a block of End stone. They also generate in chunks that have any block above Y-level 30, If the chunk does not contain any End stone, a platform made of the same material generates alongside the gateway.

Generation details
Their generation is determined as follows: The game first draws a line with a length of 1024 blocks from the center (0,0) through the activated gateway on the central island. If the conditions above are met in the chunk at the end of that line, the game decreases the length of the line until either a chunk not meeting the conditions has been found or until the line has a length of 768. If the conditions above are not met, the game increases the length of the vector until it first finds a chunk meeting the conditions. The gateway is then generated in the last found chunk matching the criteria. Knowing this, the position of the exit gateway can be manipulated.

Once an End gateway on the central island has been activated, it is indefinitely linked to its corresponding gateway on the outer island. Changing the position of the outer gateway is then no longer possible.

Including the 20 End gateways with fixed positions on the central island, and their 20 corresponding gateways randomly generated among the outer islands, there could be in total 40 End gateways in one world.

Structure
The end gateway is composed of an end gateway block confined within a vaguely octahedral formation made up of twelve bedrock.

Behavior
A magenta beam shoots out vertically from the top and bottom of the gateway when it is generated. The beam disappears after 10 seconds. When an entity enters the gateway, the gateway emits the beam for 2 seconds.

The bedrock arrangement prevents the player from entering the gateway directly. Throwing an ender pearl or flying with elytra straight into the end gateway block teleports the player to the outer End islands. Players can also access the inside of an end gateway by constructing a water channel leading into it and sprint-swimming through the channel and into the gateway, or by suffocation prevention. Any entity that moves into the end gateway block also is teleported. Another way is to place a trapdoor on the gateway while standing on a solid block to force the player to crawl.

Once the gateway is activated, another end gateway generates in the outer end islands near to where the player is teleported; this gateway teleports the player back to the original gateway, providing a way to return to the main island.

The position where the player or entity lands after teleporting is determined by a systematic algorithm: the gateway searches for a full block (which isn't bedrock), starting from the north-west corner at the topmost height (Y=255) within a 5 block radius around the gateway block (shown as the gold block in the image on the right). If there is a block at that position, then the entity is teleported onto that block. If there is no block, then the next position along the Z-axis is searched (shown as the lapis lazuli block in the image on the right). This continues along each column in an 11 × 11 area at the same Y-level with the exception of blocks above, below, or directly adjacent (including diagonals) to the gateway block. If there are no blocks, it moves one Y-level down and repeats the sequence from the north-west corner again. It continues doing this until every height is checked, and if there are no blocks within any of these points it always teleports the entity exactly two blocks above the gateway block.

Trivia

 * If an end gateway is broken (e.g. in creative), players can still enter the gateway on the other end. This teleports the player to the broken portal, which does not regenerate.
 * Once an end gateway generates on the main island, the corresponding gateway in the outer islands can generate, even if the player has not yet entered the portal on the main island, or the section of the outer islands has already generated without the gateway.
 * Using the exitportal tag and the command it is possible to create a gateway portal in the Overworld and program it to go to a location.