Multiverse-Core

Multiverse-Core

6M Downloads

[1.16.4] Nether portals doesn't see the corresponding portal in overworld

TEXHIK opened this issue ยท 38 comments

commented

Information

Details

Description
Nether portals in nether spawns new portal in overworld instead of using existing one, which was used to enter the nether.

Steps to reproduce

  1. Make a nether portal anywhere in the world. (Original-Overworld)
  2. Go to the nether (it will create a portal, Generated-Nether)
  3. Go back to overworld
  4. Destroy Original-Overworld portal and build a new one in (Shifted-Overworled) some distance, but within vanilla search radius (1024 for overworld)
  5. Go through Shifted-Overworled portal. You will find yourself in Generated-Nether portal.
  6. Step out and back into Generated-Nether portal
  7. Now the problem is:

Expected behavior
You'll spawn in Shifted-Overworled

Feal behavior
The game creates new portal in overworld instead

Screenshots
A portal in overworld, linked to portal in nether
2020-12-21_19 25 45

A nether portal, to wich first portal is linked
2020-12-21_19 25 50

A new portal, generated when returning from th nether
2020-12-21_19 26 03

commented

Hi, I'm running through this same issue on Paper 1.18.1.

Full output of /mv version -p: https://pastebin.com/v9gGfYnR

Any help would be appreciated.

commented

I also have the same issue on Paper 1.20.2.
Again, help would be appreciated :)

commented

I'm not sure, but please give Paper a try.

commented

Tried on latest paper (339) - working as on 1.16.2 That's wired, but thanks anyway.
One last question - am I right, that there is no possibility for multiverse to make custom portal-search radius anymore for later versions of spigot?

commented

In version 5 of MV we will either fix or remove the custom portal search radius option.

edit: it is possible, just difficult as it is now.
It will be easier for us in version 5.

commented

This is not a bug, Mojang changed the search radius to 128 when entering the nether, as of 1.16.2. If you'd like the old behaviour, use Paper instead of Spigot, as they haven't updated to match the new value. And when they do update it, they said it will be configurable.

commented

This is not a bug, Mojang changed the search radius to 128 when entering the nether, as of 1.16.2. If you'd like the old behaviour, use Paper instead of Spigot, as they haven't updated to match the new value. And when they do update it, they said it will be configurable.

First of all, vanilla changed from 257*257 blocks to 17 chunks, but it is still the same radius (even larger). And this change was made in 1.15. There are no changes in 1.16.3 or 1.16.4 about portals.

And the second is - i'm talking about exiting the nether, not entering. Portals are linked and worked completely ok in 1.16.2, but after 1.16.4 update, the overworld portal are regenerated, not the nether one. And I think there may be something wrong with *8 translation between the overworld and the nether, because 128 radius when entering the nether equals to 1024 when coming back.

P.S. one more thing - if I get to that portal from overworld, at least one of it's blocks MUST be linked back to the source portal, if there is no other portals within smaller range. It's not an intended behavior, when portals linked in one way, but unreachable in other way - the only intended here is override, but there not the case - a new portal is created on return.

commented

I might be mixing up the direction, but I'm certain the radius was changed in 1.16.2. If you don't believe me, see for youself, https://bugs.mojang.com/browse/MC-197538.

If that's the same issue you're facing, then as I mentioned above, this is the new Vanilla behaviour as of 1.16.2. If that's NOT the issue you're facing, then my apologies for misunderstanding (the whole thing confuses me a bit).

commented

I might be mixing up the direction, but I'm certain the radius was changed in 1.16.2. If you don't believe me, see for youself, https://bugs.mojang.com/browse/MC-197538.

If that's the same issue you're facing, then as I mentioned above, this is the new Vanilla behaviour as of 1.16.2. If that's NOT the issue you're facing, then my apologies for misunderstanding (the whole thing confuses me a bit).

The problem is in 1.16.4 in 1.16.2 all works fine.

going through a Nether portal in the Overworld

No. My problem is when goingh thorugh portal in the nether., and:

The linking radius is unchanged in the Overworld.

I can now see, where you might be confused. I'll rewrite reproduction part so you understand the problem better.

commented

Updated reproducing section, check it out. If still confused - I could upload a video.

commented

How recently did you update to 1.16.4?

edit: and from what version did you update?

commented

I've updated just yesterday, tody found a bug. Then I've updated all Multiverse modules installed (Core, Inventories, NetherPortals and SignPortals for me), but there still was a bug, so I come here.
Preveous versions were:
This server is running CraftBukkit version git-Spigot-b5a13e6-a05df28 (MC: 1.16.2) (Implementing API version 1.16.2-R0.1-SNAPSHOT)
Multiverse-Core Version: 4.1.0-b775

commented

Okay, then it might still be as I suspected, as Spigot only began to match the 1.16.2 behaviour a couple weeks after the 1.16.4 release. So if it is as I suspect, using Paper should solve your issue.

I'll also note that the value you've set in the MV config (portalsearchradius: 1024), actually has no effect. It broke when 1.14 was released and there's no feasible way for us to fix it for all versions. Paper also has a setting for this.

commented

Okay, then it might still be as I suspected, as Spigot only began to match the 1.16.2 behaviour a couple weeks after the 1.16.4 release. So if it is as I suspect, using Paper should solve your issue.

I'll also note that the value you've set in the MV config (portalsearchradius: 1024), actually has no effect. It broke when 1.14 was released and there's no feasible way for us to fix it for all versions. Paper also has a setting for this.

But why is it work fine when I go TO the nether? Link from world to nether is still working, however in the bug you mentioned, only Nether linking was changed.
https://www.youtube.com/watch?v=scp0Rfcu9AM

commented

I can confirm this issue...

In Paper it works (portal-search-radius set to 128)
It starts to have issues in paper with 32 or less it seems.

BUT: portalsearchradius in Multiverse's config.yml should do the same...
but it is not... (yet?)

commented

not yet as it will break compatibility with older mc versions.

commented

OK, did a fix myself using PlayerPortalEvent until it's fixed by Spigot and/or Multiverse ;)

commented

To be shure, that this is a bug, and NOT vanilla change: exported world from server and joind in single player. Links are working correctly, as I sayed.
128 is distance in nether blocks:
[(OverWorld_portal_block_coords / 8) ... NetherWorld_portal_block_coords] <=128
The bug is that in OW portal must be searched 1024 blocks as of vanilla rules:
[(NetherWorld_portal_block_coords * 8) ... OverWorld_portal_block] <=1024

BUT: portalsearchradius in Multiverse's config.yml should do the same...

The problem is not in config (at least this issue not about it). Bug is in vanilla behaviour. If you recheck the video, you'll see, that link is broken when finding overworld portal, which radius Was. Not. Changed.

I think, that may be spigot/multiverse somehow brake because of the fact, that now there is two different radiuses - one when going to the nether, and another when going back. And the core of problem should be somewhere, where there is only one constant/variable is used in both transfers.

commented

I also had some issues with this... (as mentioned before)
Going from overworld to nether my radius was 16.
Coming back from nether to overworld the radius was still 16!

For some reason (i don't know why!) the radius has changed now (before the plugin interferes!)
Coming from nether to overworld radius now is 128 ! Nice...
BUT: going to nether the radius is still 128!
STRANGE...
It seems that the radius IS changing somehow... but not atthe right moment...

I think it's spigot itself, and not multiverse...

commented

I can confirm it's spigot bug. I've just run into the issue playing plain spigot and ended here looking for a solution.
I am not sure if the last version fixes this, the version I'm using is
git-Spigot-628435a-b5e5adc (MC: 1.16.4) (Implementing API version 1.16.4-R0.1-SNAPSHOT)

commented

This is not a bug. It's an undocumented change Mojang made in 1.16.2. The change was added to Spigot in 1.16.4.

The change is reversible in Paper's config file, so if you'd like the old portal behavior, use Paper.

commented

This is not a bug. It's an undocumented change Mojang made in 1.16.2. The change was added to Spigot in 1.16.4.

No, it is not. Try it yourself in vanilla.

However, I agree with NicolasDer, that it's a spigot bug - coordinates calculation is not in multiverse.

commented

If you believe that this is in fact a bug, then I will repoen this and retest it when I get the chance. If I conclude there is a bug, I will report it to Spigot.

commented

If you believe that this is in fact a bug, then I will repoen this and retest it when I get the chance. If I conclude there is a bug, I will report it to Spigot.

I checked core and nether portals - the only thing with coordinates is changing world. The actual numbers are not calculated nither in core nor in netherPortals, so I think for multiverse it is not a bug.

commented
commented

There is only a coordinate conversion in MV NetherPortals, https://github.com/Multiverse/Multiverse-NetherPortals/blob/main/src/main/java/com/onarandombox/MultiverseNetherPortals/utils/MVLinkChecker.java.

But this seems correct to me.

Yes, it is actually what I was writing about. The only thing MV does - it rescale coordinates, but finding the portal isn't changed, it's already done in spigot event. So this issue shoul be forwarded to spigot.

commented

Paper is based on Spigot, and therefore any bug in Spigot can affect Paper.

If you look at MV's code, you will see that MV does not modify anything about the portal search radius, nor does MV do the searching itself, that is a task handled by the server. This is why I said I believe this bug is a Spigot bug.

The last piece of information you provided does sound like it will be helpful in figuring this out.

edit: With that last piece of info, I feel confident enough to debug this myself. I'll give it a shot tonight!
edit again: I had some trouble getting the debugger to work. I think I fixed it, but I don't have any time to debug anymore, so I'll leave it for another day.

commented

I am not sure that this is a Spigot issue. The reason is that I can replicate what appears to be the same Nether portal issue on my Paper server, but only when MV is installed. Here is the exact positions of my Nether portals, and the behavior before and after MV is installed.

Nether portal data

  • Nether portal A in the overworld
    • X: 1148
    • Y: 186
    • Z: -2338, -2339
  • Nether portal B in the Nether
    • X: 147
    • Y: 143
    • Z: -283, -285
  • Nether portal B converted to coords in the overworld (multiplied by 8)
    • X: 1176
    • Y: 143
    • Z: -2264, -2280
  • Distances in each coords of Nether portal A and B in the overworld
    • X: 1176 - 1148 = 28
    • Y: 186 - 143 = 43
    • Z: max distance is -2264 - (-2339) = 2339 - 2264 = 75
  • Max cubic distance between portal A and B overworld locations
    • sqrt(28^2 + 43^2 + 75^2) = 90.9
  • Generated Nether portal C in the overworld after stepping into Nether portal B
    • X: 1176
    • Y: 143
    • Z: -2271, -2272

As you can see, the distance between portal A and B is 90.9, which is less than 128, so they should be linked.

Behavior before MV on Paper 1.16.5 (didn't test any earlier)

When stepping into portal A, it sends you to portal B. When stepping into portal B, it sends you to portal A. This is intended behavior.

Behavior after MV on the same server

When stepping into portal A, it sends you to portal B. This is normal. However, when stepping into portal B, it does NOT send you to portal A, but instead generates a new portal, portal C. Note that this portal's location is exactly the location of portal B in the overworld.

The interpretation of what is happening is that when stepping into portal B, it checks for nearby portals, somehow misses portal A, then tries to generate a portal at the closest viable location. It happens to be over an ocean so there are no viable locations, so it generates it in mid air at exactly the spot portal B translates to.

commented

I found another piece of data that might shed light on the issue. I was not able to reproduce this issue on the main world listed in server.properties, however I was able to reproduce it on other, non-main worlds.

commented

I found another piece of data that might shed light on the issue. I was not able to reproduce this issue on the main world listed in server.properties, however I was able to reproduce it on other, non-main worlds.

Hmm, good point - my world's are not default too, not tested on default worlds.

commented

I found the problem. The problem is that by default, any nether portal that is not in the main nether world will have the main nether world as its destination. So the problem is that since the server originally thinks the portal is going to the main nether world, it reduces the search radius to 16 (128 / 8), but it does not take into account that the world may change after the event propagates. I have an idea which I will propose to Spigot on how to fix this.

edit: Here it is. I tested this change and it has indeed solved the problem, https://hub.spigotmc.org/jira/browse/SPIGOT-6347.

commented

I did do some testing last night and found the same thing. The vanilla world was not affected by this bug. That piece of info makes me think this will be a simple problem to solve. I will post any updates here.

commented

I am providing a custom Paper build here with one added patch. The added patch simply makes the server send nether portals to the overworld when you are in any nether world. The previous behaviour is to only send a nether portal to the overworld if you are in the main nether world. This build will fix this issue and it's up to date with Paper Build 467.

It's too large to upload here or to upload to Discord, so I've uploaded it to Google Drive (fixed in CraftBukkit).

commented

That's great! Thanks so much. My last question will be when this is expected to bubble up to a standard Paper build. I am following the Spigot bug you posted - I imagine the process will be that patch is done, then Paper will merge in that patch at some point? I don't know the details of how those projects are linked. Thanks again for all your work on this.

commented

Yes, you're right. Paper keeps in sync with any changes Spigot makes every couple days. So if/when Spigot makes this change, it will be in Paper within a few days.

commented

Perfect, thank you so much!

commented

The fix is now in Spigot, so I'll close this issue when it reaches Paper.

commented

Paper Build 468 includes the fix.

Sorry this took a while to get fixed.