Repository navigation
Entity change world event - #14437
Codestech1 wants to merge 3 commits into
Conversation
|
I think we'd be best off making the Player event extend this one then? |
Alright, I can change it in a moment, but I need to update the branch with latest changes first. |
I've just looked at |
# Conflicts: # paper-server/patches/features/0003-Moonrise-optimisation-patches.patch # paper-server/patches/features/0016-Optimise-EntityScheduler-ticking.patch
149a42b to
d2e4410
Compare
|
Rebased with latest changes. |
|
Eh, right, PlayerEvent does not extend entity event... Rather unfun for us (we cope that event interface moves happen at some point). This event at least sounds sane, I think we are not going to be too happy with #14440 so maybe it is worth exploring other solutions if/once people reviewed on #14440. Otherwise I guess this event is fine then ™️ |
Unfortunate for me, though I think I get why. Well, it is unlikely for an entity to move when it's not tracked, but it's still possible from what I get. Is there any chance for that event to be merged if I changed it to entity change chunk event for example? I'll leave that pull request alone for now though until there's any feedback. |
Adds an event that is called whenever an entity changes their world. I'm aware of that EntityTeleportEvent exists, but I decided to PR this new event because it can be very useful in some situations.
For example, I'm implementing a wrapper over Bukkit entities in my plugin that can be used to obtain those entities at any time, even if they are unloaded. It's done by storing their unload locations, and then whenever an entity instance is needed, chunks at unload locations are requested to be loaded. But since entities can teleport to unloaded chunks, and those chunks are not fully loaded after teleporting, the unload location needs to be manually updated when changing worlds of entities.
EntityTeleportEvent indeed could be used for my use case, but it would be pain to implement as I need to ignore the following EntityRemoveFromWorldEvent (I listen to that event to store unload locations), because it is fired before the new entity is placed, and as I said, chunk of the new entity is not loaded. This means that both EntityTeleportEvent and EntityRemoveFromWorldEvent are called while the entity is still in the previous world, and there is no event called in the new world. This is the perfect example where EntityChangeWorldEvent would be handy, because it is called after the world change.