The problem
Coasters Simulated has four hot paths that run inside Sable's pre-physics tick. Each one was written as a same-tick de-duplication guard:
if (cached.gameTime == gameTime) return cached.value;
gameTime advances every tick, so that condition is only ever true inside a single tick. The guard never fires across ticks, and every one of these paths runs in full, every tick, forever.
The most expensive one is the cart bearing scan. It walks every chunk and section of a sublevel's plot and reads all 4096 block positions per section:
for each loaded chunk
for each non-air section
for x in 0..15, y in 0..15, z in 0..15
getBlockState(x, y, z)
That scan runs for every sublevel on the server, including the ones that have no coaster cart in them at all — contraptions, machines, platforms, doors. In a base with a lot of assembled structures, that is a very large amount of block lookups per tick for a result that cannot change in a single tick anyway.
The other three paths are the same shape: per-sublevel rivet disassembly checks, a teardown-and-broadcast pass for sublevels that stop being carts, and a full train-link restore for every dimension.
What this mod does
It replaces those same-tick guards with real throttles. Nothing about the coaster logic changes — the checks still run, just not 20 times a second for no reason.
- Bearing plot scans — cached for 40 ticks (2s) on sublevels that do contain a cart, and 100 ticks (5s) on sublevels that do not. The 100-tick case is where most of the win is.
- Rivet disassembly checks — the single-rivet enforcement runs at most once per 30 ticks, the self-hosted pop check once per 20 ticks.
- Cart teardown broadcasts — a sublevel that stops being a cart is cleaned up and broadcast once, on the transition, instead of on every tick thereafter.
- Persisted train links — restored once every 60 ticks (3s) per dimension instead of every tick.
What it does not change
- No gameplay changes. No block, item, recipe, or physics constants are touched.
- No client changes. The network protocol is untouched, so clients can keep running the stock 0.1.5 jar. Install this on the server only.
- No new controls or GUI. It is invisible in game.