RedstoneRegions 图标

RedstoneRegions

作者:rebot | 分类:模组

价格:0 墨喵币 下载量:0 点赞:0 版本 0.2.3+26.2
本资源为搬运资源,原资源地址: https://modrinth.com/mod/redstoneregions
资源信息

Minecraft 版本: 26.2

平台: folia paper purpur

标签: game-mechanics optimization utility

资源介绍

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:

  • WorldEdit selection support, so you can flip a whole machine room from //pos1 //pos2
  • a BlueMap overlay that draws colored rectangles over non-vanilla chunks, which turned out to be the fastest way to spot "wait, why is that chunk on AC"
  • an optional auto-scanner that flips chunks to AC when their vanilla redstone time crosses a threshold
  • [ac] signs so trusted players can flip their own chunks without bugging staff (permission-gated, radius-capped)
  • /redstone-region profile for a live per-chunk readout against the 50 ms budget
  • /redstone-region why x y z, which explains a wire's power level by walking its six neighbors. Sounds silly, saves so much time debugging
  • /redstone-region undo for the last batch, whatever caused it (set, fill, selection, sign, auto-scanner)
  • an audit log (JSONL, rolled daily, actor + UUID + reason on every flip) and an optional Discord webhook, because on a real server people will ask who touched their chunk
  • PlaceholderAPI placeholders, click-to-teleport chunk coordinates in chat, hot config reload
  • English and French included; drop a lang/<code>.yml for anything else

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:

  • byte-for-byte parity with vanilla across 8 contraptions over 60+ ticks each: dust line, 16×16 grid, 4-tick repeater clock, AND gate, comparator subtraction, torch ladder, torch inverter, dust zigzag
  • 596 toggles in a 30-second stress run, zero exceptions
  • 780 + 780 toggles running in two different Folia regions at the same time, zero races, zero thread-check failures (this is the case Paper's bundled AC can't currently pass under Folia)
  • 655 dispatches into the AC engine confirmed by counter, so the routing isn't silently falling back

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.

下载太慢?试试 墨喵加速站,支持 Modrinth 和外网直链高速下载! 用的人越多,下载的越快!
下载与版本
评论(0)
登录 后发表评论。

暂无评论,抢个沙发吧~

举报此资源

请登录后举报

🔥 相关推荐
armor chroma additions

价格:0 墨喵币
下载量:0

查看详情
AE2: Crafting Tree Refreshed

价格:0 墨喵币
下载量:0

查看详情
Stronghold Finder (One Eye Updated)

价格:0 墨喵币
下载量:0

查看详情
Mob Duplicate

价格:0 墨喵币
下载量:0

查看详情