HomeJavaModsRedstoneRegions
RedstoneRegions
ModsJava

RedstoneRegions

by modmass · on Modrinth

Per-chunk redstone speed-up on Folia (2-14× faster). Pick vanilla / Alternate Current / Eigencraft / Disabled per chunk. /undo, sign opt-in, BlueMap…

⬇ Download on Modrinth

RedstoneRegions

Per-chunk redstone engine switching for Folia. Mark a chunk and its wire ticks 2-14× faster; everything else stays vanilla.

If you've run a big server you know the tradeoff. You can set redstone-implementation: alternate-current in paper-world.yml and get a huge speedup globally. Then some player's piston BUD farm from 2019 quietly stops working and you spend a week figuring out why. Or you keep everything vanilla and watch a 64×64 dust floor eat your tick budget. It's an all-or-nothing switch, and neither "all" nor "nothing" is what you actually want.

So this makes it per-chunk instead:

/redstone-region set alternate-current     ← this chunk only
/redstone-region fill 8 alternate-current  ← 17×17 chunks around you
/redstone-region selection eigencraft      ← your WorldEdit selection
/redstone-region undo                      ← oh wait, no

The choice persists (stored in chunk PDC), survives restarts, and hot-swaps live, no restart or chunk reload needed.

The four engines

Mode Speed Notes
vanilla the default. Everything behaves like normal Minecraft.
alternate-current 2-14× Space Walker's algorithm. Two known edge cases, see below.
eigencraft 3-5× almost no edge cases. Good for piston/observer machinery.
disabled frozen wire never updates. For archived builds you want inert.

Numbers

My benchmark is a 32×32 dust grid, toggled from one lever:

Run Vanilla AC
Cold 234 ms 22 ms 10.6×
Warm JIT 41 ms 14 ms 2.9×
Pre-warmed 71 ms 5 ms 14.2×

The honest takeaway: the "14×" happens when vanilla is at its worst, steady-state is more like 3×. Either is a lot when the vanilla number blows a 50 ms tick. At 64×64 chunks of dust, vanilla overshoots a tick by 6×; AC stays under 2.

Cost when you're not using it: every wire update passes through a per-chunk dispatcher, which is a StampedLock optimistic read plus a switch, about 50 ns. If even that bothers you there's timing.mode: sample (~5 ns at sample-rate 10) or off (nothing at all).

What's in the box

The core is the per-chunk switching. Around that, mostly things I ended up needing while running it:

Install

Jar in plugins/, restart, stand somewhere, /redstone-region set alternate-current. That's the whole thing.

Requirements: Folia 1.21.11 build 6 or later (Luminol and other forks work), Java 21. BlueMap 5.16+, PlaceholderAPI 2.11.7+ and WorldEdit 7.3.19+ are all optional. For WorldEdit, prefer a Folia-patched build.

Does it actually behave like vanilla?

This was the part I was paranoid about, so there's an in-server test harness. Current results, 14/14:

How it works, short version

As of 1.21.2 Mojang exposes a RedstoneWireBlock.evaluator field. At boot we swap it for a dispatcher that checks the chunk's flag and routes the update to the right engine. The AC engine is a port of Space Walker's algorithm, modified to use per-thread WireHandlers. The bundled AC in Paper shares one handler across everything, which is a latent race once Folia runs regions in parallel.

Longer version with diagrams: docs/ARCHITECTURE.md.

The edge cases, honestly

Two patterns behave differently under AC and can break:

  1. piston BUDs that depend on the wire's self-shape-update at intermediate power levels
  2. observers counting power-level transitions on a wire

/redstone-region check scans a chunk and warns about both patterns before you flip it. If it finds something, either leave that chunk vanilla or use eigencraft, which has neither problem and is still 3-5× faster. That combination covers basically every machine I've come across.

Links

License

MIT. The bundled Alternate Current engine is also MIT. That's Space Walker's work, license in ac/LICENSE.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

Verified by MCModsHub

These come from our own check of the pack file, not from the source page.

Explore more