promotional bannermobile promotional banner

No Structure Overlap – Worldgen & Structure Fix

Stop structure overlap chaos between any mods and datapacks instantly with zero lag and zero crashes!
Back to Files

nostructureoverlap v1.0 Forge.jar

File namenostructureoverlap v1.0 Forge.jar
Uploader
GaraKrralGaraKrral
Uploaded
Aug 29, 2026
Downloads
12
Size
14.0 KB
Mod Loaders
Forge
File ID
8763576
Type
R
Release
Supported game versions
  • 1.20.1

Curse Maven Snippet

Forge

implementation fg.deobf("curse.maven:no-structure-overlapp-1671836:8763576")

Learn more about Curse Maven

What's new

No Structure Overlap v1.0 For Forge


What's New?

This release adds a simple, robust system that prevents structures from being placed on top of each other during world generation. Instead of attempting to detect overlaps after a structure has already started building, the mod now performs a fast, conservative check before generation begins and blocks placements that would conflict. The everyday effect is fewer half-generated or intersecting structures, fewer wasted generation attempts, and better stability across different Forge and NeoForge mapping setups. The check is intentionally conservative: it uses the chunk center X/Z and an approximate Y instead of relying on mapping-sensitive bounding box APIs. That choice trades absolute precision for reliability and cross-mapping compatibility. In normal play you should only notice that overlapping structures no longer appear; for pack authors and server operators it means cleaner worldgen and fewer strange structure artifacts.

StructureOverlapChecker is now deprecated and is no longer used at runtime. If you are still calling or importing StructureOverlapChecker, migrate to the new EarlyStructureOverlapChecker. Migration notes are included below.


For developers

The mixin now inspects structure generation earlier and registers placements only when a structure actually finishes placement. The new flow is: run a quick overlap test at the start of the target generate method; if the test reports a conflict, return an invalid start to block placement; if generation completes successfully, record the placement so future checks see it. This guarantees the registry contains only successfully placed structures instead of attempted or partial placements.

The mixin performs a safe registry lookup for the structure identifier and falls back to a predictable string when the registry lookup fails. This helps avoid NoSuchMethod or mapping-specific failures across different mappings or NeoForge wrapper versions. The approximate vertical level used when recording is levelHeightAccessor.getMinBuildHeight() + 64 by default; that can be adjusted later if you want a different baseline.

The old bounding-box approach was removed in favor of storing a small, thread-safe set of recorded centers. Each recorded entry contains the center X, center Y (approximate), center Z, and the structure id. The overlap test is a fast radius check using a horizontal radius and a vertical tolerance. This approach avoids fragile reflection or mapping-dependent calls while still catching the majority of problematic overlaps. The placement cache is cleared on world unload to avoid memory leaks between sessions.

StructureOverlapChecker is deprecated and removed from runtime. If your code references that class, replace those references with EarlyStructureOverlapChecker. The runtime no longer calls the old API. Concretely, replace any imports of the old checker with com.garakrral.nostructureoverlap.util.EarlyStructureOverlapChecker. If your code previously called a canPlaceStructureAt method, that explicit check is no longer required because the mixin handles it automatically. If you still need to perform an explicit check from custom code, use EarlyStructureOverlapChecker.has3DCollision(ChunkPos chunkPos, int approxY, String structureId). If you previously used a registerStructure method that accepted a BoundingBox, switch to the new signature registerStructure(ChunkPos chunkPos, int approxY, String structureId) and stop depending on stored bounding-box fields; the new storage contains only center coordinates and the structure id.

If you require precise collision detection, you can extend registration to extract StructureStart child pieces and their bounding boxes and store those boxes for accurate overlap checks. That is more precise but mapping-sensitive: piece lists and bounding-box getters may have different names across mappings, so implement safe fallbacks and guard against method/field resolution failures. For most compatibility-focused use cases the center-based estimate is preferable because it reduces mapping-related runtime errors.

For testing, enable mixin debug logging or check the runtime logs for method descriptor mismatches if your target environment uses a different generate signature. Reproduce the change by generating or forcing nearby structures (for example a village near an outpost) and observe blocked placements in info-level logs and registered placements at debug level. If the system blocks placements too aggressively for your modpack, reduce the horizontal radius or increase it if overlaps still occur. To allow the same structure type to appear near itself, change the has3DCollision implementation to not skip entries that share the same structure id.

Future work could include a proper configuration system that exposes per-structure radii, an option to persist placements across server restarts for very large generation tasks, or a mapping-aware option that stores and checks bounding boxes when the environment exposes reliable piece/bounding APIs. A spatial index for large numbers of recorded placements would improve lookup performance if you expect many thousands of entries.

If you want, I can produce the exact migration patch for your codebase that replaces StructureOverlapChecker references, or implement the optional bounding-box variant with mapping-safe fallbacks.

This mod has no additional files