Skip to content

feat: fully data-driven structure generation, dragon cave depth/biome fixes, BigGlobe compat#219

Draft
SavageVictor wants to merge 43 commits into
IAFEnvoy:masterfrom
SavageVictor:master
Draft

feat: fully data-driven structure generation, dragon cave depth/biome fixes, BigGlobe compat#219
SavageVictor wants to merge 43 commits into
IAFEnvoy:masterfrom
SavageVictor:master

Conversation

@SavageVictor
Copy link
Copy Markdown

@SavageVictor SavageVictor commented May 11, 2026

Summary

The primary motivation for this rewrite is to add proper support for Big Globe. Dragon caves previously never generated in Big Globe worlds due to a biome check running at surface Y instead of cave Y, and there was no way to configure cave depth via datapack. This PR addresses both issues and takes the opportunity to make all structure generation fully data-driven while at it.

A built jar (Fabric + NeoForge, MC 1.21.1) is available on the fork for testing: https://github.com/SavageVictor/IceAndFire-CE/releases/tag/v2.0-beta.15

Note: AI assistance (OpenCode / Claude) was used throughout this rewrite for code generation, refactoring, and datapack authoring. All changes have been manually reviewed and tested.


Changes

1. Data-driven structure generation configs

All 15 structures now read their spawn chance and behaviour from their worldgen JSON rather than from IafCommonConfig. A shared StructureGenerationConfig record (with a generate_chance field, default 0.5) is codec-decoded by every structure. IafCommonConfig.WorldGenConfig retains only dangerousDistanceLimit.

2. Dragon cave depth fields (y_base / y_range)

DragonCaveStructure gains two new codec fields:

Field Default Description
y_base -24 Base Y level for cave placement
y_range 30 Random vertical spread added to y_base

Defaults reproduce the previous hard-coded behaviour. World-gen mods with different height maps can override these per cave type via datapack.

3. Dragon cave biome check anchored to cave Y

getStructurePosition now returns the cave position (surface X/Z + cave Y) instead of the surface position. The vanilla biome eligibility check therefore runs at cave depth, and /locate points to the actual cave entrance. Without this fix, dragon caves never generate in BigGlobe worlds because the surface biome at those coords is not in any dragon biome tag.

4. Datapacks (datapacks/)

Datapack Purpose
example-datapack Documents every configurable field for all 15 structures with default values and inline _comment explanations
bigglobe-compat-datapack Full BigGlobe compatibility — biome tags mapped to BigGlobe climate tags, cave y_base/y_range overrides, entity spawn biomes, ore feature dispatchers

Testing

  • Build tested on Fabric and NeoForge (MC 1.21.1) — release v2.0-beta.15 on the fork includes both jars.
  • Structures verified to generate correctly in standard and BigGlobe worlds.
  • /locate confirmed to return cave-level coordinates.

Copilot AI and others added 30 commits April 29, 2026 20:28
- Add EntitySpawnFeatureConfig record with spawn_chance (floatRange 0-1)
  and entity_type (Registry codec) fields
- Update all 6 spawn features to use EntitySpawnFeatureConfig instead of
  DefaultFeatureConfig; read spawn_chance and entity_type from JSON config
- Collapse 3 DragonSkeletonSpawnFeature registrations (fire/lightning/ice)
  into a single `spawn_dragon_skeleton` feature type
- Update all 9 configured_feature JSON files with explicit config blocks
  matching the original IafCommonConfig default values"

Agent-Logs-Url: https://github.com/SavageVictor/IceAndFire-CE/sessions/5b0e92a1-a850-4772-8122-2e26ede98012

Co-authored-by: SavageVictor <45825013+SavageVictor@users.noreply.github.com>
…entity-spawn-configs

feat: [Phase 1] Data-driven entity spawn feature configs
Agent-Logs-Url: https://github.com/SavageVictor/IceAndFire-CE/sessions/e4863ac4-1528-47ce-a07c-9ca7fdc14d2f

Co-authored-by: SavageVictor <45825013+SavageVictor@users.noreply.github.com>
…spawn chance bug

Agent-Logs-Url: https://github.com/SavageVictor/IceAndFire-CE/sessions/019234de-040c-4574-a8f6-175da383695e

Co-authored-by: SavageVictor <45825013+SavageVictor@users.noreply.github.com>
…ng-cyclops-config

Parameterize WanderingCyclopsSpawnFeature config and fix double-gate spawn chance bug
…-deathworm-config

[Phase 1] Parameterize DeathWormSpawnFeature config
…ameterize-stymphalian-bird-config

# Conflicts:
#	common/src/main/java/com/iafenvoy/iceandfire/registry/IafFeatures.java

Co-authored-by: SavageVictor <45825013+SavageVictor@users.noreply.github.com>
…-stymphalian-bird-config

[Phase 1] Parameterize StymphalianBirdSpawnFeature config
…pent-config

[Phase 1] Parameterize SeaSerpentSpawnFeature config
…e-dragon-skeleton-spawn-feature

# Conflicts:
#	common/src/main/java/com/iafenvoy/iceandfire/registry/IafFeatures.java

Co-authored-by: SavageVictor <45825013+SavageVictor@users.noreply.github.com>
…skeleton-spawn-feature

Parameterize DragonSkeletonSpawnFeature config (age range, enabled flag)
…pusFeatureConfig

Co-authored-by: SavageVictor <45825013+SavageVictor@users.noreply.github.com>
…mpus-config

[Phase 1] Parameterize HippocampusSpawnFeature config
- Add BlockTransformRule record with CODEC (from/to Block fields)
- Rewrite DragonRoostStructure as concrete class with config fields:
  block_transform, dragon_type, loot_table, treasure_block,
  pile_block, generate_spires, generate_chance
- Replace 3 StructureType registrations with single DRAGON_ROOST
- Replace 3 StructurePieceType registrations with single DRAGON_ROOST
- Delete FireDragonRoostStructure, IceDragonRoostStructure,
  LightningDragonRoostStructure subclasses
- Update fire/ice/lightning_dragon_roost.json to use new type
  and include block_transform config

Agent-Logs-Url: https://github.com/SavageVictor/IceAndFire-CE/sessions/81f7b165-735f-46ce-833b-6ef5bf5eb9a3

Co-authored-by: SavageVictor <45825013+SavageVictor@users.noreply.github.com>
…-dragonroost-structure

[Phase 2] Collapse DragonRoost subclasses into single parameterized structure type
SavageVictor and others added 13 commits May 11, 2026 14:08
…on NeoForge

IafFeatures.init() returns early on NeoForge, leaving all feature additions
(dragon skeletons, entity spawns, lilies, ores) completely absent. This adds
neoforge:add_features biome modifier JSONs that mirror the Fabric-side
BiomeModifications calls, covering all 13 placed features.
…into one parameterized class

* Initial plan

* Collapse Fire/Ice/Lightning DragonCaveStructure subclasses into single parameterized DragonCaveStructure

Agent-Logs-Url: https://github.com/SavageVictor/IceAndFire-CE/sessions/afa50231-7ec2-4e40-96e7-1909b207d208

Co-authored-by: SavageVictor <45825013+SavageVictor@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: SavageVictor <45825013+SavageVictor@users.noreply.github.com>
…cture system

The NBT templates (dread_ruin_0-12.nbt, dread_exit_portal.nbt) and processors
(DreadRuinProcessor, DreadPortalProcessor) existed but were never registered in
the vanilla structure system — no Structure class, no template pools, no
structure JSONs, no biome placement.

This commit wires everything up end-to-end:
- DreadRuinStructure / DreadPortalStructure (IafJigsawStructure subclasses)
- Registered in IafStructureTypes (dread_ruin, dread_portal)
- Template pools: dread_ruin/start_pool with all 13 variants; dread_portal/start_pool
- Processor lists: dread_ruin_processors, dread_portal_processors
- structure/ + structure_set/ JSONs with spacing tuned for the dread dimension
- Biome tags structure_gen/dread_ruin + structure_gen/dread_portal targeting dread_forest + dread_plain
- Config entries generateDreadRuinChance (0.5) + generateDreadPortalChance (0.2)
- Add AmphithereSpawnFeature using the existing generic EntitySpawnFeatureConfig
- Register SPAWN_AMPHITHERE feature and PLACED_SPAWN_AMPHITHERE placed feature key in IafFeatures
- Wire IafBiomeTags.AMPHITHERE into Fabric biome modifications in IafFeatures.init()
- Add configured_feature/spawn_amphithere.json (spawn_chance 0.033, entity iceandfire:amphithere)
- Add placed_feature/spawn_amphithere.json (WORLD_SURFACE_WG heightmap + biome placements)
- Add NeoForge biome modifier JSON targeting #iceandfire:entity_gen/amphithere
- Remove resolved TODO comment from AmphithereEntity.getCanSpawnHere()
…haned worldGen config fields

Apply StructureGenerationConfig to DreadRuinStructure, DreadPortalStructure,
MausoleumStructure, GorgonTempleStructure, and GraveyardStructure, replacing
IafCommonConfig.worldGen.generateXxxChance references with codec-driven
generation config stored per-structure in JSON.

Add explicit generate_chance: 0.2 to dread_portal.json to preserve the
original lower spawn rate (default would otherwise be 0.5).

Remove all 15 per-structure generate chance fields from IafCommonConfig
WorldGenConfig; only dangerousDistanceLimit remains.
Replace hardcoded 'bottomY + 40 + random(30)' formula with two optional
codec fields: y_base (default -24) and y_range (default 30). Defaults
exactly replicate vanilla behaviour (Y -24..+5) while letting datapacks
override placement depth for mods like BigGlobe whose bottomY is ~-1024.
getStructurePosition previously returned a surface Y position, so the
biome check happened at surface level. Underground world-height mods
(e.g. BigGlobe) assign cave biomes only at depth, making the check
always fail and caves never spawn.

Fix: compute cave Y (yBase + random * yRange) in getStructurePosition,
build cavePos from surface X/Z + cave Y, and return that as the
StructurePosition. The biome check now happens at cave level, /locate
points to the actual cave entrance, and addPieces uses pos.getY()
instead of recomputing Y internally.
Move example-datapack and bigglobe-compat-datapack into a shared
datapacks/ directory. Also fixes example-datapack README (y_base/y_range
fields added to dragon_cave table) and corrects a misleading comment in
dread_portal.json about omitting the generation block.
@SavageVictor SavageVictor marked this pull request as ready for review May 11, 2026 17:23
@IAFEnvoy
Copy link
Copy Markdown
Owner

WorldGenConfig keeps for common players to change generate chance more easily

@SavageVictor
Copy link
Copy Markdown
Author

@IAFEnvoy I can bring it back and overridable by datapacks, is that ok?

@IAFEnvoy
Copy link
Copy Markdown
Owner

Other stuffs are ok and also i have planned to port to NeoForge only so you don't need to care for Fabric platform

@IAFEnvoy
Copy link
Copy Markdown
Owner

IAFEnvoy commented May 25, 2026

Too long time no response and i cannot wait for you to do next task: #220

I turn this PR to draft and once you support new code you can mark as ready again.

@IAFEnvoy IAFEnvoy marked this pull request as draft May 25, 2026 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants