[Suggestion] Check if player online to automatically disable chunk loader.
Kurunoa opened this issue ยท 4 comments
This is an important consideration for server modpacks such as All The Mods 7.
Please add a config option like:
# Chunk loader will check every 1 minute if player is online. If player is offline greater than this value, chunkloader switches itself off.
#Range: 0.0 ~ 9999.0 minutes
chunk_loader_offline_time = 15
This example would make the loader turn itself off after 15m of the player not being online.
Of course, if you set it to 0, it just stops immediately.
Very public-server friendly.
Another mod dev suggested the following design:
When player logs off, start a timer for x minutes.
When the timer expires, turn off the loader.
If the player logs on, cancel the timer.
I'm not currently storing who owns the chunk loader, which is kind of the issue.
@ryyanmapes Little Logistics uses a system that lets a player register an entity (or a group of entities if linked), and then the server will handle chunk management for them on a per-player basis. The chunks aren't loaded as ticking chunks - instead they are loaded as non-ticking and entities in a "train" are ticked individually.
We are planning to make this available as a library for other mods, would you be interested?
See this for an example: https://github.com/MuradAkh/LiteLoadLib/blob/main-1.19/src/main/java/dev/murad/liteloadlib/examples/MyExampleEntity.java
You would probably want to add it as a special minecart, and have it keep track of all linked minecarts.
The system is designed to prevent chunk loader minecarts from being abused as stationary chunkloaders.