RedstonecompilerСкачатьСкачать
ВЕРСИИ (2)
alpha
Redstonecompiler 0.2.0-alpha
0.2.0-alpha9 июн. 2026 г.124Minecraft: 1.20.1fabric, quilt
Что нового
### Critical Bug Fixes (3)
**Bug 1 — Output power discarded**
`CircuitManager.applyOutput()` called `updateNeighborsAlways()` without actually setting the redstone signal strength. The `power` value computed by the compiled circuit was silently dropped.
> Fix: replaced with `world.setBlockState(pos, state.with(POWER, clamped), 2)` — actually writes the signal value.
**Bug 2 — Input captured stale value**
`RedstoneWireMixin` injected at HEAD and called `ci.cancel()`, but `state.get(POWER)` returned the pre-update value. Vanilla's recalculation never had a chance to run.
> Fix: added `@Invoker("getReceivedRedstonePower")` to directly call the vanilla private method for the correct input signal strength.
**Bug 3 — Self-triggered infinite loop**
`applyOutput` → `setBlockState` → triggered `neighborUpdate` → Mixin intercepted again → called `onInputChanged`…infinite recursion.
> Fix: added `ThreadLocal<Boolean> APPLYING_OUTPUTS` re-entrancy guard, checked in all 3 Mixins (RedstoneWireMixin, BlockChangeMixin).
### Mixin Strategy Optimization
- **Before**: intercepted ALL circuit wire `neighborUpdate` calls, cancelled everything → signals couldn't propagate correctly
- **After**: only intercepts **INPUT nodes** (wires receiving external signals); non-input nodes pass through to vanilla logic normally
### Other Improvements
- `executedThisTick` deduplication: same circuit won't execute twice in the same tick
- `BlockChangeMixin`: added `isApplyingOutputs()` guard to prevent self-invalidation during output application
alpha
Redstonecompiler 0.1.0-alpha
0.1.0-alpha9 июн. 2026 г.27Minecraft: 1.20.1fabric, quilt
Что нового
## 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