diff --git a/README.md b/README.md index 60a9dcb..27710d1 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ also lets you author modern terrain, biomes, structures, seasons, and celestial bodies. It is an independently developed project, not a byte-for-byte copy of the 1.12.2 mod. -Current releases: **1.21.1.0.12** and **26.3.0.15**, with separate Minecraft-specific JARs and saves. +Current releases: **1.21.1.1.0** and **26.3.1.0**, with separate Minecraft-specific JARs and saves. The gameplay guide below describes the **Minecraft 1.21.1 release**. The separate **Minecraft 26.3 release** uses Java 25, NeoForge 26.3.0.99 and a first-party Age @@ -20,15 +20,17 @@ instability and Link Modifier controls. JEI, TerraBlender/Biomes O' Plenty, Serene Seasons and Ruins remain optional. See the [26.3 guide](ports/mc263/README.md) and [parity review](docs/MC263_PARITY_REVIEW.md). -These releases add [Accelerated machine ticking](docs/ACCELERATED_MACHINES.md), -correct [Writing Desk displays](docs/WRITING_DESK_MODEL.md), restore -[Legacy-style dropped-book interaction](docs/DROPPED_BOOKS.md), and use -[default block baselines](docs/BLOCK_BASELINE.md) for void/skyblock Overworlds. +These releases complete **Milestone X.1.0**. Native Nether and Native End now use +their natural fluid and sky defaults, while explicit Sky/Flooded/fluid Pages +retain control. Flat terrain uses End/Nether ground materials in those biomes, +including single-biome and mixed distributions. See [Native generation](docs/NATIVE_FLUIDS.md). On 26.3, optional Immersive Portals Reborn or Seamless Portals provides live book and crystal portal views, including look-only exploration in the book panel. Install only one fork; built-in animations work without either. -Known Reborn/Seamless crashes and travel disconnects remain tracked in +The 26.3 release adds targeted guards for portal-engine world-reset +acknowledgements and unavailable section rebuilds addressed in [#118](https://git.paddedcell.org/dnorberg/rivencraft/issues/118). +See [verification and scope](docs/PORTAL_TRANSITION_GUARDS.md). Use matching client/server builds, keep Minecraft tracks separate and back up worlds before updating. ## Getting started diff --git a/RELEASE_NOTES_1.21.1.0.13.md b/RELEASE_NOTES_1.21.1.0.13.md new file mode 100644 index 0000000..f495c92 --- /dev/null +++ b/RELEASE_NOTES_1.21.1.0.13.md @@ -0,0 +1,8 @@ +# Rivencraft 1.21.1.0.13 + +Intermediate development candidate; accepted changes are included in 1.21.1.1.0 / 26.3.1.0. This candidate was not published. + +- Native Nether uses lava for natural noise-terrain fluids, including Cave terrain, and disables Overworld water aquifers. +- Native End removes natural fluid filling and aquifers while retaining the chosen terrain geometry. +- Flat/Void remain flat/empty. Explicit Flooded and authored fluid features retain their own behavior. +- Updated Native-family tooltips. Existing generated chunks are not rewritten; test new Ages. diff --git a/RELEASE_NOTES_1.21.1.0.14.md b/RELEASE_NOTES_1.21.1.0.14.md new file mode 100644 index 0000000..c11fb57 --- /dev/null +++ b/RELEASE_NOTES_1.21.1.0.14.md @@ -0,0 +1,9 @@ +# Rivencraft 1.21.1.0.14 + +Intermediate development candidate; accepted changes are included in 1.21.1.1.0 / 26.3.1.0. This candidate was not published. + +- Native Nether defaults to its Nether sky, and Native End to its End sky, unless an explicit Sky Page chooses another style. +- Written Sky Pages retain priority with authored celestials. Native/Caves keep their previous sky fallback. +- Includes Native Nether natural lava and Native End dry-terrain changes from the prior candidate. +- Flat/Void geometry and explicitly authored Flooded/fluid features retain their behavior. +- Updated tooltips. Existing generated chunks are not rewritten. diff --git a/RELEASE_NOTES_1.21.1.0.15.md b/RELEASE_NOTES_1.21.1.0.15.md new file mode 100644 index 0000000..b3945c2 --- /dev/null +++ b/RELEASE_NOTES_1.21.1.0.15.md @@ -0,0 +1,10 @@ +# Rivencraft 1.21.1.0.15 + +Intermediate development candidate; accepted changes are included in 1.21.1.1.0 / 26.3.1.0. This candidate was not published. + +- Flat End biomes now use End Stone instead of grass/dirt. +- Flat Nether biomes use Nether ground, including Crimson/Warped Nylium, Soul Sand/Soul Soil and Basalt/Blackstone for the corresponding vanilla biomes. +- Supports single-biome plans and local materials in mixed distributions, including tagged End and TerraBlender-region Nether classification. +- Base-column queries match placed materials. Bedrock, air, height, authored features and fluids are preserved. +- Includes the earlier Native Nether lava / Native End dry generation and default sky improvements. +- Existing generated chunks are not rewritten; use fresh Ages for visual checks. diff --git a/RELEASE_NOTES_1.21.1.1.0.md b/RELEASE_NOTES_1.21.1.1.0.md new file mode 100644 index 0000000..e8f25d5 --- /dev/null +++ b/RELEASE_NOTES_1.21.1.1.0.md @@ -0,0 +1,16 @@ +# Rivencraft 1.21.1.1.0 + +Completes Milestone X.1.0 for Minecraft 1.21.1 / NeoForge 21.1.264 / Java 21. +Requires Dynamic Dimensions AR Edition and Bad Packets. Use matching client/server builds and the JAR for your Minecraft version. + +- Native Nether uses lava for natural noise-terrain fluids, including Cave terrain, and disables Overworld water aquifers. +- Native End removes natural fluid filling and aquifers while preserving the chosen terrain geometry. +- Native Nether and Native End default to their corresponding skies when no Sky Page is written. Explicit Sky Pages retain priority, including with authored celestials. +- Flat End biomes use End Stone instead of grass/dirt. Flat Nether biomes use Nether ground, including Crimson/Warped Nylium, Soul Sand/Soul Soil and Basalt/Blackstone for the corresponding vanilla biomes. +- Corrects single-biome Flat generation and local materials across mixed distributions. Tagged End biomes and TerraBlender-region Nether classification are recognized; other recognized Nether biomes use the Netherrack fallback. +- Base-column queries match placed Flat materials. Bedrock, air, height, authored features and explicit Flooded/fluid features retain their behavior. +- Updated Native-family tooltips. Existing generated chunks are not rewritten. + +Player in-game checks passed. Sequential Native-generation probes passed **219 checks on 1.21.1 / 213 on 26.3**, including actual Flat block placement, mixed distributions, generator codecs, natural-fluid settings and sky precedence. Temporary worlds were removed; no probe stalled. + +Versioning is now **Minecraft version.1.0**: milestone/release slice 1, iteration 0. Both Minecraft tracks retain separate builds and saves. diff --git a/docs/DUAL_VERSION_RELEASE.md b/docs/DUAL_VERSION_RELEASE.md index 8986c48..dac86fa 100644 --- a/docs/DUAL_VERSION_RELEASE.md +++ b/docs/DUAL_VERSION_RELEASE.md @@ -115,3 +115,17 @@ above remains historical; unchanged earlier artifacts are not relabeled. ## 2026-11-17 release update Player-approved 1.21.1.0.6 and 26.3.0.10 collect #108 desert vegetation, #109 Static Sky resolution and #111 Native biome families. The 26.3 release also includes #117 optional Seamless live rendering. #118 remains open for Reborn/Seamless failures, including the recovered caves_on_top acknowledgement disconnect. Both JARs retain their player-tested hashes. + + +## Completed Milestone X.1.0 releases (2026-11-18) + +Versions **1.21.1.1.0** and **26.3.1.0** mark completion of the X.1.0 milestone. +The Minecraft version remains the prefix; the milestone/release slice is now 1 +and the fix/additional-work counter resets to 0. Later work increments that +last counter, for example 26.3.1.1. Both use ordinary release channels. + +Native fluid/sky/Flat-material changes passed player checks on both tracks; +the final 26.3 transition guards also passed player acceptance. Historical +open-issue notes above describe older releases; #118 and #119 are now complete. +Automated evidence remains bounded: 219/213 Native checks and 47 isolated +26.3 client-guard checks, plus the player reports. diff --git a/docs/MILESTONES.md b/docs/MILESTONES.md index 8c52b3c..14092f9 100644 --- a/docs/MILESTONES.md +++ b/docs/MILESTONES.md @@ -64,3 +64,13 @@ consolidation; issue #84 records the final milestone acceptance. See the [M7 acceptance](MILESTONE_7_ACCEPTANCE.md), [M7 Legacy audit](LEGACY_M7_AUDIT.md), [M7 regression matrix](MILESTONE_7_REGRESSION.md), and [M7 compatibility review](MILESTONE_7_COMPATIBILITY_REVIEW.md). + + +## Version X.1.0 — complete (2026-11-18) + +The post-port improvement milestone is complete in **1.21.1.1.0** and **26.3.1.0**. +The final issues were #119 (Native Nether/End fluids, sky defaults and Flat +ground materials) and #118 (26.3 portal transition guards), both accepted by the +player. See [Native generation](NATIVE_FLUIDS.md) and +[portal guard evidence](PORTAL_TRANSITION_GUARDS.md). Each Minecraft track keeps +its own artifact, dependencies and saves. diff --git a/docs/NATIVE_BIOME_FAMILIES.md b/docs/NATIVE_BIOME_FAMILIES.md index 4dece0a..c8fa8fb 100644 --- a/docs/NATIVE_BIOME_FAMILIES.md +++ b/docs/NATIVE_BIOME_FAMILIES.md @@ -13,8 +13,9 @@ Release builds: **1.21.1.0.6** and **26.3.0.10**. Player in-game validation pass The three explicit family controllers work with Standard, Amplified, Island, Cave, Flat and Void terrain. The **Terrain Page still controls geometry**. -Void stays empty; its biomes can affect weather and seasons. These controllers -do not select a sky style, dimension type or season. +Void stays empty; its biomes can affect weather and seasons. In the original family release these controllers did not select a sky style. +Releases 1.21.1.1.0 / 26.3.1.0 add Nether/End sky defaults +unless a Sky Page is explicitly written. They do not select a season. The player chose **seeded regional layout including modded biomes** for Native Nether/End, rather than vanilla climate or End-island placement. The family @@ -77,8 +78,8 @@ On 26.3, authored noise-terrain generation can now construct a vanilla noise baseline when the primary Overworld is Flat/custom rather than a Noise generator. This allows the independent Native-family/terrain pairing in that setup instead of failing with “Overworld generator cannot accept authored noise settings.” -The existing path for an ordinary noise Overworld is unchanged. Issue #115's -separate material-abundance baseline work is not completed by this fix. +The existing path for an ordinary noise Overworld is unchanged. The later material-abundance baseline work is documented separately in +[block baselines](BLOCK_BASELINE.md). ## Creative, JEI and loot policy @@ -137,3 +138,9 @@ BOP/TerraBlender**. Coverage includes: 5. Verify all three Pages appear under biome generation in Creative and JEI. 6. Reopen an older Native Cave Age if available. Its saved mixed pool is kept; create a new Age to test the new default rather than expecting migration. + +## Natural fluids — issue #119 + +Releases 1.21.1.1.0 / 26.3.1.0 apply lava to Native Nether +natural fluids and remove Native End natural water. Explicit Flooded/fluid +features remain separate. See [Native fluid rules](NATIVE_FLUIDS.md). diff --git a/docs/NATIVE_FLUIDS.md b/docs/NATIVE_FLUIDS.md new file mode 100644 index 0000000..a5cc4fd --- /dev/null +++ b/docs/NATIVE_FLUIDS.md @@ -0,0 +1,139 @@ +# Native terrain fluids — issue #119 + +Released in **1.21.1.1.0** and **26.3.1.0**. Player in-game checks passed on both; issue #119 closed. + +## Behavior + +Native Nether replaces the noise terrain's default fluid with lava and disables +Overworld water aquifers. This includes Cave terrain, which keeps its preset +fluid height for Native Nether instead of the ordinary dry-Cave override. + +Native End uses air as its default fluid, disables aquifers, and places the +fluid cutoff below the terrain's minimum Y. Vanilla's fluid picker can otherwise +introduce low-level lava even after changing the default fluid to air. + +Terrain still determines geometry and the ordinary fluid cutoff for Nether: +Standard, Amplified, Island and Cave retain their noise shape and vertical +range. This does not raise Island terrain's below-world cutoff into an ocean. +Flat and Void retain their existing empty/flat generation; the Native Page does +not add an ocean to either. + +The change follows the frozen Native family choice, including recognized +modded members. It does not infer a family merely from a particular biome +appearing in a custom Single/Tiled/region distribution. Native, Native Caves, +and explicitly authored non-Native biome distributions retain existing rules. +The fluid rule does not change season, biome-pool or material-rule selection. +Native-family sky defaults are described below. + +## Native sky defaults + +When no explicit Sky Page is active, Native Nether defaults to the Nether sky +and Native End defaults to the End sky. This applies independently of terrain. +A written Overworld, Nether, End or Static Sky Page takes precedence, including +when Sun/Moon Pages are also present. Celestials alone do not override the +Native-family default. Color/celestial authoring remains intact. + +Native and Native Caves keep their previous fallback selection. 1.21.1 derives +the default from the saved family plan for server effects and the synchronized +sky profile. 26.3 freezes the resolved style through its existing Age sky save +and dimension-type variant, rather than consulting mutable worldgen state. + +## Explicit authoring and saves + +Flooded still deliberately adds water at the authored/default height after +terrain and decorations. Explicit fluid features retain their selected fluid. +Thus Native End + Flooded intentionally has water, and Native Nether + Flooded +is not an implicit lava Flooded Page. These are separate authoring instructions. + +The Native family already persists in the biome plan. The effective noise fluid, +aquifer policy and cutoff are included in the generator's existing codec. +No new Page or config is introduced. Tooltips explain the natural-fluid rules. + +Existing generated chunks are not rewritten. Use newly created Ages for visual +validation; older Native-family Ages may use the new fluid rules in future chunks +when their generator is reconstructed. + +## Focused verification + +Run sequentially: + + python3 scripts/regression_native119.py mc1211 + python3 scripts/regression_native119.py mc263 + +Each run creates one temporary server world and isolated fixture output, holding +the host-wide server lock. It removes the world on pass/fail; if a run stalls +after 60 seconds, it stops and hands the remaining check to the player without +retrying. Logs remain under build/verification/native119/. + +The fixture builds real authored generators for all six terrain choices and +three explicit Native families, checks generator codec reload and the actual +vanilla fluid picker over the full vertical range. Flat/Void must remain flat. +This establishes settings and fluid-picker behavior, not completed decorated +terrain, modded lake behavior, or visual/client acceptance. + +## Player checks — both versions + +1. Create Link Panel → Standard → Native Nether. Explore new terrain: + natural oceans/aquifers should use lava rather than water. +2. Repeat with Cave → Native Nether: any natural fluid is lava. +3. Create Standard → Native End, then Cave → Native End. Natural terrain should + be dry; explore new chunks to check for unexpected water. +4. Check Native Caves remains dry on Cave, and ordinary Standard + Native still + generates normal water. Flat/Void should not acquire new natural oceans. +5. Test Native End + Flooded and Native Nether + Flooded to confirm explicit + water authoring still works. Fluid-feature Pages keep their chosen fluid. +6. Native Nether/End without a Sky Page should show the corresponding sky. + Add Overworld Sky or Static Sky and verify the written Sky wins; repeat with + a Sun Page to verify celestial authoring does not change that priority. +7. Save/reopen, revisit, and check sky and new chunks retain the intended behavior. + +The prior fluid-only candidates passed 76 focused checks per version. +The sky-default extension adds checks for defaults, explicit precedence with +celestials, dimension effects and saved/serialized styles. Player visual checks +were subsequently accepted by the player for the combined candidates. + +Combined fluid/sky results: **134 checks on 1.21.1, 122 on 26.3**, run sequentially. +Both production builds and JAR audits passed; both Dev candidates installed. +Temporary worlds removed; no stalls. Player visual acceptance subsequently passed. + + +## Flat biome materials + +Flat generation previously wrote the vanilla grass/dirt layers directly without +running noise terrain's biome surface rules. Both targets now choose materials +from the biome at each column/layer. 26.3 also routes single End/Nether biome +plans through the custom flat generator, rather than the vanilla flat bypass. + +| Biome | Flat cap | Flat soil | +| --- | --- | --- | +| End family | End Stone | End Stone | +| Nether Wastes / other recognized Nether | Netherrack | Netherrack | +| Crimson Forest | Crimson Nylium | Netherrack | +| Warped Forest | Warped Nylium | Netherrack | +| Soul Sand Valley | Soul Sand | Soul Soil | +| Basalt Deltas | Basalt | Blackstone | +| Other biomes | Existing Flat layers | Existing Flat layers | + +This is a biome-aware Flat material preset, not Nether noise geometry or a +reproduction of every mod's custom surface decorator. Tagged End biomes use End +Stone; tagged or TerraBlender-region Nether biomes use the Nether fallback. +Vanilla family IDs remain recognized even when broad tags are missing. +TerraBlender-region IDs are captured into generator state and codec; no optional +API call or mutable Age data is read per generated block. + +Bedrock, air, terrain height and non-base layer blocks remain intact. Materials +are chosen during base filling, before authored features and biome decoration, +so a rock/tendril material is not recolored by a later broad cleanup scan. +The base-column query uses the same material decision as block placement. +Mixed End/Nether/Overworld distributions retain their own materials locally. + +Visual checks: create fresh Flat + Native End, Flat + Native Nether, and Flat +with a single End/Nether biome. Check the surface and exposed dirt layers at +edges; also test a mixed distribution and an ordinary Plains Flat Age. Authored +material features and Flooded should retain their own blocks/fluids. Existing +chunks are not changed. + +Latest combined checks (including actual Flat block placement and mixed columns): +**219 on 1.21.1 / 213 on 26.3**. They passed sequentially without stalls; +temporary worlds were removed. The player subsequently reported in-game acceptance. Optional mod-specific +custom surface decorators remain outside this Flat material preset. diff --git a/docs/PORTAL_TRANSITION_GUARDS.md b/docs/PORTAL_TRANSITION_GUARDS.md new file mode 100644 index 0000000..9925ac8 --- /dev/null +++ b/docs/PORTAL_TRANSITION_GUARDS.md @@ -0,0 +1,97 @@ +# Portal transition guards — issue #118 + +Released with **26.3.1.0**; NeoForge 26.3.0.99 / Java 25. +Only 26.3 client code changed for issue #118; the 1.21.1.1.0 release includes +the separately accepted Native-generation updates. + +## Evidence and attribution + +The installed Seamless 1.0.0 and Reborn 7.0.12 bytecode has the same unchecked +redirectHandleBlockChangedAck path: getClientWorlds asserts that the portal +engine is initialized, then iterates its worlds. Its own world-replacement +cleanup can leave initialization false until a later initialization point. +Rivencraft does not call that cleanup. Its existing workaround was Reborn-only. + +Two newer Seamless reports (2026-11-18 21:51:41 and 22:05:32) still show this +same assertion. That establishes an ongoing compatibility gap, not an Age +generation exception. Local reports are retained outside the repository. + +The Reborn exploration crash dereferenced a null RenderSection in its wrapped +compileAsync path. Both vanilla 26.3 and NeoForge's patched compileSections +loop retrieve the current section for an extracted job and dereference it +without a null check. ViewArea can return null for a section outside its current +storage. Reborn wraps the compile call; Seamless modifies the priority decision +instead. The observed origin of the stale job is still not conclusively +attributed to vanilla, the portal engine, or their interaction. No independent +full-client reproduction without Rivencraft is claimed. + +The [Seamless project](https://www.curseforge.com/minecraft/mc-mods/immersive-portal) +links to [its upstream tracker](https://github.com/fmpapierz/SeamlessPortals/issues). +No new report has been submitted by this change. An unrelated report there does +not establish a match to these failure paths. + +## Acknowledgement guard + +ImmersiveBlockAckMixin runs on the client/game thread, only when either supported +fork is installed. During an uninitialized-world-map interval, it acknowledges +the packet listener's own ClientLevel directly and skips the failing multiworld +redirect. With an initialized map the fork handles the packet normally, +including remote worlds. Off-thread packets retain vanilla scheduling. With no +packet world, there is no valid local prediction state to acknowledge. + +The helper and mixin were renamed from their old Reborn-only names. Optional +portal API classes remain behind the installed-engine check; no new required +dependency or configuration switch is introduced. + +## Unavailable section jobs + +At compileSections entry, when a supported fork is present, only jobs whose +section is absent from the current ViewArea are removed. The check uses an +invoker for the same section lookup vanilla performs later. + +Every valid job retains its object identity, order, region, additional renderers +and dirty state. The whole render pass is not canceled. There is no try/catch +around rendering, permanent coordinate blacklist, terrain scan or new chunk +loading. A newly allocated section can be extracted and compiled normally. +Other exceptions propagate. This is a targeted mitigation for the observed +null receiver, not a claim to fix every renderer or world-ownership issue. + +## Verification + + ./gradlew -p ports/mc263 build + python3 scripts/regression_client118.py + +The isolated script passed **47 checks** using production guard/mixin bytecode. +It extracts and runs the acknowledgement redirect bytecode from both installed +forks, reproducing the old uninitialized-map assertion before testing guarded +delivery. Coverage includes warm/cold maps, exact-once local acknowledgement, +normal remote acknowledgement, off-thread noninterference, no-fork bypass, +missing packet world, stale/valid renderer jobs, retained job identity/payload +and dirty state, newly available sections, null view area and unrelated errors. + +Minecraft lifecycle and renderer types in this script are small isolated stubs. +It starts no Minecraft client, GPU, server or test world. It does not prove +runtime Mixin application, live portal graphics or end-to-end network timing. +No stall occurred and no stalled server probe was retried. Temporary test +outputs are deleted; result retained in build/verification/issue118/guards.txt. + +## Player acceptance checklist + +Test each installed renderer separately; never enable both together. + +1. Start with Seamless and confirm the client loads. Create/open/close a new Age + book, travel repeatedly and return. Include normal block placement/breaking + around travel to exercise prediction acknowledgements. +2. Open live book previews, enter/exit look-only exploration, close/reopen and + use a live crystal portal. Verify the view stays correct and travel works. +3. Explore across chunks, rebuild terrain (F3+A), and change render distance. + Confirm no section crash and that terrain continues rebuilding visibly. +4. Disconnect/rejoin and fully restart; repeat travel to existing/new Ages. +5. Repeat with Reborn alone, particularly sustained exploration/rebuilding. +6. Optionally check animated fallback with no portal mod. Neither renderer is + required for normal Rivencraft travel. + +The user reported in-game pass and authorized publication after testing the +26.3.0.19 candidate. Issue #118 and Milestone X.1.0 are complete. This records +player acceptance; no independent exhaustive GPU/network/renderer matrix or +standalone external-fork reproduction is claimed. diff --git a/docs/PUBLISHING_DESCRIPTION.md b/docs/PUBLISHING_DESCRIPTION.md index cee0eaf..e22d654 100644 --- a/docs/PUBLISHING_DESCRIPTION.md +++ b/docs/PUBLISHING_DESCRIPTION.md @@ -29,6 +29,8 @@ See the [installation guide](https://git.paddedcell.org/dnorberg/rivencraft/wiki - Preview destinations with the built-in Legacy-style animation or an optional rendering integration for your Minecraft version. - Set an Age’s water level with Flooded and Number Pages. - Select Native Caves, Nether or End biome pools independently of terrain, grow desert vegetation with Trees/Huge Trees/Flowers, and control Static Sky resolution with Number Pages. +- Native Nether defaults to lava and Nether sky; Native End to dry terrain and End sky. Explicit Sky and Flooded Pages retain control. Flat terrain uses appropriate End/Nether ground in those biomes. +- Right-click dropped open books to read/link, or shift-right-click to collect; walking over them does not pick them up. ## Getting started @@ -46,7 +48,7 @@ Optional integrations include **JEI**, **TerraBlender** and compatible biome mod Destination previews depend on the Minecraft version: - **1.21.1:** optional Create/Ponder snapshots or Immersive Portals live views. -- **26.3:** optional **Immersive Portals Reborn or Seamless Portals** live book and crystal-portal views, including look-only exploration inside the book panel. Install only one fork per instance. **Known Reborn/Seamless crashes and travel disconnects remain under investigation:** [issue #118](https://git.paddedcell.org/dnorberg/rivencraft/issues/118). +- **26.3:** optional **Immersive Portals Reborn or Seamless Portals** live book and crystal-portal views, including look-only exploration inside the book panel. Install only one fork per instance. The 26.3.1.0 release includes player-accepted guards for portal world-reset acknowledgements and unavailable section rebuilds; see [scope and verification](https://git.paddedcell.org/dnorberg/rivencraft/src/branch/main/docs/PORTAL_TRANSITION_GUARDS.md). Built-in animated previews remain available without a portal renderer. Create/Ponder scenes are not currently included in the 26.3 build. diff --git a/docs/SEAMLESS_PORTALS.md b/docs/SEAMLESS_PORTALS.md index 4b68d7c..eb30654 100644 --- a/docs/SEAMLESS_PORTALS.md +++ b/docs/SEAMLESS_PORTALS.md @@ -1,8 +1,8 @@ # Optional Seamless Portals integration — issue #117 -Local candidate **26.3.0.9**, Minecraft 26.3 / NeoForge 26.3.0.99 / Java 25. -Pending real-client validation; not committed or published. Minecraft 1.21.1 -is unchanged by this issue. +Current release: **26.3.1.0**, Minecraft 26.3 / NeoForge 26.3.0.99 / Java 25. +Seamless integration and the later transition guards passed player in-game +checks. Earlier candidate/release notes below retain their historical scope. ## Supported engines and API boundary @@ -134,3 +134,12 @@ Inspected Seamless artifact SHA-256: `5d2bfc2a811a6526e3f6722c521d97e5de2869a6ea ## Release validation (2026-11-17) Player in-game checks passed. Included in releases 1.21.1.0.6 and 26.3.0.10 (Seamless integration applies to 26.3 only). Earlier candidate notes above describe development history. Known Reborn/Seamless acknowledgement and rendering failures remain tracked in [#118](https://git.paddedcell.org/dnorberg/rivencraft/issues/118); this release does not resolve them. + + +## Accepted transition guards — issue #118 + +Release **26.3.1.0**, validated as candidate **26.3.0.19**, extends the acknowledgement reset guard +to Seamless as well as Reborn, and removes unavailable section jobs before the +vanilla renderer dereferences them. The older Reborn-only notes describe the +published releases. See [transition investigation](PORTAL_TRANSITION_GUARDS.md) +for evidence, exact scope, isolated tests and remaining client validation. diff --git a/gradle.properties b/gradle.properties index 439e2c9..3d18054 100644 --- a/gradle.properties +++ b/gradle.properties @@ -36,7 +36,7 @@ mod_name=Rivencraft # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=LGPL-3.0-or-later # Minecraft.release-slice.iteration; independent of the 26.3 release track. -mod_version=1.21.1.0.12 +mod_version=1.21.1.1.0 immersive_portals_version=6.0.7 terrablender_version=4.1.0.8 serene_seasons_version_id=pHEgQQUE diff --git a/ports/mc263/README.md b/ports/mc263/README.md index f601e64..c82d29e 100644 --- a/ports/mc263/README.md +++ b/ports/mc263/README.md @@ -1,6 +1,6 @@ # Minecraft 26.3 -The current **Minecraft 26.3 release is 26.3.0.15**, for NeoForge 26.3.0.99 and +The current **Minecraft 26.3 release is 26.3.1.0**, for NeoForge 26.3.0.99 and Java 25. It uses Rivencraft's first-party Age backend, with no Dynamic Dimensions or Bad Packets dependency. The writing loop, authored/seeded Ages, generation features, weather/skies/celestials, libraries, crystal portals, live instability, @@ -13,10 +13,11 @@ views. Install only one fork per instance. Built-in animations and normal travel remain available without either. Independent settings under book_previews control each fork's live book and crystal views. -**Known portal-mod failures:** [#118](https://git.paddedcell.org/dnorberg/rivencraft/issues/118) -tracks Reborn section-rebuild crashes and Reborn/Seamless acknowledgement disconnects -during travel. Rejoining recovered the observed Seamless Age-loading disconnect. -This release does not fix those failures. See [integration details](../../docs/SEAMLESS_PORTALS.md). +**Milestone X.1.0 is complete.** This release adds the player-accepted +world-reset acknowledgement and unavailable-section rebuild guards for the +optional portal engines. See [scope and evidence](../../docs/PORTAL_TRANSITION_GUARDS.md). +Native Nether/End fluid and sky defaults and Flat biome materials are covered +in [Native generation](../../docs/NATIVE_FLUIDS.md). Native Caves/Nether/End Pages, desert vegetation and Number-controlled Static Sky resolution passed player checks on both supported versions. Native controls select @@ -29,7 +30,7 @@ The port feature and acceptance review is recorded in movement is disabled. The final dedicated-server restart/return check passed. Create/Ponder scenes are not ported to this target. Use matching client/server builds, keep saves separate from 1.21.1 and back up before updating. -See [release notes](RELEASE_NOTES_26.3.0.15.md). +See [release notes](RELEASE_NOTES_26.3.1.0.md). This release adds [Accelerated machine ticking](../../docs/ACCELERATED_MACHINES.md), corrects [Writing Desk displays](../../docs/WRITING_DESK_MODEL.md), restores diff --git a/ports/mc263/RELEASE_NOTES_26.3.0.16.md b/ports/mc263/RELEASE_NOTES_26.3.0.16.md new file mode 100644 index 0000000..0e4c483 --- /dev/null +++ b/ports/mc263/RELEASE_NOTES_26.3.0.16.md @@ -0,0 +1,8 @@ +# Rivencraft 26.3.0.16 + +Intermediate development candidate; accepted changes are included in 1.21.1.1.0 / 26.3.1.0. This candidate was not published. + +- Native Nether uses lava for natural noise-terrain fluids, including Cave terrain, and disables Overworld water aquifers. +- Native End removes natural fluid filling and aquifers while retaining the chosen terrain geometry. +- Flat/Void remain flat/empty. Explicit Flooded and authored fluid features retain their own behavior. +- Updated Native-family tooltips. Existing generated chunks are not rewritten; test new Ages. diff --git a/ports/mc263/RELEASE_NOTES_26.3.0.17.md b/ports/mc263/RELEASE_NOTES_26.3.0.17.md new file mode 100644 index 0000000..b89bdd5 --- /dev/null +++ b/ports/mc263/RELEASE_NOTES_26.3.0.17.md @@ -0,0 +1,9 @@ +# Rivencraft 26.3.0.17 + +Intermediate development candidate; accepted changes are included in 1.21.1.1.0 / 26.3.1.0. This candidate was not published. + +- Native Nether defaults to its Nether sky, and Native End to its End sky, unless an explicit Sky Page chooses another style. +- Written Sky Pages retain priority with authored celestials. Native/Caves keep their previous sky fallback. +- Includes Native Nether natural lava and Native End dry-terrain changes from the prior candidate. +- Flat/Void geometry and explicitly authored Flooded/fluid features retain their behavior. +- Updated tooltips. Existing generated chunks are not rewritten. diff --git a/ports/mc263/RELEASE_NOTES_26.3.0.18.md b/ports/mc263/RELEASE_NOTES_26.3.0.18.md new file mode 100644 index 0000000..b67c683 --- /dev/null +++ b/ports/mc263/RELEASE_NOTES_26.3.0.18.md @@ -0,0 +1,10 @@ +# Rivencraft 26.3.0.18 + +Intermediate development candidate; accepted changes are included in 1.21.1.1.0 / 26.3.1.0. This candidate was not published. + +- Flat End biomes now use End Stone instead of grass/dirt. +- Flat Nether biomes use Nether ground, including Crimson/Warped Nylium, Soul Sand/Soul Soil and Basalt/Blackstone for the corresponding vanilla biomes. +- Supports single-biome plans and local materials in mixed distributions, including tagged End and TerraBlender-region Nether classification. +- Base-column queries match placed materials. Bedrock, air, height, authored features and fluids are preserved. +- Includes the earlier Native Nether lava / Native End dry generation and default sky improvements. +- Existing generated chunks are not rewritten; use fresh Ages for visual checks. diff --git a/ports/mc263/RELEASE_NOTES_26.3.0.19.md b/ports/mc263/RELEASE_NOTES_26.3.0.19.md new file mode 100644 index 0000000..4b7c8eb --- /dev/null +++ b/ports/mc263/RELEASE_NOTES_26.3.0.19.md @@ -0,0 +1,11 @@ +# Rivencraft 26.3.0.19 + +Intermediate development candidate; accepted changes are included in 1.21.1.1.0 / 26.3.1.0. This candidate was not published. + +- Extends the block-prediction acknowledgement guard to Seamless as well as Reborn during portal-engine world-map reset. +- Preserves normal initialized multiworld acknowledgements and off-thread packet scheduling. +- Filters only unavailable section rebuild jobs before compilation when a supported portal fork is installed. Valid jobs, geometry callbacks and dirty state remain intact. +- Unrelated renderer exceptions are not swallowed. Full runtime/client validation is still required. +- Includes the accepted Native fluids/skies and Flat End/Nether ground updates. + +26.3 build passed; 47 isolated guard checks passed. Minecraft runtime types were stubs, with production guard bytecode and both forks' actual acknowledgement redirect bytecode. This is not a complete client/network/GPU pass. Minecraft 1.21.1 is unchanged by this fix. diff --git a/ports/mc263/RELEASE_NOTES_26.3.1.0.md b/ports/mc263/RELEASE_NOTES_26.3.1.0.md new file mode 100644 index 0000000..fab047f --- /dev/null +++ b/ports/mc263/RELEASE_NOTES_26.3.1.0.md @@ -0,0 +1,20 @@ +# Rivencraft 26.3.1.0 + +Completes Milestone X.1.0 for Minecraft 26.3 / NeoForge 26.3.0.99 / Java 25. +Uses Rivencraft's first-party Age backend; no Dynamic Dimensions or Bad Packets required. Use matching client/server builds and the JAR for your Minecraft version. + +- Native Nether uses lava for natural noise-terrain fluids, including Cave terrain, and disables Overworld water aquifers. +- Native End removes natural fluid filling and aquifers while preserving the chosen terrain geometry. +- Native Nether and Native End default to their corresponding skies when no Sky Page is written. Explicit Sky Pages retain priority, including with authored celestials. +- Flat End biomes use End Stone instead of grass/dirt. Flat Nether biomes use Nether ground, including Crimson/Warped Nylium, Soul Sand/Soul Soil and Basalt/Blackstone for the corresponding vanilla biomes. +- Corrects single-biome Flat generation and local materials across mixed distributions. Tagged End biomes and TerraBlender-region Nether classification are recognized; other recognized Nether biomes use the Netherrack fallback. +- Base-column queries match placed Flat materials. Bedrock, air, height, authored features and explicit Flooded/fluid features retain their behavior. +- Updated Native-family tooltips. Existing generated chunks are not rewritten. +- Extends the transitional block-prediction acknowledgement guard to Seamless and Reborn, preserving ordinary initialized multiworld delivery and off-thread scheduling. +- Filters only unavailable section rebuild jobs before compilation when either supported portal engine is installed. Valid jobs, additional geometry and dirty state are preserved; unrelated renderer exceptions propagate. + +Player in-game checks passed. Sequential Native-generation probes passed **219 checks on 1.21.1 / 213 on 26.3**, including actual Flat block placement, mixed distributions, generator codecs, natural-fluid settings and sky precedence. Temporary worlds were removed; no probe stalled. + +The transition guards passed **47 isolated checks** using production guard bytecode and both forks' acknowledgement redirect bytecode with stubbed Minecraft runtime types. The player subsequently reported in-game acceptance. This does not claim an independent exhaustive GPU/network matrix or standalone external-fork reproduction. Install only one optional portal fork at a time. + +Versioning is now **Minecraft version.1.0**: milestone/release slice 1, iteration 0. Both Minecraft tracks retain separate builds and saves. diff --git a/ports/mc263/gradle.properties b/ports/mc263/gradle.properties index 7f57fb8..5b384ee 100644 --- a/ports/mc263/gradle.properties +++ b/ports/mc263/gradle.properties @@ -7,7 +7,7 @@ neo_version=26.3.0.99 mod_id=rivencraft mod_name=Rivencraft mod_license=LGPL-3.0-or-later -mod_version=26.3.0.15 +mod_version=26.3.1.0 jei_version=31.17.0.109 diff --git a/ports/mc263/src/main/java/net/dnorberg/rivencraft/age/PortFlatChunkGenerator.java b/ports/mc263/src/main/java/net/dnorberg/rivencraft/age/PortFlatChunkGenerator.java index bec4c45..c666037 100644 --- a/ports/mc263/src/main/java/net/dnorberg/rivencraft/age/PortFlatChunkGenerator.java +++ b/ports/mc263/src/main/java/net/dnorberg/rivencraft/age/PortFlatChunkGenerator.java @@ -3,6 +3,8 @@ package net.dnorberg.rivencraft.age; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; +import net.dnorberg.rivencraft.shared.FlatBiomeMaterials; +import net.minecraft.resources.Identifier; import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.stream.Stream; @@ -38,16 +40,25 @@ import org.jspecify.annotations.Nullable; public final class PortFlatChunkGenerator extends ChunkGenerator { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group( BiomeSource.CODEC.fieldOf("biome_source").forGetter(generator -> generator.biomeSource), - FlatLevelGeneratorSettings.CODEC.fieldOf("settings").forGetter(PortFlatChunkGenerator::settings) + FlatLevelGeneratorSettings.CODEC.fieldOf("settings").forGetter(PortFlatChunkGenerator::settings), + Identifier.CODEC.listOf().optionalFieldOf("nether_biomes", List.of()).forGetter(generator -> generator.netherBiomeIds) ).apply(instance, PortFlatChunkGenerator::new)); private final FlatLevelGeneratorSettings settings; + private final List netherBiomeIds; + private final Set netherBiomes; private final MemoizedFunction, BiomeGenerationSettings> generationSettingsGetter; public PortFlatChunkGenerator(BiomeSource biomeSource, FlatLevelGeneratorSettings settings) { + this(biomeSource, settings, List.of()); + } + + public PortFlatChunkGenerator(BiomeSource biomeSource, FlatLevelGeneratorSettings settings, List netherBiomeIds) { super(biomeSource, this.generationSettingsGetter = MemoizedFunction.of( biome -> generationSettings(settings, biome))); this.settings = settings; + this.netherBiomeIds = List.copyOf(netherBiomeIds); + this.netherBiomes = Set.copyOf(netherBiomeIds); } public FlatLevelGeneratorSettings settings() { @@ -92,6 +103,7 @@ public final class PortFlatChunkGenerator extends ChunkGenerator { RandomState random, StructureManager structures, BiomeManager biomes, @Nullable WorldGenRegion carverBiomeRegion, Set> possibleBiomes) { List layers = settings.getLayers(); + var resolver = biomeSource.createUncachedResolver(random); BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(); Heightmap floor = chunk.getOrCreateHeightmapUnprimed(Heightmap.Types.OCEAN_FLOOR_WG); Heightmap surface = chunk.getOrCreateHeightmapUnprimed(Heightmap.Types.WORLD_SURFACE_WG); @@ -100,9 +112,11 @@ public final class PortFlatChunkGenerator extends ChunkGenerator { if (state == null) continue; int y = chunk.getMinY() + layer; for (int x = 0; x < 16; x++) for (int z = 0; z < 16; z++) { - chunk.setBlockState(pos.set(x, y, z), state); - floor.update(x, y, z, state); - surface.update(x, y, z, state); + BlockState actual = layerState(state, chunk.getPos().getMinBlockX() + x, y, + chunk.getPos().getMinBlockZ() + z, resolver); + chunk.setBlockState(pos.set(x, y, z), actual); + floor.update(x, y, z, actual); + surface.update(x, y, z, actual); } } return CompletableFuture.completedFuture(chunk); @@ -121,11 +135,22 @@ public final class PortFlatChunkGenerator extends ChunkGenerator { @Override public NoiseColumn getBaseColumn(int x, int z, LevelHeightAccessor height, RandomState random) { - return new NoiseColumn(height.getMinY(), settings.getLayers().stream().limit(height.getHeight()) - .map(state -> state == null ? Blocks.AIR.defaultBlockState() : state) + var layers = settings.getLayers(); + var resolver = biomeSource.createUncachedResolver(random); + return new NoiseColumn(height.getMinY(), java.util.stream.IntStream.range(0, Math.min(height.getHeight(), layers.size())) + .mapToObj(i -> layerState(layers.get(i), x, height.getMinY() + i, z, resolver)) .toArray(BlockState[]::new)); } + private BlockState layerState(BlockState state, int x, int y, int z, net.minecraft.world.level.biome.BiomeResolver resolver) { + if (state == null) return Blocks.AIR.defaultBlockState(); + if (!FlatBiomeMaterials.isBaseMaterial(state)) return state; + var biome = resolver.getNoiseBiome(net.minecraft.core.QuartPos.fromBlock(x), + net.minecraft.core.QuartPos.fromBlock(y), net.minecraft.core.QuartPos.fromBlock(z)); + boolean regionNether = biome.unwrapKey().map(key -> netherBiomes.contains(key.identifier())).orElse(false); + return FlatBiomeMaterials.layer(state, biome, regionNether); + } + @Override public void addDebugScreenInfo(List info, RandomState random, BlockPos pos, SamplerContext context) { } @Override public void spawnOriginalMobs(WorldGenRegion level) { } diff --git a/ports/mc263/src/main/java/net/dnorberg/rivencraft/age/PortSkyStyle.java b/ports/mc263/src/main/java/net/dnorberg/rivencraft/age/PortSkyStyle.java index fa36861..2c05214 100644 --- a/ports/mc263/src/main/java/net/dnorberg/rivencraft/age/PortSkyStyle.java +++ b/ports/mc263/src/main/java/net/dnorberg/rivencraft/age/PortSkyStyle.java @@ -2,6 +2,7 @@ package net.dnorberg.rivencraft.age; import com.mojang.serialization.Codec; import java.util.List; +import net.dnorberg.rivencraft.shared.NativeBiomeKind; import java.util.Locale; import java.util.Random; import net.dnorberg.rivencraft.Rivencraft; @@ -30,9 +31,25 @@ public enum PortSkyStyle { } public static PortSkyStyle resolve(List pages, long seed, PortRandomPagePolicy policy) { - return pages.stream().map(PortSkyStyle::forPage).filter(java.util.Objects::nonNull) - .findFirst().orElseGet(() -> pages.stream().anyMatch(PortSkyStyle::isCelestial) - ? OVERWORLD : random(seed, policy)); + var explicit = pages.stream().map(PortSkyStyle::forPage).filter(java.util.Objects::nonNull).findFirst(); + if (explicit.isPresent()) return explicit.get(); + NativeBiomeKind family = NativeBiomeKind.TERRAIN; + for (var page : pages) { + if (!page.getNamespace().equals(Rivencraft.MOD_ID) || !page.getPath().startsWith("biome/")) continue; + String choice = page.getPath().substring("biome/".length()); + if (NativeBiomeKind.isController(choice)) family = NativeBiomeKind.controller(choice); + } + PortSkyStyle nativeSky = forNativeKind(family, null); + if (nativeSky != null) return nativeSky; + return pages.stream().anyMatch(PortSkyStyle::isCelestial) ? OVERWORLD : random(seed, policy); + } + + public static PortSkyStyle forNativeKind(NativeBiomeKind kind, PortSkyStyle fallback) { + return switch (kind) { + case NETHER -> NETHER; + case END -> END; + default -> fallback; + }; } /** Nether-style Ages use their fog clear color as the visible backdrop. */ diff --git a/ports/mc263/src/main/java/net/dnorberg/rivencraft/age/RuntimeAgeBackend.java b/ports/mc263/src/main/java/net/dnorberg/rivencraft/age/RuntimeAgeBackend.java index 1a019f2..fb8e022 100644 --- a/ports/mc263/src/main/java/net/dnorberg/rivencraft/age/RuntimeAgeBackend.java +++ b/ports/mc263/src/main/java/net/dnorberg/rivencraft/age/RuntimeAgeBackend.java @@ -1,5 +1,7 @@ package net.dnorberg.rivencraft.age; +import net.dnorberg.rivencraft.shared.NativeBiomeKind; + import java.io.IOException; import java.nio.file.AtomicMoveNotSupportedException; import java.nio.file.Files; @@ -123,7 +125,8 @@ public final class RuntimeAgeBackend { PortTerrainFeaturePlan terrainFeatures, PortWeatherMode weather, PortLighting lighting) { return create(server, id, seed, biomePlan, terrain, rocks, vegetation, dungeons, lakes, - terrainFeatures, weather, lighting, PortSkyStyle.OVERWORLD); + terrainFeatures, weather, lighting, PortSkyStyle.forNativeKind( + biomePlan == null ? NativeBiomeKind.TERRAIN : biomePlan.nativeKind(), PortSkyStyle.OVERWORLD)); } public static ServerLevel create(MinecraftServer server, Identifier id, long seed, @@ -539,7 +542,7 @@ public final class RuntimeAgeBackend { if (server.getLevel(key) != null) throw new IllegalArgumentException("Level already loaded: " + id); if (biomePlan != null && biomePlan.distribution() == PortBiomePlan.Distribution.NATIVE && !biomePlan.biomes().isEmpty() && terrain != PortAgeTerrain.CAVE - && biomePlan.nativeKind() == net.dnorberg.rivencraft.shared.NativeBiomeKind.TERRAIN) + && biomePlan.nativeKind() == NativeBiomeKind.TERRAIN) throw new IllegalArgumentException("Only Native Cave terrain may carry an explicit native biome pool"); // Noise terrains reuse the Overworld biome source unless a @@ -575,11 +578,15 @@ public final class RuntimeAgeBackend { settings = new FlatLevelGeneratorSettings(Optional.empty(), biome, List.of()); settings.updateLayers(); } - generator = biomePlan != null && biomePlan.biomes().size() > 1 - ? new PortFlatChunkGenerator(authoredBiomeSource(server, biomePlan, seed), settings) + var netherBiomes = net.dnorberg.rivencraft.compat.TerraBlenderBiomes.nether(server.registryAccess()); + boolean specialGround = net.dnorberg.rivencraft.shared.FlatBiomeMaterials.isEnd(biome) + || net.dnorberg.rivencraft.shared.FlatBiomeMaterials.isNether(biome, + biome.unwrapKey().map(b -> netherBiomes.contains(b.identifier())).orElse(false)); + generator = biomePlan != null && (biomePlan.biomes().size() > 1 || specialGround) + ? new PortFlatChunkGenerator(authoredBiomeSource(server, biomePlan, seed), settings, netherBiomes) : new FlatLevelSource(settings); } else if ((biomePlan != null && (biomePlan.distribution() != PortBiomePlan.Distribution.NATIVE - || biomePlan.nativeKind() != net.dnorberg.rivencraft.shared.NativeBiomeKind.TERRAIN)) + || biomePlan.nativeKind() != NativeBiomeKind.TERRAIN)) || terrain != PortAgeTerrain.STANDARD) { // A Flat/skyblock Overworld has no noise generator to adapt. Native // family pages must still work with an independently authored noise terrain. @@ -595,7 +602,7 @@ public final class RuntimeAgeBackend { .getOrThrow(Biomes.LUSH_CAVES)) : noise.getBiomeSource(); if (terrain == PortAgeTerrain.CAVE && biomePlan != null - && biomePlan.nativeKind() == net.dnorberg.rivencraft.shared.NativeBiomeKind.TERRAIN) { + && biomePlan.nativeKind() == NativeBiomeKind.TERRAIN) { var biomes = server.registryAccess().lookupOrThrow(Registries.BIOME); for (Identifier biomeId : biomePlan.biomes()) { var holder = biomes.get(ResourceKey.create(Registries.BIOME, biomeId)) @@ -605,7 +612,7 @@ public final class RuntimeAgeBackend { } } if (biomePlan != null && (biomePlan.distribution() != PortBiomePlan.Distribution.NATIVE - || biomePlan.nativeKind() != net.dnorberg.rivencraft.shared.NativeBiomeKind.TERRAIN + || biomePlan.nativeKind() != NativeBiomeKind.TERRAIN || terrain == PortAgeTerrain.CAVE && !biomePlan.biomes().isEmpty())) { source = authoredBiomeSource(server, biomePlan, seed); } @@ -615,10 +622,17 @@ public final class RuntimeAgeBackend { .getOrThrow(NoiseGeneratorSettings.AMPLIFIED); case ISLAND -> server.registryAccess().lookupOrThrow(Registries.NOISE_SETTINGS) .getOrThrow(NoiseGeneratorSettings.FLOATING_ISLANDS); - case CAVE -> dryCaveSettings(server); + case CAVE -> biomePlan != null + && biomePlan.nativeKind() == NativeBiomeKind.NETHER + ? server.registryAccess().lookupOrThrow(Registries.NOISE_SETTINGS) + .getOrThrow(NoiseGeneratorSettings.CAVES) + : dryCaveSettings(server); case FLAT, VOID -> throw new IllegalStateException("Flat terrain should use FlatLevelSource"); }; - generator = new NoiseBasedChunkGenerator(source, PortBiomeMaterialRules.apply(server.registryAccess(), settings.value())); + var nativeKind = biomePlan == null ? NativeBiomeKind.TERRAIN + : biomePlan.nativeKind(); + var fluids = nativeFluidSettings(settings.value(), nativeKind); + generator = new NoiseBasedChunkGenerator(source, PortBiomeMaterialRules.apply(server.registryAccess(), fluids)); } generator = new PortFeatureChunkGenerator(generator, rocks, vegetation, dungeons, lakes, terrainFeatures, seed, terrain != PortAgeTerrain.CAVE, PortLibraryWriting.get(server).symbols(id)); @@ -654,6 +668,18 @@ public final class RuntimeAgeBackend { } } + /** Native family controls natural fluid only; authored Flooded/features run later. */ + static NoiseGeneratorSettings nativeFluidSettings(NoiseGeneratorSettings base, + NativeBiomeKind kind) { + if (kind != NativeBiomeKind.NETHER + && kind != NativeBiomeKind.END) return base; + boolean nether = kind == NativeBiomeKind.NETHER; + return new NoiseGeneratorSettings(base.noiseSettings(), base.defaultBlock(), + (nether ? Blocks.LAVA : Blocks.AIR).defaultBlockState(), base.noiseRouter(), + base.materialRule(), base.spawnTarget(), nether ? base.seaLevel() : base.noiseSettings().minY() - 1, + base.disableMobGeneration(), Optional.empty(), base.useLegacyRandomSource(), base.debugFunctions()); + } + private static Holder dryCaveSettings(MinecraftServer server) { NoiseGeneratorSettings caves = server.registryAccess().lookupOrThrow(Registries.NOISE_SETTINGS) .getOrThrow(NoiseGeneratorSettings.CAVES).value(); diff --git a/ports/mc263/src/main/java/net/dnorberg/rivencraft/client/RebornPredictionAcks.java b/ports/mc263/src/main/java/net/dnorberg/rivencraft/client/ImmersivePredictionAcks.java similarity index 63% rename from ports/mc263/src/main/java/net/dnorberg/rivencraft/client/RebornPredictionAcks.java rename to ports/mc263/src/main/java/net/dnorberg/rivencraft/client/ImmersivePredictionAcks.java index d3fe045..9d8df95 100644 --- a/ports/mc263/src/main/java/net/dnorberg/rivencraft/client/RebornPredictionAcks.java +++ b/ports/mc263/src/main/java/net/dnorberg/rivencraft/client/ImmersivePredictionAcks.java @@ -3,14 +3,14 @@ package net.dnorberg.rivencraft.client; import net.minecraft.client.multiplayer.ClientLevel; import qouteall.imm_ptl.core.ClientWorldLoader; -/** Reborn's world map is briefly unavailable during vanilla dimension replacement. */ -public final class RebornPredictionAcks { - private RebornPredictionAcks() {} +/** The portal engine's world map is briefly unavailable during vanilla dimension replacement. */ +public final class ImmersivePredictionAcks { + private ImmersivePredictionAcks() {} public static boolean handleDuringWorldReset(ClientLevel packetLevel, int sequence) { if (ClientWorldLoader.getIsInitialized()) return false; // The old remote worlds have been discarded. Preserve the vanilla ack for - // the packet listener's live world until Reborn rebuilds its multiworld map. + // the packet listener's live world until the portal engine rebuilds its multiworld map. if (packetLevel != null) packetLevel.handleBlockChangedAck(sequence); return true; } diff --git a/ports/mc263/src/main/java/net/dnorberg/rivencraft/client/ImmersiveSectionRebuilds.java b/ports/mc263/src/main/java/net/dnorberg/rivencraft/client/ImmersiveSectionRebuilds.java new file mode 100644 index 0000000..0ecc9f9 --- /dev/null +++ b/ports/mc263/src/main/java/net/dnorberg/rivencraft/client/ImmersiveSectionRebuilds.java @@ -0,0 +1,20 @@ +package net.dnorberg.rivencraft.client; + +import net.dnorberg.rivencraft.mixin.ViewAreaSectionAccessor; +import net.minecraft.client.renderer.ViewArea; +import net.minecraft.client.renderer.state.level.LevelRenderState; + +/** Extracted section jobs may outlive the view area that originally supplied them. */ +public final class ImmersiveSectionRebuilds { + private ImmersiveSectionRebuilds() {} + + public static void discardUnavailable(ViewArea viewArea, LevelRenderState state) { + if (viewArea == null || state.sectionUpdateRenderStates.isEmpty()) return; + var sections = (ViewAreaSectionAccessor) viewArea; + // A missing section cannot be compiled in this view. Leave every existing + // section/job untouched, including dirty state and additional renderers. + // Newly allocated sections start dirty and use normal extraction afterward. + state.sectionUpdateRenderStates.removeIf(job -> + sections.rivencraft$getRenderSection(job.sectionNode()) == null); + } +} diff --git a/ports/mc263/src/main/java/net/dnorberg/rivencraft/mixin/RebornBlockAckMixin.java b/ports/mc263/src/main/java/net/dnorberg/rivencraft/mixin/ImmersiveBlockAckMixin.java similarity index 75% rename from ports/mc263/src/main/java/net/dnorberg/rivencraft/mixin/RebornBlockAckMixin.java rename to ports/mc263/src/main/java/net/dnorberg/rivencraft/mixin/ImmersiveBlockAckMixin.java index c18c475..a90edc1 100644 --- a/ports/mc263/src/main/java/net/dnorberg/rivencraft/mixin/RebornBlockAckMixin.java +++ b/ports/mc263/src/main/java/net/dnorberg/rivencraft/mixin/ImmersiveBlockAckMixin.java @@ -1,6 +1,6 @@ package net.dnorberg.rivencraft.mixin; -import net.dnorberg.rivencraft.client.RebornPredictionAcks; +import net.dnorberg.rivencraft.client.ImmersivePredictionAcks; import net.dnorberg.rivencraft.compat.ImmersiveBookPreviews; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; @@ -12,15 +12,15 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -/** Keep transitional acks out of Reborn's initialized-world assertion. */ +/** Keep transitional acks out of the portal engine's initialized-world assertion. */ @Mixin(value = ClientPacketListener.class, priority = 2000) -public abstract class RebornBlockAckMixin { +public abstract class ImmersiveBlockAckMixin { @Shadow private ClientLevel level; @Inject(method = "handleBlockChangedAck", at = @At("HEAD"), cancellable = true) private void rivencraft$ackDuringWorldReset(ClientboundBlockChangedAckPacket packet, CallbackInfo callback) { // Off-thread packets must reach vanilla's normal scheduling path first. - if (Minecraft.getInstance().isSameThread() && ImmersiveBookPreviews.reborn() - && RebornPredictionAcks.handleDuringWorldReset(level, packet.sequence())) callback.cancel(); + if (Minecraft.getInstance().isSameThread() && ImmersiveBookPreviews.available() + && ImmersivePredictionAcks.handleDuringWorldReset(level, packet.sequence())) callback.cancel(); } } diff --git a/ports/mc263/src/main/java/net/dnorberg/rivencraft/mixin/ImmersiveSectionRebuildMixin.java b/ports/mc263/src/main/java/net/dnorberg/rivencraft/mixin/ImmersiveSectionRebuildMixin.java new file mode 100644 index 0000000..6c4cec8 --- /dev/null +++ b/ports/mc263/src/main/java/net/dnorberg/rivencraft/mixin/ImmersiveSectionRebuildMixin.java @@ -0,0 +1,26 @@ +package net.dnorberg.rivencraft.mixin; + +import net.dnorberg.rivencraft.client.ImmersiveSectionRebuilds; +import net.dnorberg.rivencraft.compat.ImmersiveBookPreviews; +import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.ViewArea; +import net.minecraft.client.renderer.state.level.CameraRenderState; +import net.minecraft.client.renderer.state.level.LevelRenderState; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(value = LevelRenderer.class, priority = 2000) +public abstract class ImmersiveSectionRebuildMixin { + @Shadow private ViewArea viewArea; + @Shadow @Final private LevelRenderState levelRenderState; + + @Inject(method = "compileSections", at = @At("HEAD")) + private void rivencraft$discardUnavailableSections(CameraRenderState camera, CallbackInfo callback) { + if (ImmersiveBookPreviews.available()) + ImmersiveSectionRebuilds.discardUnavailable(viewArea, levelRenderState); + } +} diff --git a/ports/mc263/src/main/java/net/dnorberg/rivencraft/mixin/ViewAreaSectionAccessor.java b/ports/mc263/src/main/java/net/dnorberg/rivencraft/mixin/ViewAreaSectionAccessor.java new file mode 100644 index 0000000..914ee21 --- /dev/null +++ b/ports/mc263/src/main/java/net/dnorberg/rivencraft/mixin/ViewAreaSectionAccessor.java @@ -0,0 +1,12 @@ +package net.dnorberg.rivencraft.mixin; + +import net.minecraft.client.renderer.ViewArea; +import net.minecraft.client.renderer.chunk.SectionRenderDispatcher; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Invoker; + +@Mixin(ViewArea.class) +public interface ViewAreaSectionAccessor { + @Invoker("getRenderSection") + SectionRenderDispatcher.RenderSection rivencraft$getRenderSection(long sectionNode); +} diff --git a/ports/mc263/src/main/resources/rivencraft.mixins.json b/ports/mc263/src/main/resources/rivencraft.mixins.json index 08cc685..ccdc50f 100644 --- a/ports/mc263/src/main/resources/rivencraft.mixins.json +++ b/ports/mc263/src/main/resources/rivencraft.mixins.json @@ -20,7 +20,9 @@ "StaticSkyRendererMixin", "ImmersiveGuiRenderingMixin", "ClientLevelSoundMixin", - "RebornBlockAckMixin" + "ImmersiveBlockAckMixin", + "ViewAreaSectionAccessor", + "ImmersiveSectionRebuildMixin" ], "injectors": { "defaultRequire": 1 diff --git a/scripts/fixtures/native119/mc1211/net/dnorberg/rivencraft/book/NativeFluidProbe.java b/scripts/fixtures/native119/mc1211/net/dnorberg/rivencraft/book/NativeFluidProbe.java new file mode 100644 index 0000000..88a84f4 --- /dev/null +++ b/scripts/fixtures/native119/mc1211/net/dnorberg/rivencraft/book/NativeFluidProbe.java @@ -0,0 +1,191 @@ +package net.dnorberg.rivencraft.book; + +import java.util.*; +import com.mojang.serialization.JsonOps; +import net.dnorberg.rivencraft.shared.NativeBiomeKind; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.MinecraftServer; +import net.minecraft.world.level.chunk.ChunkGenerator; +import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator; +import net.minecraft.world.level.levelgen.NoiseGeneratorSettings; +import net.minecraft.world.level.levelgen.Aquifer; +import net.minecraft.world.level.block.Blocks; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.event.server.ServerStartedEvent; + +/** Disposable fixture: exercises real generator settings, fluid picker and codecs. */ +@EventBusSubscriber(modid="rivencraft") +public final class NativeFluidProbe { + private static int checks; + private static void check(boolean value, String label) { + if (!value) throw new AssertionError(label); + checks++; + } + static ResourceLocation id(String path) { return ResourceLocation.fromNamespaceAndPath("rivencraft", path); } + @SubscribeEvent public static void start(ServerStartedEvent event) { + event.getServer().execute(() -> { + try { run(event.getServer()); System.out.println("NATIVE119_PASS checks=" + checks); } + catch (Throwable error) { System.out.println("NATIVE119_FAIL " + error); error.printStackTrace(); } + finally { event.getServer().halt(false); } + }); + } + static void run(MinecraftServer server) throws Exception { + testFlatGround(server); + int index = 0; + for (var family : List.of(NativeBiomeKind.NETHER, NativeBiomeKind.END, NativeBiomeKind.CAVES)) { + for (String terrain : List.of("standard", "amplified", "island", "cave", "flat", "void")) { + var entries = new net.dnorberg.rivencraft.writing.OrderedWriting(List.of( + net.dnorberg.rivencraft.writing.WritingEntry.linkPanel(), + net.dnorberg.rivencraft.writing.WritingEntry.symbol(new net.dnorberg.rivencraft.writing.SymbolReference(id("terrain/" + terrain))), + net.dnorberg.rivencraft.writing.WritingEntry.symbol(new net.dnorberg.rivencraft.writing.SymbolReference(id("biome/native_" + family.name().toLowerCase(Locale.ROOT)))))); + var traits = AgeTraits.select(119L).withBiomeDistribution(AgeTraits.BiomeDistribution.NATIVE); + var plan = AgeGenerationPlan.compile(entries,119L,AgeGenerationProfiles.STANDARD,traits,server.registryAccess()); + check(plan.biomeSelection().nativeKind() == family, "Frozen family"); + var expectedSky = family == NativeBiomeKind.NETHER ? AgeSkyProfile.Style.NETHER + : family == NativeBiomeKind.END ? AgeSkyProfile.Style.END : AgeSkyProfile.Style.INHERITED; + check(AgeSkyProfile.compile(plan,traits).style() == expectedSky, "Native sky default " + family + terrain); + check(AgeSkyProfile.compile(AgeGenerationPlan.load(plan.save()),traits).style() == expectedSky, "Sky plan reload"); + if (family != NativeBiomeKind.CAVES) { + var expectedEffect = family == NativeBiomeKind.NETHER + ? net.minecraft.world.level.dimension.BuiltinDimensionTypes.NETHER_EFFECTS + : net.minecraft.world.level.dimension.BuiltinDimensionTypes.END_EFFECTS; + check(AgeEnvironmentCompiler.skyEffects(plan, + net.minecraft.world.level.dimension.BuiltinDimensionTypes.OVERWORLD_EFFECTS).equals(expectedEffect), + "Native dimension sky effect"); + if (terrain.equals("standard")) { + for (String sky : List.of("overworld", "nether", "end", "static")) { + var written = new ArrayList<>(entries.entries()); + written.add(net.dnorberg.rivencraft.writing.WritingEntry.symbol( + new net.dnorberg.rivencraft.writing.SymbolReference(id("sky/" + sky)))); + written.add(net.dnorberg.rivencraft.writing.WritingEntry.symbol( + new net.dnorberg.rivencraft.writing.SymbolReference(id("celestial/sun")))); + var override = AgeGenerationPlan.compile(new net.dnorberg.rivencraft.writing.OrderedWriting(written), + 119L,AgeGenerationProfiles.STANDARD,traits,server.registryAccess()); + check(AgeSkyProfile.compile(override,traits).style() == AgeSkyProfile.Style.valueOf(sky.toUpperCase(Locale.ROOT)), + "Explicit sky wins with celestial"); + } + var written = new ArrayList<>(entries.entries()); + written.add(net.dnorberg.rivencraft.writing.WritingEntry.symbol( + new net.dnorberg.rivencraft.writing.SymbolReference(id("celestial/sun")))); + var celestial = AgeGenerationPlan.compile(new net.dnorberg.rivencraft.writing.OrderedWriting(written), + 119L,AgeGenerationProfiles.STANDARD,traits,server.registryAccess()); + check(AgeSkyProfile.compile(celestial,traits).style() == expectedSky, "Celestial does not override Native default"); + } + } + var age = new AgeDefinition(UUID.randomUUID(),"probe",119L,AgeGenerationProfiles.STANDARD, + AgeDefinition.CURRENT_GENERATION_VERSION,0L,id("age/fluid119_" + index++),null,traits,plan); + var factory = AgeDimensionService.class.getDeclaredMethod("createGenerator",MinecraftServer.class,AgeDefinition.class); + factory.setAccessible(true); + var generator = (ChunkGenerator) factory.invoke(null,server,age); + var ops = server.registryAccess().createSerializationContext(JsonOps.INSTANCE); + var encoded = ChunkGenerator.CODEC.encodeStart(ops, generator).getOrThrow(); + var restored = ChunkGenerator.CODEC.parse(ops, encoded).getOrThrow(); + NoiseBasedChunkGenerator noise = generator instanceof NoiseBasedChunkGenerator n ? n : null; + NoiseBasedChunkGenerator restoredNoise = restored instanceof NoiseBasedChunkGenerator n ? n : null; + if (noise == null) { + check(restoredNoise == null, "Flat/Void remains flat: " + terrain); + continue; + } + var settings = noise.generatorSettings().value(); + var reloaded = restoredNoise.generatorSettings().value(); + check(reloaded.defaultFluid().equals(settings.defaultFluid()) + && reloaded.seaLevel() == settings.seaLevel(), "Fluid codec " + family + terrain); + if (family == NativeBiomeKind.NETHER) { + check(settings.defaultFluid().is(Blocks.LAVA), "Nether natural lava " + terrain); + check(!settings.isAquifersEnabled(), "Nether disables water aquifers " + terrain); + } else if (family == NativeBiomeKind.END) { + check(settings.defaultFluid().isAir(), "End dry " + terrain); + check(settings.seaLevel() < settings.noiseSettings().minY(), "End fluid below dimension " + terrain); + check(!settings.isAquifersEnabled(), "End disables aquifers " + terrain); + } else { + check(terrain.equals("cave") ? settings.defaultFluid().isAir() + : settings.defaultFluid().is(Blocks.WATER), "Other Native family unchanged " + terrain); + continue; + } + var method = NoiseBasedChunkGenerator.class.getDeclaredMethod("createFluidPicker", NoiseGeneratorSettings.class); + method.setAccessible(true); + var picker = (Aquifer.FluidPicker) method.invoke(null, settings); + boolean water = false, lava = false, anyFluid = false; + for (int y = settings.noiseSettings().minY(); y < settings.noiseSettings().minY() + settings.noiseSettings().height(); y++) { + var block = picker.computeFluid(0, y, 0).at(y); + water |= block.is(Blocks.WATER); lava |= block.is(Blocks.LAVA); + anyFluid |= !block.getFluidState().isEmpty(); + } + check(!water, "No natural water anywhere in column " + family + terrain); + check(family == NativeBiomeKind.NETHER ? lava == (settings.seaLevel() > settings.noiseSettings().minY()) : !anyFluid, "Nether lava / End dry picker " + terrain); + } + } + } + static void testFlatGround(MinecraftServer server) throws Exception { + var registry = server.registryAccess().lookupOrThrow(Registries.BIOME); + var random = server.overworld().getChunkSource().randomState(); + var settings = AgeDimensionService.flatSettings(server,AgeRuntimeProfiles.resolve(AgeGenerationProfiles.FLAT)); + var keys = List.of(net.minecraft.world.level.biome.Biomes.THE_END, net.minecraft.world.level.biome.Biomes.CRIMSON_FOREST, + net.minecraft.world.level.biome.Biomes.WARPED_FOREST, net.minecraft.world.level.biome.Biomes.SOUL_SAND_VALLEY, + net.minecraft.world.level.biome.Biomes.BASALT_DELTAS, net.minecraft.world.level.biome.Biomes.NETHER_WASTES, + net.minecraft.world.level.biome.Biomes.PLAINS); + var tops = List.of(Blocks.END_STONE,Blocks.CRIMSON_NYLIUM,Blocks.WARPED_NYLIUM,Blocks.SOUL_SAND,Blocks.BASALT,Blocks.NETHERRACK,Blocks.GRASS_BLOCK); + var soils = List.of(Blocks.END_STONE,Blocks.NETHERRACK,Blocks.NETHERRACK,Blocks.SOUL_SOIL,Blocks.BLACKSTONE,Blocks.NETHERRACK,Blocks.DIRT); + for (int i=0;i(old);tags.add(net.minecraft.tags.BiomeTags.IS_END);bind.invoke(plains,tags); + var tagged = new net.dnorberg.rivencraft.world.AgeFlatChunkGenerator( + new net.minecraft.world.level.biome.FixedBiomeSource(plains),settings); + check(tagged.getBaseColumn(0,0,net.minecraft.world.level.LevelHeightAccessor.create(-64,384),random) + .getBlock(3).is(Blocks.END_STONE), "Tag-classified modded-style End biome"); + } finally { bind.invoke(plains,old); } + var mixedSource = new net.minecraft.world.level.biome.CheckerboardColumnBiomeSource( + net.minecraft.core.HolderSet.direct(List.>of( + end,plains,registry.getOrThrow(net.minecraft.world.level.biome.Biomes.CRIMSON_FOREST))),0); + var mixed = new net.dnorberg.rivencraft.world.AgeFlatChunkGenerator(mixedSource,settings); + var seen = new HashSet(); + for (int cx=-2;cx<=2;cx++) { + int x=cx*16+1; + var biome = mixedSource.getNoiseBiome(net.minecraft.core.QuartPos.fromBlock(x),0,0,random.sampler()); + var expected = biome.is(net.minecraft.world.level.biome.Biomes.THE_END) ? Blocks.END_STONE + : biome.is(net.minecraft.world.level.biome.Biomes.CRIMSON_FOREST) ? Blocks.CRIMSON_NYLIUM : Blocks.GRASS_BLOCK; + seen.add(expected); + var height = net.minecraft.world.level.LevelHeightAccessor.create(-64,384); + var chunk = new net.minecraft.world.level.chunk.ProtoChunk(new net.minecraft.world.level.ChunkPos(cx,0),net.minecraft.world.level.chunk.UpgradeData.EMPTY,height,server.registryAccess().registryOrThrow(Registries.BIOME),null); + mixed.fillFromNoise(null,random,null,chunk).join(); + check(chunk.getBlockState(new net.minecraft.core.BlockPos(x,3,1)).is(expected), "Mixed biome actual surface"); + check(mixed.getBaseColumn(x,1,height,random).getBlock(3).is(expected), "Mixed biome spawn column"); + } + check(seen.size()==3, "Mixed test visits End, Nether and Overworld"); + } +} diff --git a/scripts/fixtures/native119/mc263/net/dnorberg/rivencraft/age/NativeFluidProbe.java b/scripts/fixtures/native119/mc263/net/dnorberg/rivencraft/age/NativeFluidProbe.java new file mode 100644 index 0000000..7bf0407 --- /dev/null +++ b/scripts/fixtures/native119/mc263/net/dnorberg/rivencraft/age/NativeFluidProbe.java @@ -0,0 +1,174 @@ +package net.dnorberg.rivencraft.age; + +import java.util.*; +import com.mojang.serialization.JsonOps; +import net.dnorberg.rivencraft.shared.NativeBiomeKind; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.Identifier; +import net.minecraft.server.MinecraftServer; +import net.minecraft.world.level.chunk.ChunkGenerator; +import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator; +import net.minecraft.world.level.levelgen.NoiseGeneratorSettings; +import net.minecraft.world.level.levelgen.Aquifer; +import net.minecraft.world.level.block.Blocks; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.event.server.ServerStartedEvent; + +/** Disposable fixture: exercises real generator settings, fluid picker and codecs. */ +@EventBusSubscriber(modid="rivencraft") +public final class NativeFluidProbe { + private static int checks; + private static void check(boolean value, String label) { + if (!value) throw new AssertionError(label); + checks++; + } + static Identifier id(String path) { return Identifier.fromNamespaceAndPath("rivencraft", path); } + @SubscribeEvent public static void start(ServerStartedEvent event) { + event.getServer().execute(() -> { + try { run(event.getServer()); System.out.println("NATIVE119_PASS checks=" + checks); } + catch (Throwable error) { System.out.println("NATIVE119_FAIL " + error); error.printStackTrace(); } + finally { event.getServer().halt(false); } + }); + } + static void run(MinecraftServer server) throws Exception { + testFlatGround(server); + int index = 0; + for (var family : List.of(NativeBiomeKind.NETHER, NativeBiomeKind.END, NativeBiomeKind.CAVES)) { + for (String terrain : List.of("standard", "amplified", "island", "cave", "flat", "void")) { + var selection = net.dnorberg.rivencraft.writing.PortAuthoredTerrainSelection.select(server, + List.of(id("terrain/" + terrain), id("biome/native_" + family.name().toLowerCase(Locale.ROOT))),119L); + check(selection.biomes().nativeKind() == family, "Frozen family"); + var pages = List.of(id("terrain/" + terrain), id("biome/native_" + family.name().toLowerCase(Locale.ROOT))); + var sky = PortEnvironmentSelection.resolve(pages,119L,selection.terrain()).sky(); + if (family != NativeBiomeKind.CAVES) { + var expectedSky = family == NativeBiomeKind.NETHER ? PortSkyStyle.NETHER : PortSkyStyle.END; + check(sky == expectedSky, "Native sky default " + family + terrain); + check(PortSkyStyle.CODEC.parse(JsonOps.INSTANCE,PortSkyStyle.CODEC.encodeStart(JsonOps.INSTANCE,sky) + .getOrThrow()).getOrThrow() == expectedSky, "Sky codec reload"); + if (terrain.equals("standard")) { + for (String choice : List.of("overworld", "nether", "end", "static")) { + var authored = new ArrayList<>(pages); + authored.add(id("sky/" + choice)); authored.add(id("celestial/sun")); + check(PortEnvironmentSelection.resolve(authored,119L,selection.terrain()).sky() + == PortSkyStyle.valueOf(choice.toUpperCase(Locale.ROOT)), "Explicit sky wins with celestial"); + } + var celestial = new ArrayList<>(pages); celestial.add(id("celestial/sun")); + check(PortSkyStyle.resolve(celestial,119L) == expectedSky, "Celestial does not override Native default"); + } + } + var level = RuntimeAgeBackend.create(server,id("age/fluid119_" + index++),119L,selection.biomes(),selection.terrain()); + var generator = level.getChunkSource().getGenerator(); + if (family != NativeBiomeKind.CAVES) check(level.dimensionTypeRegistration().unwrapKey().orElseThrow() + .identifier().getPath().endsWith("_sky_" + family.name().toLowerCase(Locale.ROOT)), "Runtime dimension sky"); + var ops = server.registryAccess().createSerializationContext(JsonOps.INSTANCE); + var encoded = ChunkGenerator.CODEC.encodeStart(ops, generator).getOrThrow(); + var restored = ChunkGenerator.CODEC.parse(ops, encoded).getOrThrow(); + NoiseBasedChunkGenerator noise = ((PortFeatureChunkGenerator) generator).base() instanceof NoiseBasedChunkGenerator n ? n : null; + NoiseBasedChunkGenerator restoredNoise = ((PortFeatureChunkGenerator) restored).base() instanceof NoiseBasedChunkGenerator n ? n : null; + if (noise == null) { + check(restoredNoise == null, "Flat/Void remains flat: " + terrain); + continue; + } + var settings = noise.generatorSettings().value(); + var reloaded = restoredNoise.generatorSettings().value(); + check(reloaded.defaultFluid().equals(settings.defaultFluid()) + && reloaded.seaLevel() == settings.seaLevel(), "Fluid codec " + family + terrain); + if (family == NativeBiomeKind.NETHER) { + check(settings.defaultFluid().is(Blocks.LAVA), "Nether natural lava " + terrain); + check(!settings.aquifers().isPresent(), "Nether disables water aquifers " + terrain); + } else if (family == NativeBiomeKind.END) { + check(settings.defaultFluid().isAir(), "End dry " + terrain); + check(settings.seaLevel() < settings.noiseSettings().minY(), "End fluid below dimension " + terrain); + check(!settings.aquifers().isPresent(), "End disables aquifers " + terrain); + } else { + check(terrain.equals("cave") ? settings.defaultFluid().isAir() + : settings.defaultFluid().is(Blocks.WATER), "Other Native family unchanged " + terrain); + continue; + } + var method = NoiseBasedChunkGenerator.class.getDeclaredMethod("createFluidPicker", NoiseGeneratorSettings.class); + method.setAccessible(true); + var picker = (Aquifer.FluidPicker) method.invoke(null, settings); + boolean water = false, lava = false, anyFluid = false; + for (int y = settings.noiseSettings().minY(); y < settings.noiseSettings().minY() + settings.noiseSettings().height(); y++) { + var block = picker.computeFluid(0, y, 0).at(y); + water |= block.is(Blocks.WATER); lava |= block.is(Blocks.LAVA); + anyFluid |= !block.getFluidState().isEmpty(); + } + check(!water, "No natural water anywhere in column " + family + terrain); + check(family == NativeBiomeKind.NETHER ? lava == (settings.seaLevel() > settings.noiseSettings().minY()) : !anyFluid, "Nether lava / End dry picker " + terrain); + } + } + } + static void testFlatGround(MinecraftServer server) throws Exception { + var registry = server.registryAccess().lookupOrThrow(Registries.BIOME); + var random = server.overworld().getChunkSource().randomState(); + var keys = List.of(net.minecraft.world.level.biome.Biomes.THE_END, net.minecraft.world.level.biome.Biomes.CRIMSON_FOREST, + net.minecraft.world.level.biome.Biomes.WARPED_FOREST, net.minecraft.world.level.biome.Biomes.SOUL_SAND_VALLEY, + net.minecraft.world.level.biome.Biomes.BASALT_DELTAS, net.minecraft.world.level.biome.Biomes.NETHER_WASTES, + net.minecraft.world.level.biome.Biomes.PLAINS); + var tops = List.of(Blocks.END_STONE,Blocks.CRIMSON_NYLIUM,Blocks.WARPED_NYLIUM,Blocks.SOUL_SAND,Blocks.BASALT,Blocks.NETHERRACK,Blocks.GRASS_BLOCK); + var soils = List.of(Blocks.END_STONE,Blocks.NETHERRACK,Blocks.NETHERRACK,Blocks.SOUL_SOIL,Blocks.BLACKSTONE,Blocks.NETHERRACK,Blocks.DIRT); + net.minecraft.world.level.levelgen.flat.FlatLevelGeneratorSettings settings = null; + for (int i=0;i(old);tags.add(net.minecraft.tags.BiomeTags.IS_END);bind.invoke(plains,tags); + var tagged = new PortFlatChunkGenerator(new net.minecraft.world.level.biome.FixedBiomeSource(plains),settings); + check(tagged.getBaseColumn(0,0,net.minecraft.world.level.LevelHeightAccessor.create(-64,384),random) + .getBlock(3).is(Blocks.END_STONE), "Tag-classified modded-style End biome"); + } finally { bind.invoke(plains,old); } + var mixedSource = new net.minecraft.world.level.biome.CheckerboardColumnBiomeSource( + net.minecraft.core.HolderSet.direct(List.>of( + end,plains,registry.getOrThrow(net.minecraft.world.level.biome.Biomes.CRIMSON_FOREST))),0); + var mixed = new PortFlatChunkGenerator(mixedSource,settings); + var seen = new HashSet(); + for (int cx=-2;cx<=2;cx++) { + int x=cx*16+1; + var biome = mixedSource.getNoiseBiome(net.minecraft.core.QuartPos.fromBlock(x),0,0); + var expected = biome.is(net.minecraft.world.level.biome.Biomes.THE_END) ? Blocks.END_STONE + : biome.is(net.minecraft.world.level.biome.Biomes.CRIMSON_FOREST) ? Blocks.CRIMSON_NYLIUM : Blocks.GRASS_BLOCK; + seen.add(expected); + var height = net.minecraft.world.level.LevelHeightAccessor.create(-64,384); + var chunk = new net.minecraft.world.level.chunk.ProtoChunk(new net.minecraft.world.level.ChunkPos(cx,0),net.minecraft.world.level.chunk.UpgradeData.EMPTY,height,net.minecraft.world.level.chunk.PalettedContainerFactory.create(server.registryAccess()),null); + mixed.buildTerrain(chunk,null,random,null,server.overworld().getBiomeManager(),null,mixed.getBiomeSource().possibleBiomes()).join(); + check(chunk.getBlockState(new net.minecraft.core.BlockPos(x,3,1)).is(expected), "Mixed biome actual surface"); + check(mixed.getBaseColumn(x,1,height,random).getBlock(3).is(expected), "Mixed biome spawn column"); + } + check(seen.size()==3, "Mixed test visits End, Nether and Overworld"); + } +} diff --git a/scripts/regression_client118.py b/scripts/regression_client118.py new file mode 100644 index 0000000..fab0274 --- /dev/null +++ b/scripts/regression_client118.py @@ -0,0 +1,195 @@ +#!/usr/bin/env python3 +"""Isolated 26.3 client-guard checks; no Minecraft client, GPU, server or world starts.""" +from pathlib import Path +import shutil +import subprocess +import tempfile + +ROOT = Path(__file__).resolve().parents[1] +STUBS = { + "net.minecraft.client.Minecraft": "public class Minecraft { public static boolean sameThread=true; private static final Minecraft INSTANCE=new Minecraft(); public static Minecraft getInstance(){return INSTANCE;} public boolean isSameThread(){return sameThread;} }", + "net.minecraft.client.multiplayer.ClientLevel": "public class ClientLevel { public final java.util.List acks=new java.util.ArrayList<>(); public void handleBlockChangedAck(int n){acks.add(n);} }", + "net.minecraft.client.multiplayer.ClientPacketListener": "public class ClientPacketListener {}", + "net.minecraft.network.protocol.game.ClientboundBlockChangedAckPacket": "public record ClientboundBlockChangedAckPacket(int sequence) {}", + "net.dnorberg.rivencraft.compat.ImmersiveBookPreviews": "public class ImmersiveBookPreviews { public static boolean reborn,seamless; public static boolean available(){return reborn||seamless;} }", + "qouteall.imm_ptl.core.ClientWorldLoader": "public class ClientWorldLoader { public static boolean initialized; public static int reads; public static final java.util.List worlds=new java.util.ArrayList<>(); public static boolean getIsInitialized(){reads++;return initialized;} public static java.util.Collection getClientWorlds(){if(!initialized)throw new IllegalArgumentException();return worlds;} }", + "net.minecraft.client.renderer.chunk.SectionRenderDispatcher": "public class SectionRenderDispatcher { public class RenderSection { public boolean dirty=true; } }", + "net.minecraft.client.renderer.ViewArea": "public class ViewArea implements net.dnorberg.rivencraft.mixin.ViewAreaSectionAccessor { public final java.util.Map sections=new java.util.HashMap<>(); public boolean fail; public int reads; public net.minecraft.client.renderer.chunk.SectionRenderDispatcher.RenderSection rivencraft$getRenderSection(long n){reads++;if(fail)throw new IllegalStateException();return sections.get(n);} }", + "net.minecraft.client.renderer.LevelRenderer": "public class LevelRenderer {}", + "net.minecraft.client.renderer.state.level.CameraRenderState": "public class CameraRenderState {}", + "net.minecraft.client.renderer.state.level.SectionUpdateRenderState": "public record SectionUpdateRenderState(long sectionNode,boolean playerChanged,Object region,java.util.List additionalRenderers) {}", + "net.minecraft.client.renderer.state.level.LevelRenderState": "public class LevelRenderState { public final java.util.List sectionUpdateRenderStates=new java.util.ArrayList<>(); }", +} +EXTRACT = r""" +import java.nio.file.*; import java.util.zip.*; import org.objectweb.asm.*; +public class ExtractForkAck { + public static void main(String[] args)throws Exception { + var writer=new ClassWriter(ClassWriter.COMPUTE_FRAMES|ClassWriter.COMPUTE_MAXS); + writer.visit(Opcodes.V25,Opcodes.ACC_PUBLIC,args[1],null,"java/lang/Object",null); + var init=writer.visitMethod(Opcodes.ACC_PUBLIC,"","()V",null,null); + init.visitCode();init.visitVarInsn(Opcodes.ALOAD,0);init.visitMethodInsn(Opcodes.INVOKESPECIAL,"java/lang/Object","","()V",false);init.visitInsn(Opcodes.RETURN);init.visitMaxs(0,0);init.visitEnd(); + int[] copied={0}; + try(var zip=new ZipFile(args[0])) { + var bytes=zip.getInputStream(zip.getEntry("qouteall/imm_ptl/core/mixin/client/sync/MixinClientPacketListener.class")).readAllBytes(); + new ClassReader(bytes).accept(new ClassVisitor(Opcodes.ASM9) { + @Override public MethodVisitor visitMethod(int access,String name,String desc,String sig,String[] exceptions) { + if(!name.equals("redirectHandleBlockChangedAck"))return null; + copied[0]++; + return new MethodVisitor(Opcodes.ASM9,writer.visitMethod(Opcodes.ACC_PUBLIC,"handle",desc,null,null)) { + @Override public AnnotationVisitor visitAnnotation(String desc,boolean visible){return null;} + }; + } + },ClassReader.SKIP_FRAMES|ClassReader.SKIP_DEBUG); + } + if(copied[0]!=1)throw new AssertionError("Expected exactly one fork redirect"); + writer.visitEnd();Files.write(Path.of(args[2]),writer.toByteArray()); + } +} +""" +CHECKS = r""" +import java.util.*; +import java.lang.reflect.*; +import net.minecraft.client.*; +import net.minecraft.client.multiplayer.*; +import net.minecraft.network.protocol.game.*; +import net.minecraft.client.renderer.*; +import net.minecraft.client.renderer.chunk.SectionRenderDispatcher.RenderSection; +import net.minecraft.client.renderer.state.level.*; +import net.dnorberg.rivencraft.mixin.*; +import net.dnorberg.rivencraft.compat.ImmersiveBookPreviews; +import qouteall.imm_ptl.core.ClientWorldLoader; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +public class Client118Checks { + static int checks; + public static class Ack extends ImmersiveBlockAckMixin {} + public static class Rebuild extends ImmersiveSectionRebuildMixin {} + static void check(boolean pass,String message){if(!pass)throw new AssertionError(message);checks++;} + static void field(Object object,Class owner,String name,Object value)throws Exception{ + var field=owner.getDeclaredField(name);field.setAccessible(true);field.set(object,value); + } + static void invoke(Object object,Class owner,String name,Class[] types,Object...args)throws Exception{ + var method=owner.getDeclaredMethod(name,types);method.setAccessible(true);method.invoke(object,args); + } + static void ack(Ack hook,CallbackInfo callback)throws Exception{ + invoke(hook,ImmersiveBlockAckMixin.class,"rivencraft$ackDuringWorldReset", + new Class[]{ClientboundBlockChangedAckPacket.class,CallbackInfo.class},new ClientboundBlockChangedAckPacket(37),callback); + } + static void render(Rebuild hook,CallbackInfo callback)throws Exception{ + invoke(hook,ImmersiveSectionRebuildMixin.class,"rivencraft$discardUnavailableSections", + new Class[]{CameraRenderState.class,CallbackInfo.class},new CameraRenderState(),callback); + } + public static void main(String[] args)throws Exception{ + for(String engine:List.of("none","reborn","seamless")){ + ImmersiveBookPreviews.reborn=engine.equals("reborn");ImmersiveBookPreviews.seamless=engine.equals("seamless"); + Object fork=null;Method redirect=null; + if(!engine.equals("none")){ + var type=Class.forName(engine.equals("reborn")?"ForkAckReborn":"ForkAckSeamless"); + fork=type.getConstructor().newInstance();redirect=type.getMethod("handle",ClientLevel.class,int.class); + ClientWorldLoader.initialized=false; + try{redirect.invoke(fork,new ClientLevel(),37);throw new AssertionError("Original redirect unexpectedly safe");} + catch(InvocationTargetException error){check(error.getCause() instanceof IllegalArgumentException,"Original "+engine+" precondition reproduced");} + } + for(boolean initialized:List.of(false,true)){ + ClientWorldLoader.initialized=initialized;ClientWorldLoader.worlds.clear();ClientWorldLoader.reads=0;Minecraft.sameThread=true; + var local=new ClientLevel();var remote=new ClientLevel();ClientWorldLoader.worlds.addAll(List.of(local,remote)); + var hook=new Ack();field(hook,ImmersiveBlockAckMixin.class,"level",local); + var callback=new CallbackInfo("ack",true);ack(hook,callback); + boolean fallback=!engine.equals("none")&&!initialized; + check(callback.isCancelled()==fallback,"Cancellation scope "+engine+initialized); + if(!callback.isCancelled()){ + if(engine.equals("none"))local.handleBlockChangedAck(37);else redirect.invoke(fork,local,37); + } + check(local.acks.equals(List.of(37)),"Exactly one local ack "+engine+initialized); + check(remote.acks.equals(!engine.equals("none")&&initialized?List.of(37):List.of()),"Warm-map multiworld delivery retained"); + local.acks.clear();remote.acks.clear();ClientWorldLoader.reads=0;Minecraft.sameThread=false; + callback=new CallbackInfo("ack",true);ack(hook,callback); + check(!callback.isCancelled()&&local.acks.isEmpty()&&remote.acks.isEmpty()&&ClientWorldLoader.reads==0,"Network-thread scheduling untouched"); + } + Minecraft.sameThread=true;ClientWorldLoader.initialized=false; + var hook=new Ack();field(hook,ImmersiveBlockAckMixin.class,"level",null); + var callback=new CallbackInfo("ack",true);ack(hook,callback); + check(callback.isCancelled()!=engine.equals("none"),"Missing packet world handled only for installed fork"); + + var area=new ViewArea();var first=new net.minecraft.client.renderer.chunk.SectionRenderDispatcher().new RenderSection();var second=new net.minecraft.client.renderer.chunk.SectionRenderDispatcher().new RenderSection(); + area.sections.put(1L,first);area.sections.put(2L,second); + var state=new LevelRenderState();Object region=new Object();List extras=List.of(new Object()); + var a=new SectionUpdateRenderState(1,true,region,extras); + var stale=new SectionUpdateRenderState(9,false,new Object(),List.of()); + var b=new SectionUpdateRenderState(2,false,new Object(),List.of()); + state.sectionUpdateRenderStates.addAll(List.of(a,stale,b,a)); + var rebuild=new Rebuild();field(rebuild,ImmersiveSectionRebuildMixin.class,"viewArea",area); + field(rebuild,ImmersiveSectionRebuildMixin.class,"levelRenderState",state); + callback=new CallbackInfo("compile",true);render(rebuild,callback); + boolean active=!engine.equals("none"); + check(state.sectionUpdateRenderStates.equals(active?List.of(a,b,a):List.of(a,stale,b,a)),"Only absent sections removed "+engine); + check(state.sectionUpdateRenderStates.getFirst()==a&&a.region()==region&&a.additionalRenderers()==extras,"Valid identity/order/additional geometry preserved"); + check(first.dirty&&second.dirty&&!callback.isCancelled(),"Dirty state and render pipeline untouched"); + if(!active)check(area.reads==0,"No renderer workaround without optional engine"); + state.sectionUpdateRenderStates.clear();state.sectionUpdateRenderStates.add(stale);area.sections.put(9L,new net.minecraft.client.renderer.chunk.SectionRenderDispatcher().new RenderSection()); + render(rebuild,new CallbackInfo("compile",true)); + check(state.sectionUpdateRenderStates.equals(List.of(stale)),"Newly available section is not blacklisted"); + field(rebuild,ImmersiveSectionRebuildMixin.class,"viewArea",null); + render(rebuild,new CallbackInfo("compile",true)); + check(state.sectionUpdateRenderStates.equals(List.of(stale)),"Missing view area not mistaken for stale batch"); + field(rebuild,ImmersiveSectionRebuildMixin.class,"viewArea",area); + area.fail=true; + if(active){ + try{render(rebuild,new CallbackInfo("compile",true));throw new AssertionError("Unrelated exception swallowed");} + catch(InvocationTargetException error){check(error.getCause() instanceof IllegalStateException,"Unrelated renderer exception propagates");} + } + } + System.out.println("CLIENT118_GUARDS_PASS checks="+checks); + } +} +""" + +def main(): + homes = list((Path.home() / ".gradle/jdks").glob("*25*/bin/javac")) + if not homes: + homes = list((Path.home() / ".gradle/jdks").glob("*25*/*/bin/javac")) + if not homes: + raise SystemExit("JDK 25 not found in Gradle toolchains") + javac = homes[0] + java = javac.with_name("java") + cache = Path.home() / ".gradle/caches/modules-2/files-2.1" + asm = next((cache / "org.ow2.asm/asm/9.11").rglob("asm-*.jar")) + mixin = next((cache / "net.fabricmc/sponge-mixin").rglob("sponge-mixin-*.jar")) + production = ROOT / "ports/mc263/build/classes/java/main" + mods = Path.home() / ".local/share/PrismLauncher/instances/Dev 26.3/minecraft/mods" + forks = {"Reborn": next(mods.glob("immersive-portals-reborn*.jar*")), + "Seamless": next(mods.glob("seamlessportals*.jar"))} + with tempfile.TemporaryDirectory(prefix="rivencraft-client118-") as temporary: + work = Path(temporary) + classes = work / "classes" + classes.mkdir() + for name in ["client/ImmersivePredictionAcks", "client/ImmersiveSectionRebuilds", + "mixin/ImmersiveBlockAckMixin", "mixin/ImmersiveSectionRebuildMixin", "mixin/ViewAreaSectionAccessor"]: + relative = Path("net/dnorberg/rivencraft") / (name + ".class") + dest = classes / relative + dest.parent.mkdir(parents=True, exist_ok=True) + shutil.copy2(production / relative, dest) + sources = [] + for name, body in STUBS.items(): + package, _, simple = name.rpartition(".") + source = work / Path(name.replace(".", "/") + ".java") + source.parent.mkdir(parents=True, exist_ok=True) + source.write_text("package " + package + ";\n" + body + "\n") + sources.append(source) + for name, body in [("ExtractForkAck", EXTRACT), ("Client118Checks", CHECKS)]: + source = work / (name + ".java") + source.write_text(body) + sources.append(source) + classpath = ":".join(map(str, [classes, asm, mixin])) + subprocess.run([str(javac), "-proc:none", "-cp", classpath, "-d", str(classes), *map(str, sources)], check=True) + for name, jar in forks.items(): + subprocess.run([str(java), "-cp", classpath, "ExtractForkAck", str(jar), + "ForkAck" + name, str(classes / ("ForkAck" + name + ".class"))], check=True) + result = subprocess.run([str(java), "-cp", classpath, "Client118Checks"], check=True, capture_output=True, text=True) + output = ROOT / "build/verification/issue118/guards.txt" + output.write_text(result.stdout) + print(result.stdout.strip()) + print("No client/server/GPU/world started. Minecraft runtime types were isolated stubs; production guard bytecode and fork redirect bytecode were exercised.") + +if __name__ == "__main__": + main() diff --git a/scripts/regression_native119.py b/scripts/regression_native119.py new file mode 100644 index 0000000..471e061 --- /dev/null +++ b/scripts/regression_native119.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +"""Check Native fluid settings/codecs and the real vanilla fluid picker; no chunk generation.""" +import argparse +import subprocess +import tempfile +from pathlib import Path +from server_test_lock import server_test_lock +from smoke_server import stop + +ROOT = Path(__file__).resolve().parents[1] + +def run(target, biome_mods=False): + log = ROOT / f"build/verification/native119/{target}-{'bop' if biome_mods else 'vanilla'}.log" + log.parent.mkdir(parents=True, exist_ok=True) + with server_test_lock(), tempfile.TemporaryDirectory(prefix=f"rivencraft-native119-{target}-") as directory: + work = Path(directory) + init = work / "fixture.gradle" + init.write_text(""" +gradle.beforeProject { p -> + p.layout.buildDirectory.set(p.file('""" + str(work / "build") + """')) + p.afterEvaluate { + p.sourceSets.main.java.srcDir(p.file('""" + str(ROOT / "scripts/fixtures/native119" / target) + """')) + } +} +""") + if biome_mods: + game = "1.21.1" if target == "mc1211" else "26.3" + mods = Path.home() / ".local/share/PrismLauncher/instances" / ("Dev " + game) / "minecraft/mods" + jars = [next(mods.glob(pattern)) for pattern in ("BiomesOPlenty*.jar", "TerraBlender*.jar", "GlitchCore*.jar")] + init.write_text(init.read_text() + "\ngradle.projectsEvaluated { gradle.rootProject.dependencies.add('localRuntime', gradle.rootProject.files(" + + ",".join("'" + str(jar) + "'" for jar in jars) + ")) }\n") + server = work / "server" + server.mkdir() + (server / "eula.txt").write_text("eula=true\n") + (server / "server.properties").write_text( + "server-ip=127.0.0.1\nserver-port=0\nonline-mode=false\nwhite-list=false\n" + "level-type=minecraft:flat\nlevel-seed=109\nview-distance=2\nsimulation-distance=2\n" + 'generator-settings={"layers":[{"height":1,"block":"minecraft:bedrock"}],"biome":"minecraft:plains"}\n') + process = None + try: + args = [str(ROOT / "gradlew")] + if target == "mc263": args += ["-p", str(ROOT / "ports/mc263")] + args += ["--no-daemon", "-I", str(init), "runServer", f"-PserverRunDir={server}", "--console=plain"] + with log.open("w") as output: + process = subprocess.Popen(args, cwd=ROOT, stdin=subprocess.PIPE, stdout=output, + stderr=subprocess.STDOUT, text=True, start_new_session=True) + try: + process.wait(timeout=60) + except subprocess.TimeoutExpired: + print("HANDOFF: Native fluid probe stalled; stopping without retry. Use docs/NATIVE_FLUIDS.md.") + return 2 + text = log.read_text() + if process.returncode or "NATIVE119_PASS" not in text or "NATIVE119_FAIL" in text: + print(text[-8000:]) + return 1 + print(next(line for line in text.splitlines() if "NATIVE119_PASS" in line)) + return 0 + finally: + stop(process) + print("Removed temporary test world and isolated fixture outputs. Log:", log) + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("target", choices=("mc1211", "mc263")) + parser.add_argument("--biome-mods", action="store_true") + args=parser.parse_args() + raise SystemExit(run(args.target,args.biome_mods)) diff --git a/shared/src/main/java/net/dnorberg/rivencraft/shared/FlatBiomeMaterials.java b/shared/src/main/java/net/dnorberg/rivencraft/shared/FlatBiomeMaterials.java new file mode 100644 index 0000000..305c387 --- /dev/null +++ b/shared/src/main/java/net/dnorberg/rivencraft/shared/FlatBiomeMaterials.java @@ -0,0 +1,44 @@ +package net.dnorberg.rivencraft.shared; + +import net.minecraft.core.Holder; +import net.minecraft.tags.BiomeTags; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.biome.Biomes; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; + +/** Biome-aware replacement of Flat terrain's base layers, before authored features. */ +public final class FlatBiomeMaterials { + private FlatBiomeMaterials() {} + + public static boolean isEnd(Holder biome) { + return biome.is(BiomeTags.IS_END) || biome.is(Biomes.THE_END) || biome.is(Biomes.END_HIGHLANDS) + || biome.is(Biomes.END_MIDLANDS) || biome.is(Biomes.END_BARRENS) || biome.is(Biomes.SMALL_END_ISLANDS); + } + + public static boolean isNether(Holder biome, boolean regionNether) { + return regionNether || biome.is(BiomeTags.IS_NETHER) || biome.is(Biomes.NETHER_WASTES) + || biome.is(Biomes.CRIMSON_FOREST) || biome.is(Biomes.WARPED_FOREST) + || biome.is(Biomes.SOUL_SAND_VALLEY) || biome.is(Biomes.BASALT_DELTAS); + } + + public static boolean isBaseMaterial(BlockState state) { + return state.is(Blocks.GRASS_BLOCK) || state.is(Blocks.DIRT) || state.is(Blocks.STONE) + || state.is(Blocks.DEEPSLATE) || state.is(Blocks.TUFF); + } + + public static BlockState layer(BlockState state, Holder biome, boolean regionNether) { + if (!isBaseMaterial(state)) return state; + if (isNether(biome, regionNether)) { + boolean cap = state.is(Blocks.GRASS_BLOCK); + if (biome.is(Biomes.CRIMSON_FOREST) && cap) return Blocks.CRIMSON_NYLIUM.defaultBlockState(); + if (biome.is(Biomes.WARPED_FOREST) && cap) return Blocks.WARPED_NYLIUM.defaultBlockState(); + if (biome.is(Biomes.SOUL_SAND_VALLEY)) + return (cap ? Blocks.SOUL_SAND : Blocks.SOUL_SOIL).defaultBlockState(); + if (biome.is(Biomes.BASALT_DELTAS)) + return (cap ? Blocks.BASALT : Blocks.BLACKSTONE).defaultBlockState(); + return Blocks.NETHERRACK.defaultBlockState(); + } + return isEnd(biome) ? Blocks.END_STONE.defaultBlockState() : state; + } +} diff --git a/src/main/java/net/dnorberg/rivencraft/book/AgeDimensionService.java b/src/main/java/net/dnorberg/rivencraft/book/AgeDimensionService.java index 8b15502..eb660ba 100644 --- a/src/main/java/net/dnorberg/rivencraft/book/AgeDimensionService.java +++ b/src/main/java/net/dnorberg/rivencraft/book/AgeDimensionService.java @@ -1,5 +1,7 @@ package net.dnorberg.rivencraft.book; +import net.dnorberg.rivencraft.shared.NativeBiomeKind; + import dev.galacticraft.dynamicdimensions.api.DynamicDimensionRegistry; import dev.galacticraft.dynamicdimensions.api.PlayerRemover; import dev.galacticraft.dynamicdimensions.api.event.DimensionRemovedCallback; @@ -374,7 +376,8 @@ public final class AgeDimensionService { if (profile.terrain() == AgeRuntimeProfile.Terrain.FLAT) { var settings = flatSettings(server, profile); return age.generationVersion() < AgeDefinition.LEGACY_GENERATOR_CUTOFF - ? new FlatLevelSource(settings) : new AgeFlatChunkGenerator(biomeSource, settings, features, age.seed(), libraryAgeSymbols, AgeFlooding.requested(age.plan())); + ? new FlatLevelSource(settings) : new AgeFlatChunkGenerator(biomeSource, settings, features, age.seed(), libraryAgeSymbols, + AgeFlooding.requested(age.plan()), TerraBlenderBiomes.nether(server.registryAccess())); } if (profile.terrain() == AgeRuntimeProfile.Terrain.VOID) { FlatLevelGeneratorSettings settings = new FlatLevelGeneratorSettings( @@ -384,7 +387,8 @@ public final class AgeDimensionService { ); settings.updateLayers(); return age.generationVersion() < AgeDefinition.LEGACY_GENERATOR_CUTOFF - ? new FlatLevelSource(settings) : new AgeFlatChunkGenerator(biomeSource, settings, features, age.seed(), libraryAgeSymbols, AgeFlooding.requested(age.plan())); + ? new FlatLevelSource(settings) : new AgeFlatChunkGenerator(biomeSource, settings, features, age.seed(), libraryAgeSymbols, + AgeFlooding.requested(age.plan()), TerraBlenderBiomes.nether(server.registryAccess())); } var noiseSettings = server.registryAccess().lookupOrThrow(Registries.NOISE_SETTINGS); @@ -393,7 +397,13 @@ public final class AgeDimensionService { NoiseGeneratorSettings baseSettings = noiseSettings.getOrThrow(settingsKey).value(); Holder settings = Holder.direct(withBiomeMaterialRules(baseSettings)); boolean caveTerrain = AgeBiomeSelection.isCave(profile); - if (caveTerrain) settings = Holder.direct(dryCaveSettings(settings.value())); + AgeBiomeSelection selection = age.plan() != null && age.plan().biomeSelection() != null + ? age.plan().biomeSelection() : age.randomBiomes(); + var nativeKind = selection == null ? NativeBiomeKind.TERRAIN + : selection.nativeKind(); + if (caveTerrain && nativeKind != NativeBiomeKind.NETHER) + settings = Holder.direct(dryCaveSettings(settings.value())); + settings = Holder.direct(nativeFluidSettings(settings.value(), nativeKind)); return age.generationVersion() < AgeDefinition.LEGACY_GENERATOR_CUTOFF ? new NoiseBasedChunkGenerator(biomeSource, settings) : new AgeFeatureChunkGenerator(biomeSource, settings, features, age.seed(), @@ -440,6 +450,18 @@ public final class AgeDimensionService { base.oreVeinsEnabled(), base.useLegacyRandomSource()); } + /** Native family controls natural fluid only; authored Flooded/features run later. */ + static NoiseGeneratorSettings nativeFluidSettings(NoiseGeneratorSettings base, + NativeBiomeKind kind) { + if (kind != NativeBiomeKind.NETHER + && kind != NativeBiomeKind.END) return base; + boolean nether = kind == NativeBiomeKind.NETHER; + return new NoiseGeneratorSettings(base.noiseSettings(), base.defaultBlock(), + (nether ? Blocks.LAVA : Blocks.AIR).defaultBlockState(), base.noiseRouter(), + base.surfaceRule(), base.spawnTarget(), nether ? base.seaLevel() : base.noiseSettings().minY() - 1, + base.disableMobGeneration(), false, base.oreVeinsEnabled(), base.useLegacyRandomSource()); + } + private static NoiseGeneratorSettings withBiomeMaterialRules(NoiseGeneratorSettings base) { SurfaceRules.RuleSource biomeMaterials = SurfaceRules.sequence( SurfaceRules.ifTrue( @@ -499,7 +521,7 @@ public final class AgeDimensionService { age.traits(), profile, age.seed(), server.registryAccess(), age.randomPagePolicy()); var registry = server.registryAccess().lookupOrThrow(Registries.BIOME); List> biomes = new ArrayList<>(); - List fallbacks = selection.nativeKind() == net.dnorberg.rivencraft.shared.NativeBiomeKind.TERRAIN + List fallbacks = selection.nativeKind() == NativeBiomeKind.TERRAIN ? AgeBiomeSelection.eligible(server.registryAccess(), profile) : NativeBiomePools.pool(server.registryAccess(), selection.nativeKind()); Set present = new LinkedHashSet<>(); @@ -523,7 +545,7 @@ public final class AgeDimensionService { } AgeTraits.BiomeDistribution distribution = selection.distribution(); if (distribution == AgeTraits.BiomeDistribution.NATIVE - && selection.nativeKind() == net.dnorberg.rivencraft.shared.NativeBiomeKind.TERRAIN + && selection.nativeKind() == NativeBiomeKind.TERRAIN && !AgeBiomeSelection.isCave(profile) && profile.terrain() == AgeRuntimeProfile.Terrain.NOISE) { var parameters = server.registryAccess() diff --git a/src/main/java/net/dnorberg/rivencraft/book/AgeEnvironmentCompiler.java b/src/main/java/net/dnorberg/rivencraft/book/AgeEnvironmentCompiler.java index 152ae61..bb64ffb 100644 --- a/src/main/java/net/dnorberg/rivencraft/book/AgeEnvironmentCompiler.java +++ b/src/main/java/net/dnorberg/rivencraft/book/AgeEnvironmentCompiler.java @@ -97,7 +97,11 @@ public final class AgeEnvironmentCompiler { case "nether" -> BuiltinDimensionTypes.NETHER_EFFECTS; case "end" -> BuiltinDimensionTypes.END_EFFECTS; default -> throw new IllegalArgumentException("Unsupported sky effect " + choice); - }).findFirst().orElse(fallback); + }).findFirst().orElseGet(() -> switch (AgeSkyProfile.defaultStyle(plan)) { + case NETHER -> BuiltinDimensionTypes.NETHER_EFFECTS; + case END -> BuiltinDimensionTypes.END_EFFECTS; + default -> fallback; + }); } public static boolean staticSky(AgeGenerationPlan plan) { diff --git a/src/main/java/net/dnorberg/rivencraft/book/AgeSkyProfile.java b/src/main/java/net/dnorberg/rivencraft/book/AgeSkyProfile.java index b0482dc..8d9f77f 100644 --- a/src/main/java/net/dnorberg/rivencraft/book/AgeSkyProfile.java +++ b/src/main/java/net/dnorberg/rivencraft/book/AgeSkyProfile.java @@ -67,9 +67,19 @@ public record AgeSkyProfile(Style style, int color, List bodies, int stati "sky/" + (style == Style.INHERITED ? "inherited" : style.name().toLowerCase(java.util.Locale.ROOT))); } + /** Family default only; the ordered SKY branch still overrides it. */ + public static Style defaultStyle(AgeGenerationPlan plan) { + if (plan == null || plan.biomeSelection() == null) return Style.INHERITED; + return switch (plan.biomeSelection().nativeKind()) { + case NETHER -> Style.NETHER; + case END -> Style.END; + default -> Style.INHERITED; + }; + } + public static AgeSkyProfile compile(AgeGenerationPlan plan, AgeTraits traits) { if (plan == null) return new AgeSkyProfile(Style.INHERITED, -1, List.of()); - Style style = Style.INHERITED; + Style style = defaultStyle(plan); int color = authoredSkyColor(plan); boolean customBodies = hasCustomCelestials(plan); List bodies = new ArrayList<>(); diff --git a/src/main/java/net/dnorberg/rivencraft/world/AgeFlatChunkGenerator.java b/src/main/java/net/dnorberg/rivencraft/world/AgeFlatChunkGenerator.java index fab7704..80eceea 100644 --- a/src/main/java/net/dnorberg/rivencraft/world/AgeFlatChunkGenerator.java +++ b/src/main/java/net/dnorberg/rivencraft/world/AgeFlatChunkGenerator.java @@ -3,6 +3,7 @@ package net.dnorberg.rivencraft.world; import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import net.dnorberg.rivencraft.book.AgeFlooding; +import net.dnorberg.rivencraft.shared.FlatBiomeMaterials; import net.dnorberg.rivencraft.shared.FloodingRules; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.HashMap; @@ -48,7 +49,9 @@ public final class AgeFlatChunkGenerator extends ChunkGenerator { ResourceLocation.CODEC.listOf().optionalFieldOf("library_age_symbols", List.of()) .forGetter(generator -> generator.libraryAgeSymbols), Codec.INT.optionalFieldOf("flood_surface", FloodingRules.NONE) - .forGetter(generator -> generator.floodSurface)) + .forGetter(generator -> generator.floodSurface), + ResourceLocation.CODEC.listOf().optionalFieldOf("nether_biomes", List.of()) + .forGetter(generator -> generator.netherBiomeIds)) .apply(instance, AgeFlatChunkGenerator::new)); private final FlatLevelGeneratorSettings settings; @@ -56,6 +59,8 @@ public final class AgeFlatChunkGenerator extends ChunkGenerator { private final long ageSeed; private final List libraryAgeSymbols; private final int floodSurface; + private final List netherBiomeIds; + private final java.util.Set netherBiomes; public AgeFlatChunkGenerator(BiomeSource biomeSource, FlatLevelGeneratorSettings settings) { this(biomeSource, settings, List.of(), 0L); @@ -75,12 +80,21 @@ public final class AgeFlatChunkGenerator extends ChunkGenerator { public AgeFlatChunkGenerator(BiomeSource biomeSource, FlatLevelGeneratorSettings settings, List features, long ageSeed, List libraryAgeSymbols, int floodSurface) { + this(biomeSource, settings, features, ageSeed, libraryAgeSymbols, floodSurface, List.of()); + } + + public AgeFlatChunkGenerator(BiomeSource biomeSource, FlatLevelGeneratorSettings settings, + List features, long ageSeed, + List libraryAgeSymbols, int floodSurface, + List netherBiomeIds) { super(biomeSource, Util.memoize(settings::adjustGenerationSettings)); this.settings = settings; this.features = List.copyOf(features); this.ageSeed = ageSeed; this.libraryAgeSymbols = List.copyOf(libraryAgeSymbols); this.floodSurface = floodSurface; + this.netherBiomeIds = List.copyOf(netherBiomeIds); + this.netherBiomes = java.util.Set.copyOf(netherBiomeIds); } public FlatLevelGeneratorSettings settings() { return settings; } @@ -121,9 +135,11 @@ public final class AgeFlatChunkGenerator extends ChunkGenerator { int y = chunk.getMinBuildHeight() + i; for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { - chunk.setBlockState(position.set(x, y, z), state, false); - floor.update(x, y, z, state); - surface.update(x, y, z, state); + BlockState actual = layerState(state, chunk.getPos().getMinBlockX() + x, y, + chunk.getPos().getMinBlockZ() + z, random); + chunk.setBlockState(position.set(x, y, z), actual, false); + floor.update(x, y, z, actual); + surface.update(x, y, z, actual); } } } @@ -177,11 +193,21 @@ public final class AgeFlatChunkGenerator extends ChunkGenerator { @Override public NoiseColumn getBaseColumn(int x, int z, LevelHeightAccessor level, RandomState random) { - return new NoiseColumn(level.getMinBuildHeight(), settings.getLayers().stream() - .limit(level.getHeight()).map(state -> state == null ? Blocks.AIR.defaultBlockState() : state) + var layers = settings.getLayers(); + return new NoiseColumn(level.getMinBuildHeight(), java.util.stream.IntStream.range(0, Math.min(level.getHeight(), layers.size())) + .mapToObj(i -> layerState(layers.get(i), x, level.getMinBuildHeight() + i, z, random)) .toArray(BlockState[]::new)); } + private BlockState layerState(BlockState state, int x, int y, int z, RandomState random) { + if (state == null) return Blocks.AIR.defaultBlockState(); + if (!FlatBiomeMaterials.isBaseMaterial(state)) return state; + var biome = biomeSource.getNoiseBiome(net.minecraft.core.QuartPos.fromBlock(x), + net.minecraft.core.QuartPos.fromBlock(y), net.minecraft.core.QuartPos.fromBlock(z), random.sampler()); + boolean regionNether = biome.unwrapKey().map(key -> netherBiomes.contains(key.location())).orElse(false); + return FlatBiomeMaterials.layer(state, biome, regionNether); + } + @Override public void addDebugScreenInfo(List info, RandomState random, BlockPos position) { } @Override public void applyCarvers(WorldGenRegion level, long seed, RandomState random, BiomeManager biomes, StructureManager structures, ChunkAccess chunk, GenerationStep.Carving step) { } diff --git a/src/main/resources/assets/rivencraft/lang/en_us.json b/src/main/resources/assets/rivencraft/lang/en_us.json index 7bffc52..53005d8 100644 --- a/src/main/resources/assets/rivencraft/lang/en_us.json +++ b/src/main/resources/assets/rivencraft/lang/en_us.json @@ -479,7 +479,7 @@ "symbol.rivencraft.biome.native_caves": "Native Caves", "symbol.rivencraft.biome.native_caves.description": "Use recognized non-Nether cave biomes in seeded regions on any terrain. Native controllers choose their own pool; individual biome pages are not used.", "symbol.rivencraft.biome.native_nether": "Native Nether", - "symbol.rivencraft.biome.native_nether.description": "Use recognized Nether biomes, including TerraBlender Nether regions, on any terrain. Native controllers choose their own pool; individual biome pages are not used.", + "symbol.rivencraft.biome.native_nether.description": "Use recognized Nether biomes, including TerraBlender Nether regions, on any terrain. Native controllers choose their own pool; individual biome pages are not used. Natural terrain fluids use lava instead of water; authored Flooded and fluid features remain separate. Defaults to the Nether sky unless a Sky Page overrides it.", "symbol.rivencraft.biome.native_end": "Native End", - "symbol.rivencraft.biome.native_end.description": "Use recognized End biomes in seeded regions on any terrain. Native controllers choose their own pool; individual biome pages are not used." + "symbol.rivencraft.biome.native_end.description": "Use recognized End biomes in seeded regions on any terrain. Native controllers choose their own pool; individual biome pages are not used. Natural terrain has no water; authored Flooded and fluid features remain separate. Defaults to the End sky unless a Sky Page overrides it." }