Hi!
I am trying to implement villagers following the player and want this to be possible also across dimensions. Now the problem is that the villager can't follow into a portal if his dimension gets unloaded too quickly. That's why my idea is to watch out for an event where the villager gets unloaded and teleport him to the target dimension then. But I found out that the EntityLeaveWorldEvent is generated rather rarely, probably when some dedicated entity cache overflows or something and certainly not just when the player changes the dimension. If the event hasn't been generated yet, the entity might still not receive ticks anymore because of the quite sophisticated Minecraft ticking functionality.
I checked the code but couldn't find any Forge events generated when ticking of an entity starts and ends. From what I understand is that ticking entities are managed by net.minecraft.world.level.entity.EntityTickList. There, the events could maybe be generated. Of course, I could hack around it, but in my opinion a Forge event would be appropriate here. Am I missing something? If not, could you please introduce this?