NeoForge icon indicating copy to clipboard operation
NeoForge copied to clipboard

Added target level to teleport events

Open HenryLoenwind opened this issue 1 year ago • 2 comments

Implements #1526

Added the target level to EntityTeleportEvent (and its sub-events). Changing it is supported where the teleporting code already supports it, although this feature could need some additional testing.

I decided to carry around a Level instead of a ServerLevel because the event wasn't confined to the server side before, even though it pretty much is a server-side-only functionality. Forcing a ServerLevel would be breaking for mods that fire the event for their own teleporting on both sides. Changing this in the next breaking phase may be desirable.

Adding this without breaking the old constructors adds a potential for mod incompatibility between mods that do dimension teleporting and fire the event with the old constructors and mods that handle the events and read/write the target level. This sadly is unavoidable when adding fields to an event that is fired by mods. I added a warning to the javadoc to reduce the risk.

HenryLoenwind avatar Sep 10 '24 04:09 HenryLoenwind

  • [ ] Publish PR to GitHub Packages

Any opinions on the "api-ness" of those 3 fields? In my eyes, them being protected was a mistake (they have unrestricted getters and setters) and nobody should access them directly.

HenryLoenwind avatar Sep 10 '24 08:09 HenryLoenwind

@HenryLoenwind, this pull request has conflicts, please resolve them for this PR to move forward.

Given the lack of activity and the need for a rebase, I'll be closing this PR for now. Feel free to open it again after the conflicts are resolved.

Matyrobbrt avatar Apr 19 '25 10:04 Matyrobbrt