From 5336eb46b90d9087fd85992cf873ee45b5e9dcb5 Mon Sep 17 00:00:00 2001 From: Dustin Norberg Date: Tue, 22 Sep 2026 22:08:00 -0400 Subject: [PATCH] Complete scaled biome distributions --- docs/PORTING.md | 5 ++ gradle.properties | 2 +- .../rivencraft/book/AgeDefinition.java | 2 +- .../rivencraft/book/AgeDimensionService.java | 17 +++++-- .../rivencraft/gametest/LinkingGameTests.java | 49 +++++++++++++++++++ .../rivencraft/world/ScaledBiomeSource.java | 4 ++ 6 files changed, 74 insertions(+), 5 deletions(-) diff --git a/docs/PORTING.md b/docs/PORTING.md index 82f2d60..8886022 100644 --- a/docs/PORTING.md +++ b/docs/PORTING.md @@ -345,6 +345,11 @@ Age-seeded biomes and softly bounded seeded regions. Tiny begins at Legacy's smallest 16-block nominal scale; the serializable biome source retains its seed, selected biomes, and scale across Age reloads. +Version 0.2.25.0 completes the scaled biome distributions. Small, Medium, +Large, and Huge reuse Tiny's seeded, softly bounded regions at nominal widths +of 32, 64, 128, and 256 blocks. Every size selects three deterministic biomes +and serializes the selection, Age seed, and scale with the runtime dimension. + Version 0.2.14.0 restores the legacy Linking and Descriptive Book artwork for inventory items and gives each book its matching open-book texture when placed on a Book Stand. Return Linking Books created inside another Age also retain and diff --git a/gradle.properties b/gradle.properties index e3315a5..d76ee2a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -35,7 +35,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 # The mod version. Rivencraft uses the x.y.z.b policy documented in README.md. -mod_version=0.2.24.0 +mod_version=0.2.25.0 immersive_portals_version=6.0.7 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. diff --git a/src/main/java/net/dnorberg/rivencraft/book/AgeDefinition.java b/src/main/java/net/dnorberg/rivencraft/book/AgeDefinition.java index 3771b38..015375c 100644 --- a/src/main/java/net/dnorberg/rivencraft/book/AgeDefinition.java +++ b/src/main/java/net/dnorberg/rivencraft/book/AgeDefinition.java @@ -21,7 +21,7 @@ public record AgeDefinition( public static final ResourceLocation RANDOM_VANILLA_PROFILE = ResourceLocation.fromNamespaceAndPath( Rivencraft.MOD_ID, "random_vanilla" ); - public static final int CURRENT_GENERATION_VERSION = 12; + public static final int CURRENT_GENERATION_VERSION = 13; public AgeDefinition { Objects.requireNonNull(id, "id"); diff --git a/src/main/java/net/dnorberg/rivencraft/book/AgeDimensionService.java b/src/main/java/net/dnorberg/rivencraft/book/AgeDimensionService.java index 6dcb794..a902f45 100644 --- a/src/main/java/net/dnorberg/rivencraft/book/AgeDimensionService.java +++ b/src/main/java/net/dnorberg/rivencraft/book/AgeDimensionService.java @@ -308,13 +308,24 @@ public final class AgeDimensionService { : TILED_BIOME_SCALE ); } - if (distribution == AgeTraits.BiomeDistribution.TINY && biomes.size() >= 3) { + int scaledBiomeScale = switch (distribution) { + case TINY -> 0; + case SMALL -> 1; + case MEDIUM -> 2; + case LARGE -> 3; + case HUGE -> 4; + default -> -1; + }; + if (scaledBiomeScale >= 0 && biomes.size() >= 3) { List> selected = new java.util.ArrayList<>(biomes); - Collections.shuffle(selected, new java.util.Random(age.seed() ^ 0x54494E5942494F4DL)); + long salt = distribution == AgeTraits.BiomeDistribution.TINY + ? 0x54494E5942494F4DL + : 0x5343414C45444249L; + Collections.shuffle(selected, new java.util.Random(age.seed() ^ salt)); return new ScaledBiomeSource( HolderSet.direct(List.of(selected.get(0), selected.get(1), selected.get(2))), age.seed(), - 0 + scaledBiomeScale ); } return MultiNoiseBiomeSource.createFromPreset( diff --git a/src/main/java/net/dnorberg/rivencraft/gametest/LinkingGameTests.java b/src/main/java/net/dnorberg/rivencraft/gametest/LinkingGameTests.java index a7fddfd..87d5df5 100644 --- a/src/main/java/net/dnorberg/rivencraft/gametest/LinkingGameTests.java +++ b/src/main/java/net/dnorberg/rivencraft/gametest/LinkingGameTests.java @@ -298,6 +298,55 @@ public final class LinkingGameTests { "The runtime dimension must apply the persisted celestial period"); } } + + AgeTraits.BiomeDistribution[] remainingScaledDistributions = { + AgeTraits.BiomeDistribution.SMALL, + AgeTraits.BiomeDistribution.MEDIUM, + AgeTraits.BiomeDistribution.LARGE, + AgeTraits.BiomeDistribution.HUGE + }; + for (int scale = 1; scale <= remainingScaledDistributions.length; scale++) { + AgeTraits.BiomeDistribution distribution = remainingScaledDistributions[scale - 1]; + UUID id = UUID.randomUUID(); + AgeDefinition definition = new AgeDefinition( + id, + "Scaled " + distribution, + id.getMostSignificantBits(), + AgeGenerationProfiles.STANDARD, + AgeDefinition.CURRENT_GENERATION_VERSION, + helper.getLevel().getGameTime(), + net.minecraft.resources.ResourceLocation.fromNamespaceAndPath( + Rivencraft.MOD_ID, "gametest/scaled_" + distribution.name().toLowerCase() + "_" + id + ), + null, + new AgeTraits( + distribution, + AgeTraits.Lighting.NORMAL, + AgeTraits.Weather.NORMAL, + 1.0D, + 0.0F, + 0.0F + ) + ); + var level = AgeDimensionService.ensureLoaded(helper.getLevel().getServer(), definition); + helper.assertTrue(level != null, distribution + " Biome Distribution must load a runtime dimension"); + if (level == null) { + continue; + } + var biomeSource = level.getChunkSource().getGenerator().getBiomeSource(); + helper.assertTrue(biomeSource instanceof net.dnorberg.rivencraft.world.ScaledBiomeSource, + distribution + " Biome Distribution must use the serializable scaled biome source"); + helper.assertValueEqual( + biomeSource.possibleBiomes().size(), + 3, + distribution + " Biome Distribution must expose exactly three seeded biomes" + ); + helper.assertValueEqual( + ((net.dnorberg.rivencraft.world.ScaledBiomeSource)biomeSource).scale(), + scale, + distribution + " Biome Distribution must use its Legacy scale" + ); + } helper.succeed(); } diff --git a/src/main/java/net/dnorberg/rivencraft/world/ScaledBiomeSource.java b/src/main/java/net/dnorberg/rivencraft/world/ScaledBiomeSource.java index 1b73b8d..97d4a2c 100644 --- a/src/main/java/net/dnorberg/rivencraft/world/ScaledBiomeSource.java +++ b/src/main/java/net/dnorberg/rivencraft/world/ScaledBiomeSource.java @@ -36,6 +36,10 @@ public final class ScaledBiomeSource extends BiomeSource { this.cellWidth = 4 << scale; } + public int scale() { + return scale; + } + @Override protected MapCodec codec() { return CODEC;