MinecartChunkLoader

MinecartChunkLoader

Long rail lines stall when a cart runs past the edge of the loaded world. This plugin keeps the chunks around moving minecarts loaded, so the cart carries its own loading window with it.

29 downloads
1 followers

MinecartChunkLoader

Long rail lines stall when a cart runs past the edge of the loaded world. This plugin keeps the chunks around moving minecarts loaded, so the cart carries its own loading window with it.

Parked carts cost nothing. Chunks behind the cart unload again on their own.

How it works

Every scan-interval-ticks the plugin walks the loaded minecarts in each enabled world and adds a Bukkit plugin chunk ticket to the square of chunks around each one. Each ticket carries an expiry tick that is pushed forward every time it is refreshed. Tickets that stop being refreshed lapse, and the chunks behind the cart unload normally.

Because a ticketed chunk stays ticking, the cart keeps moving, which keeps the next chunk ticketed — the loading window travels with the cart.

Features

  • Tracks only carts that are actually moving, with a configurable grace period so a cart pausing at a station or a junction does not immediately drop its chunks.
  • Global chunk cap (max-loaded-chunks). When the cap is hit, occupied carts are served first, then the chunks nearest each cart — so a runaway hopper-cart farm cannot eat your server.
  • Per-world allow/deny list.
  • Per-variant filtering — track all minecarts, or only CHEST_MINECART, or only carts with a passenger.
  • Idles on an empty serverrequire-players-online skips all work when nobody is online.
  • Everything runs on the main thread in a single repeating task. No async Bukkit access.
  • Tickets are released on WorldUnloadEvent, so the plugin never blocks a world unload.
  • No dependencies.

Commands

Command Description
/mcl status Chunks held, carts tracked, current settings, per-world breakdown
/mcl reload Re-read config.yml and restart the scan task

Both require minecartchunkloader.admin (default: op). /minecartchunkloader is the full name.

Configuration

plugins/MinecartChunkLoader/config.yml:

Key Default Notes
radius 2 Chunk radius per cart. 2 = a 5×5 square = 25 chunks. Max 16.
scan-interval-ticks 10 A powered cart covers ~4 blocks in 10 ticks, well inside a radius-2 square.
keep-alive-ticks 100 How long a chunk stays ticketed after its last refresh.
require-moving true Set false to keep every cart's surroundings loaded permanently. Expensive.
stationary-grace-ticks 60 How long a stopped cart still counts as moving.
movement-threshold 0.05 Blocks of travel between scans needed to count as movement.
require-occupied false Only track carts with a passenger.
require-players-online true Skip all work on an empty server.
max-loaded-chunks 512 Global cap across all worlds.
minecart-types [] Empty = all variants. e.g. [MINECART, CHEST_MINECART].
worlds.mode / worlds.list allow / [] allow = only listed worlds, deny = all but listed. Empty list = every world.
debug false Logs cart and chunk counts every scan.

Sizing it

Worst case is active carts × (2 × radius + 1)² chunks. At the defaults that is 25 chunks per cart, so max-loaded-chunks: 512 covers about 20 carts moving at once. Raise the cap, or drop radius to 1 (9 chunks per cart), if you run a busy rail network.

Installation

  1. Drop the jar into your server's plugins/ folder.
  2. Restart. The default config is written to plugins/MinecartChunkLoader/config.yml.
  3. Tune radius and max-loaded-chunks to your rail network, then /mcl reload.

Compatibility

Built and tested against Paper 26.2 (paper-api:26.2.build.65-beta, Java 25). Requires Paper or a Paper fork — it uses the paper-plugin.yml bootstrap, so plain Spigot/Bukkit is not supported.

Folia is not supported. The plugin uses a single global repeating task rather than Folia's regionised scheduler.

Verified behaviour

Tested on a live Paper 26.2 server:

  • Plugin enables cleanly, api-version: 26.2 accepted.
  • Moving carts acquire tickets (25 chunks for one cart at radius 2).
  • Tickets refresh while the cart moves and are released ~keep-alive-ticks after it stops.
  • /mcl status and /mcl reload work from console and in-game.
  • Clean disable with all tickets released.

No gallery available for this project.