
Redstonecompiler
JIT-compiles redstone circuits to bytecode for faster large machines.
Список изменений
Core Features
Circuit Detection ✅ — CircuitDetector scans redstone wires/repeaters/comparators connectivity graph, identifies closed circuits
Bytecode Compilation ✅ — BytecodeGenerator uses ASM to dynamically generate Java class, compiles circuit logic into native bytecode
Circuit Management ✅ — CircuitManager manages compiled circuit lifecycle, replaces vanilla redstone update calls
Mixin Injection ✅ — 3 Mixins intercept vanilla redstone update entry points (RedstoneWireMixin, WorldMixin, BlockChangeMixin)
Input Response ✅ — On redstone signal change triggers onInputChanged, calls compiled circuit to recalculate output
Supported Redstone Components
Redstone Wire ✅
Repeater ✅
Comparator — COMPARE mode ✅
Comparator — SUBTRACT mode ✅
NOT expression ✅
GreaterThan expression ✅
Subtract clamp [0,15] ✅
Configuration System
7 config options: enable toggle, detection range (chunk radius), compilation mode (aggressive/normal/passive), max circuits per tick, debug mode, log compiled circuits, skip redstone wire
Cloth Config GUI (optional dependency, won't crash without it) Mod Menu integration, config button entry
i18n support: zh_cn.json + en_us.json, auto-switches following game language Code Quality
Dependency tiers: depends (required) / recommends (recommended) / suggests (suggested) strictly separated
ASM not JiJ-bundled: provided by Fabric Loader at runtime, avoids classloader conflict
Client entrypoint: RedstoneCompilerClient ensures Mod Menu correctly identifies it as "Mod" not "Library"
Global error guard: main onInitialize() try-catch prevents silent crash hiding WeakHashMap cleanup cap: MAX_WORLD_ENTRIES=100 prevents memory leak Not Yet Implemented
Dynamic circuit recompilation (auto-invalidate and recompile on circuit structure change)
Full server-side testing
Circuit visualization debug overlay
Full modeling of pistons/observers and other non-signal components
