Scarpet: Add `__on_chunk_unloaded(x, z)`
James103 opened this issue ยท 1 comments
As of Carpet mod 1.4.70, __on_chunk_loaded
exists as a bindable event for a Scarpet app, but there is no equivalent __on_chunk_unloaded
event.
If and when __on_chunk_unloaded
is implemented, it would take in x
and z
parameters which are the lowest x and z coordinates of the chunk that is about to be unloaded. The event would be called right before the chunk unloads, allowing an app to save some info related to the chunk such as when it was last loaded and unloaded.
For example, an app needs to calculate offline progress on a chunk by chunk basis because it, for example, massively slows down crop growth, therefore requiring extra random ticks when the chunk loads in order to catch up. Without this event, said app would need to update the last loaded time of each chunk every game tick or every second, which would impact server performance more than the proposed event.