Linking Overworld, Nether, End

Discussion in 'Plugin Development' started by wand555, Mar 26, 2020.

Thread Status:
Not open for further replies.
  1. Offline

    wand555

    I have 3 custom created worlds (one NORMAL, one NETHER, one END) and I want to achieve normal portal-warping behaviour. Currently when a player is in 'customOverworld' and enters a nether portal, he doesn't teleport to 'customNether' instead he teleports to 'world_nether' (standard world).
    Is there a way to make it, so players teleport to the custom nether/end when they're in the customOverworld?

    Asked this already here, but this problem is really mocking me because I disbelieve that there isn't an easy fix to such a simple problem.
     
  2. Offline

    NukerFall

    Just override the teleport and use p.teleport(new Location(Bukkit.getWorld("customOverworld"), x, y, z). No way you can link this like miencraft does. Also you can check PortalCreate event and set PortalType as CUSTOM. Then use PlayerPortalEvent and set setCanCreatePortal to true. I don't see any other solutions here
     
    Last edited: Mar 26, 2020
  3. Offline

    wand555

    @NukerFall
    The thing is, it should seem like a normal portal to the player.
    player ignites portal -> player walks through portal -> player spawns in nether (with nether portal)
    Same goes vice-versa. Only way of doing that as of right now is to just do, what minecraft does.
    Listen to PlayerPortalEvent, setCanCreatePortal to false (so no portal is created in the standard world), get the playerLoc multiply it by 8 and then load the chunks at the custom nether and search for a spot to create a portal, create it and then teleport the player there.
    But this seems so overly complicated because I need to consider the other things minecraft usually takes into account, like the 1024 block radius when spawning a new portal, etc...
     
  4. Offline

    NukerFall

    I told as much is i knew, only bukkit javadocs can help you now ;)
     
  5. Offline

    wand555

    Sadly bukkit docs don't provide an elegant way of doing this :(
     
  6. Offline

    Dai_Kunai

    So the playerportalevent occurs when a player uses a portal to teleport. Just check if it's a nether portal and not and end portal, and then if it is, set the event as cancelled and instead teleport them to your own new location. Tell me if it works out! :D
     
  7. Offline

    wand555

    @Eccentric_Gamer I'm looking for a way, so the player doesn't notice it. A portal should also be generated in the nether. Right now I'm starting to just "copy" what minecraft does.
     
Thread Status:
Not open for further replies.

Share This Page