Skip to content

Commit

Permalink
Fix portals in The End generating end gateway strucutres when used
Browse files Browse the repository at this point in the history
If an entity touches an end gateway block in The End (or a world like it) which
has no exit location set, the game will generate a new end gateway structure at
the same angle relative to and 1024 or so blocks away from the origin (i.e.
around the inner edge of the outer islands). Using a vane portal in an End world
therefore creates a tower of gateways that grows each time the portal is used.
This happens before Entity/PlayerTeleportEndGatewayEvents are fired, so the
existing cancelling of them doesn't prevent this.

Setting an exit location for end gateway blocks in vane portals is enough to
prevent this behaviour. Any location will do, since the teleport events being
cancelled will prevent anything going there anyway.
  • Loading branch information
thatfulvioguy committed Nov 11, 2023
1 parent 2837360 commit c97e8c2
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,13 @@ public void update_blocks(final Portals portals) {
final var end_gateway = (EndGateway) portal_block.block().getState(false);
end_gateway.setAge(200l);
end_gateway.update(true, false);

// If there's no exit location then the game will generate a natural gateway when the portal is used.
// Setting any location will do, since the teleports are cancelled via their events anyway.
if (spawn.location().getWorld().getEnvironment() == World.Environment.THE_END){
end_gateway.setExitLocation(spawn.location());
end_gateway.setExactTeleport(true);
}
}
if (portal_block.type() == PortalBlock.Type.CONSOLE) {
portals.update_console_item(this, portal_block.block());
Expand Down

0 comments on commit c97e8c2

Please sign in to comment.