papermc/patches
1stGlitch 581b101180
Add world to Entity AddTo/RemoveFrom Events (#10183)
When a plugin listens to the EntityAddToWorld and EntityRemoveFromWorld events, I don't believe there is currently any method of directly obtaining which world the entity was actually added to/removed from. Using event.getEntity().getWorld() works in many cases, but not all. Specifically, when an entity is teleported from one world to another, the location of the entity is updated prior to the removal event being called. This means that when an entity goes through a nether/end portal or is teleported between worlds with a command, a plugin listening to the EntityRemoveFromWorldEvent has no way of determining which world the entity was actually removed from (without relying on other events).

To resolve this, I've added the world as a field in the events along with a getter to retrieve it. I also removed an unused import and made the documentation more clear on the event behaviour when chunks load/unload.
2024-01-23 15:17:14 -05:00
..
api Add world to Entity AddTo/RemoveFrom Events (#10183) 2024-01-23 15:17:14 -05:00
removed [ci skip] Add more patch identifying comments 2024-01-22 18:04:55 +01:00
server Add world to Entity AddTo/RemoveFrom Events (#10183) 2024-01-23 15:17:14 -05:00