diff --git a/docs/PORTING.md b/docs/PORTING.md index f6b5f36..f22ecb0 100644 --- a/docs/PORTING.md +++ b/docs/PORTING.md @@ -269,6 +269,13 @@ symbol fallbacks: period 0.2–2.0, angle 0–360 degrees, and phase 0–1. Exis Ages load with normal Legacy defaults instead of being rerolled. This immutable trait layer is the foundation for applying each choice to modern worldgen. +Version 0.2.18.0 applies each Age's persisted lighting trait to its runtime +dimension. Normal Lighting retains Overworld skylight and ambient brightness; +Bright Lighting uses Legacy's 0.25 ambient-light floor; Dark Lighting disables +dimension skylight while retaining local block light. The latter is the closest +server-safe modern equivalent to Legacy's removed per-dimension light-table +scaling hook. + 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 3046453..ff3c396 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.17.0 +mod_version=0.2.18.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 fcd1e65..b95f3b8 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 = 3; + public static final int CURRENT_GENERATION_VERSION = 4; 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 2e16421..00427d5 100644 --- a/src/main/java/net/dnorberg/rivencraft/book/AgeDimensionService.java +++ b/src/main/java/net/dnorberg/rivencraft/book/AgeDimensionService.java @@ -48,7 +48,7 @@ public final class AgeDimensionService { loader.loadDynamicDimension( age.dimensionId(), createGenerator(server, age), - createDimensionType() + createDimensionType(age) ); } synchronizeImmersivePortals(server); @@ -85,7 +85,7 @@ public final class AgeDimensionService { ServerLevel loaded = DynamicDimensionRegistry.from(server).loadDynamicDimension( definition.dimensionId(), createGenerator(server, definition), - createDimensionType() + createDimensionType(definition) ); if (loaded == null) { Rivencraft.LOGGER.error("Failed to load Age {} as {}", definition.id(), definition.dimensionId()); @@ -231,10 +231,13 @@ public final class AgeDimensionService { ); } - private static DimensionType createDimensionType() { + private static DimensionType createDimensionType(AgeDefinition age) { + AgeTraits.Lighting lighting = age.traits().lighting(); + boolean hasSkyLight = lighting != AgeTraits.Lighting.DARK; + float ambientLight = lighting == AgeTraits.Lighting.BRIGHT ? 0.25F : 0.0F; return new DimensionType( OptionalLong.empty(), - true, + hasSkyLight, false, false, true, @@ -246,7 +249,7 @@ public final class AgeDimensionService { 384, BlockTags.INFINIBURN_OVERWORLD, BuiltinDimensionTypes.OVERWORLD_EFFECTS, - 0.0F, + ambientLight, new DimensionType.MonsterSettings(false, true, UniformInt.of(0, 7), 0) ); } diff --git a/src/main/java/net/dnorberg/rivencraft/gametest/LinkingGameTests.java b/src/main/java/net/dnorberg/rivencraft/gametest/LinkingGameTests.java index e2d38d4..f03c3e7 100644 --- a/src/main/java/net/dnorberg/rivencraft/gametest/LinkingGameTests.java +++ b/src/main/java/net/dnorberg/rivencraft/gametest/LinkingGameTests.java @@ -175,6 +175,17 @@ public final class LinkingGameTests { helper.assertTrue(level.dimension().location().equals(definition.dimensionId()), "The " + profile + " profile must retain its assigned dimension id"); + if (definition.traits().lighting() == AgeTraits.Lighting.DARK) { + helper.assertFalse(level.dimensionType().hasSkyLight(), + "Dark Lighting Ages must suppress dimension skylight"); + } else { + helper.assertTrue(level.dimensionType().hasSkyLight(), + "Normal and Bright Lighting Ages must retain dimension skylight"); + } + float expectedAmbientLight = definition.traits().lighting() == AgeTraits.Lighting.BRIGHT + ? 0.25F : 0.0F; + helper.assertTrue(Math.abs(level.dimensionType().ambientLight() - expectedAmbientLight) < 0.0001F, + "The runtime dimension must apply the persisted lighting trait"); } helper.succeed(); }