Fabric API

Fabric API

106M Downloads

Hooks for chunk unload and world unload

fnuecke opened this issue ยท 1 comments

commented

Hooks/events for these two are (among other things) useful to allow BlockEntities to have a guaranteed "dispose" callback, e.g. in case they hold some unmanaged resource (such as GL memory). Relying on finalizers for this is suboptimal. Maybe even implement them as an interface BlockEntities can implement. Might be fine to just call invalidate, even, that'd need some proper thinking about tho.

My quick and dirty mixins currently look like this for world unload (which is really just the set world in MinecraftClient, does not handle actual world unloading on server e.g., mostly because I couldn't figure out if that even happens in vanilla MC or if dim unloading was just a Forge thing), and like this for chunk unloading, which is bad if every mod has to mixin the loop themselves.

commented

This has been implemented in lifecycle-events-v1.