Fabric API

Fabric API

152M Downloads

[Feature Request] Client Lifecycle events for ClientWorld

Ampflower opened this issue ยท 3 comments

commented

This would allow mods that retain ClientWorld outside of ClientWorld itself to clean up.

An example of something that could benefit is Fabric Rendering API's WorldRenderContextImpl, retaining a world when not in any world.

This can also allow mods to make their necessary changes regarding ClientWorld in a more clean entrypoint, compared to mixining in manually.

MinecraftClient's setWorld function would likely be sufficient for most, but if you'd like to provide the outgoing ClientWorld to mods, you'll want to hook into disconnect, enterConfiguration and joinWorld as Mojang doesn't make setWorld actually set the world as of 1.21.1.

The API can realistically mirror the server lifecycle's equivalent for ServerWorld.

commented

Does the ClientWorldEvents.AFTER_CLIENT_WORLD_CHANGE event implemented in #4173 not suit your needs?

commented

Seems that's been in there for a while. Wonder if that came well after 1.21.1 or the environment had an outdated Fabric API, since I didn't see that class trying to look for similar.

commented

Yeah it looks like the environment had a well out of date Fabric API, my bad.

Yeah 4173 suits my needs enough; I just needed a stable event to call cleanup from. Thank you.