[SPIGOT-4566] Recent commit may set teleport cause to NETHER_PORTAL even for End portals? Created: 07/Jan/19  Updated: 07/Jan/19  Resolved: 07/Jan/19

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor
Reporter: David Precious Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None

Version: git commit 6e842759cc
Guidelines Read: Yes

 Description   

I think commit 6e842759cc may have inadvertently introduced a minor bug, but unfortunately I haven't had time to test it out yet to confirm - but if I don't raise it, I'll forget. If I get time to verify this myself, I'll update/close the ticket as appropriate.

The change in the commit checks if the destination world is different to the current world, and if so, calls entity.teleport() with:

entity.teleportTo(location, cause == TeleportCause.NETHER_PORTAL);

So, if I'm reading right, the cause would suggest it was a nether portal even if you were going through an end portal to the End (when it should be TeleportCause.END_PORTAL instead).

Impact is unlikely to be massive, but could catch some people out.



 Comments   
Comment by md_5 [ 07/Jan/19 ]

teleportTo is a backend non api method so won't be documented.

I've looked at the code again and the implications of that parameter.
They are 1) That exit position is modified based on velocity, and 2) that EntityPortalExitEvent is called.

I think since teleport is more of a setLocation method, this shouldn't happen, so I'm going to push out a commit that just makes it false instead.

Comment by David Precious [ 07/Jan/19 ]

... I somehow completely missed that, despite reading that bit of code twice.

I either need more sleep or better glasses, or perhaps both.

It still puzzles me as I haven't been able to find any doco for entity.teleportTo(), only entity.teleport(), so I'm not entirely sure what that last parameter is for, but it seems this is fine.

Sorry for the noise!

Comment by md_5 [ 07/Jan/19 ]

The commit was ported from spigot where it has been for years. It certainly hasn’t changed behaviour for anyone running Spigot.

Look at the code closely, its two == not one

Generated at Sat Dec 13 13:43:40 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.