Nether Portal Fix

Discussion in 'Archived: Plugin Requests' started by np98765, Apr 22, 2012.

  1. Offline


    Plugin category: TP?

    Suggested name: NetherPortalFix (I really don't care...)

    A bit about me: I run a small server, "LavaCraft". Not much to tell about myself.

    What I want: A plugin that fixes Nether Portals once and for all. I want them to REMEMBER which Overworld portal they are linked to, so that way people aren't coming out of portals thousands of blocks away. Basically, they build a portal in the Overworld, a portal in the Nether is created and linked. If the Overworld portal is destroyed, then they will be unlinked (and the Nether version unlit, I guess). If the Nether nether portal is destroyed, then the Overworld portal would be unlit and unlinked. (If that's logical...)

    Ideas for commands: No commands needed for this plugin. It would be a drag-and-drop.

    Ideas for permissions: No permissions are needed, either. Again, drag-and-drop.

    When I'd like it by: Soon? The Nether is disabled in my world until we get this plugin, so yeah... Soon :O

    Similar plugin requests: None.

    Other information: Here's the current portal linkage, taken from the MCwiki:
    The Nether is proportional to the Overworld in the 1:8 ratio in terms of horizontal distances. By moving 1 block horizontally in the Nether, players have moved the equivalent of 8 blocks on the Overworld. This does not apply on the Y-axis, despite the Nether having only 128 layers. Portals do not "remember" what portal they are linked to in the other world, but instead perform the following whenever a portal is used by a player:
    1. Calculate the destination coordinates based on the entry coordinates by flooring the X- and Z-coordinates the largest integer less than or equal to the argument, so an X- or Z-coordinate of -29.5 becomes -30, not -29), then multiplying or dividing them by 8 depending on direction of travel. The Y-coordinate is not modified. This translation can be represented by the following pseudocode:
      {X, Y, Z} → {floor(X) ×/÷ 8, Y, floor(Z) ×/÷ 8}
    2. At destination, the game looks for the closest active portal block within a 128-block "radius" (actually, a maximum distance along a horizontal axis) of the player (257 × 257 × 128 tall box volume centered on destination coordinate). An active portal is defined as a portal block that does not have another portal block below it, thus only the 2 lowest portal blocks in the obsidian frame are considered. If one exists, teleport the player to the closest one as determined by a 3D distance in the new coordinate system (including the Y coordinate, which can cause seemingly more distant portals to be selected).
    3. If no active portal blocks exists in the above search region, the game creates one by looking for the closest possible valid position within a 16-block "radius" column (33 × 33 × 128 tall box volume centered on the destination coordinate) that has enough space to spawn a portal and is on solid ground. The game prefers to create the exit portal with the same facing orientation as the entry portal, but will check the other 3 directions as well. Regardless of orientation, the closest valid position is always picked.
    4. And if there are no valid spawn locations within the spawn region above, the game will finally create a portal at the destination coordinate (and clamp the Y-coordinate to between 70 and 118), converting any blocks (including air blocks) in the way into a portal. Such a portal has 4 extra obsidian blocks placed on both sides of the portal to prevent the player from falling.
  2. Offline


    you could always use NoPortals to stop other people making them?
  3. Offline


    I could, but that would mean that I would have to go around creating them.

    Currently, we ARE a small server (only about ~100 people logged on in April), but we are going to expand. I don't want to spammed with requests to make portals everywhere.

    It would be nice to have a mod that simply fixes the issue...
  4. Offline


    My plugin (, does what you're asking for, except for some minor differences. If there is not a suitable pre-existing destination portal found, it will forcibly create a new portal at the optimal location (preserving the y coordinate) with a minimum of surrounding material destruction (just enough to teleport a player to). It will spawn with a stone platform (again, only 4 extra blocks), and will not create a portal if there is obsidian in the way. It will also only search for portals on roughly the same horizontal plane (it will not look up and down in the destination world except for a small range, it will only search side to side). The tl;dr is "if there was a portal in the destination world, would stepping through it link to the portal I'm at?" Portals do not unlink if their counterpart is destroyed, but will instead search for a new one if stepped through and create one if it doesn't exist, modulo the exception above about interfering obsidian.

    Note that I've had one report of "It doesn't work in 1.2.5", but I haven't had time to investigate this. That will hopefully happen soon.
  5. Offline



    Though I'm wondering why this didn't come up in my searches... I would've instantly fallen in love with this plugin. Drag-and-drop, no plugins, no commands :D

    Good job, and thanks for the quick response!!! :D

Share This Page