blockswap-neoforge-1.21.1-beta-1.1.jar
Curse Maven Snippet
What's new
Key Features & Additions
1. Natural Generation Only Mode (onlySwapNaturalGeneration)
- New Configuration Option: Added the
onlySwapNaturalGenerationboolean setting toblock_swap.json5(default:falsefor backwards compatibility). - Behavior when
true:- Swapping applies strictly during world generation: terrain noise, surface blocks, ore features, trees, vegetation, and structure generation are swapped per configuration.
- Live gameplay placement is never swapped:
- Player block placement (Survival, Creative, Adventure).
- Piston movements and pushing.
- Falling blocks (sand, gravel, concrete powder).
- Liquid interactions and flowing fluids.
- Bonemeal growth.
- Dispenser actions.
- Commands (
/setblock,/fill).
- Previously generated chunks remain untouched; only new chunks generated while the option is enabled are swapped.
- Behavior when
false:- Preserves original Block Swap behavior identically: both natural worldgen and live placement are swapped with full block state property remapping intact.
Improvements & Architecture
2. Re-Entrant Live Placement Tracking
- Implemented a lightweight thread-local execution tracker in
Swapper.java. - Wrapped
Level.setBlockso calls delegating downward into chunk storage palette sections (LevelChunkSection.setBlockState) reliably differentiate live block placement fromProtoChunkworld generation. - Added a server tick pre-hook in
BlockSwap.javaresetting live placement depth at the beginning of each tick to guarantee zero context leakage across ticks.
3. Forgiving Configuration Parser
- String Booleans & Numbers:
BlockSwapConfig.javanow accepts"true","false","yes","no",1, and0in addition to raw JSON boolean primitives. - Key Aliases: Flexible key detection supports
onlySwapNaturalGeneration,only_swap_natural_generation,naturalOnly,natural_only,onlyNaturalGeneration, andonly_natural_generation. - Dynamic Hot-Reloading: Automatically reloads configuration from disk during world load and datapack sync (
/reload), instantly synchronizing the new rule set to clients without restarting Minecraft. - Safe Fallback: Any malformed or non-boolean values log an explicit warning and fall back to default (
false) cleanly without crashing.
4. Zero Performance Overhead
- When
onlySwapNaturalGenerationisfalse, the check short-circuits at a single cached boolean read. Thread-local trackers are never accessed, ensuring identical performance to baseline releases.
Testing & Verification
- NeoForge GameTests: 16 of 16 tests passed.
- Added
testPlayerPlaceAtGraniteNotSwappedinBlockSwapGameTests.javaverifying survival player placement with an item in hand. - Verified piston pushing, falling sand, fluid updates, stair orientation, log axes, and dynamic config toggling.
- Added
- JUnit 5 Unit Tests: 15 of 15 tests passed in
BlockSwapUnitTest.javaverifying config parsing, string booleans, aliases, serialization, circular reference protection, and state remapping. - Server Verification: Dedicated server smoke test confirmed error-free startup with clean registry and mixin initialization.
This mod has no additional files

