[Bug]: The End Exit portal does not teleport to overworld spawn
Maddin-M opened this issue ยท 6 comments
/mv version -p
output
Server logs
Server Version
[00:15:06 INFO]: Checking version, please wait...
[00:15:06 INFO]: This server is running Paper version 1.21.3-80-master@c2294d7 (2024-12-01T23:55:39Z) (Implementing API version 1.21.3-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.1-52-e08e667 (MC: 1.21.1)
Bug Description
After defeating the Ender Dragon the Exit Portal is supposed to take you to the spawn of the overworld. Using Mutliverse, it takes me to the 0,0 coordinate of The End. Removing the plugin and restarting the server fixes the issue.
Steps to reproduce
- Create a new 1.21.3 server using Paper
- Add Multiverse Core 4.3.14 to the plugins dir
- Start server and join
- Go to The End and defeat the Ender Dragon
- Step into the Exit Portal
- You will most likely be teleported on top of the Exit Portal instead of the Overworld Spawn location
Agreements
- I have searched for and ensured there isn't already an open or resolved issue(s) regarding this.
- I was able to reproduce my issue on a freshly setup and up-to-date server with the latest version of Multiverse plugins with no other plugins and with no kinds of other server or client mods.
Now that the issue was moved to MV-NP: Adding the NetherPortals plugin yields the same result.
After debugging for a bit, I could see that the event in the playerTeleport(PlayerTeleportEvent event)
EventHandler might be at fault (Link to line).
event.getTo()
returns
Location{world=CraftWorld{name=lobby_the_end},x=0.0,y=60.0,z=0.0,pitch=0.0,yaw=0.0}
instead of lobby
, the normal world. It seems to me that MV edits this event somewhere, but I couldn't find the exact point yet.
Now that the issue was moved to MV-NP: Adding the NetherPortals plugin yields the same result.
Oh, is this occurring without MVNP? I'll move it back
I'm starting to believe this is an issue on my end, as I had some more time for testing, and went back as to MC 1.16 and MV 4.1.0 and this still happened for me (on freshly generated worlds), and I don't believe this is an issue for this long. I'd love to know if someone can reproduce this using my steps.
So, I stumbled upon this issue: PaperMC/Paper#8469 and quickly hacked this together as a workaround, which works fine for me:
@EventHandler(priority = EventPriority.HIGHEST)
public void entityPortalEnter(EntityPortalEnterEvent event) {
var world = event.getLocation().getWorld();
var isEnd = world != null && world.getEnvironment() == World.Environment.THE_END;
var isEndPortal = event.getLocation().getBlock().getType() == Material.END_PORTAL;
var entity = event.getEntity();
if (isEnd && isEndPortal && entity instanceof Player) {
var overworldName = world.getName().replace("_the_end", "");
var overworld = worldManager.getMVWorld(overworldName);
if (overworld != null) {
Logging.finer("Teleporting player from end portal to overworld spawn");
plugin.getServer().getScheduler().scheduleSyncDelayedTask(
plugin, () -> entity.teleport(overworld.getSpawnLocation()), 1L
);
}
}
}