Apply persisted Age lighting traits
Build / build (push) Canceled after 0s

This commit is contained in:
dnorberg committed 2026-09-22 16:18:21 -04:00
1 parent 73dec80ae6
commit 31ba6f9c15
5 files changed
+28 -7

No files matched your search

+7
View File
@@ -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 Ages load with normal Legacy defaults instead of being rerolled. This immutable
trait layer is the foundation for applying each choice to modern worldgen. 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 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 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 on a Book Stand. Return Linking Books created inside another Age also retain and
+1 -1
View File
@@ -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. # 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 mod_license=LGPL-3.0-or-later
# The mod version. Rivencraft uses the x.y.z.b policy documented in README.md. # 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 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. # 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. # This should match the base package used for the mod sources.
@@ -21,7 +21,7 @@ public record AgeDefinition(
public static final ResourceLocation RANDOM_VANILLA_PROFILE = ResourceLocation.fromNamespaceAndPath( public static final ResourceLocation RANDOM_VANILLA_PROFILE = ResourceLocation.fromNamespaceAndPath(
Rivencraft.MOD_ID, "random_vanilla" Rivencraft.MOD_ID, "random_vanilla"
); );
public static final int CURRENT_GENERATION_VERSION = 3; public static final int CURRENT_GENERATION_VERSION = 4;
public AgeDefinition { public AgeDefinition {
Objects.requireNonNull(id, "id"); Objects.requireNonNull(id, "id");
@@ -48,7 +48,7 @@ public final class AgeDimensionService {
loader.loadDynamicDimension( loader.loadDynamicDimension(
age.dimensionId(), age.dimensionId(),
createGenerator(server, age), createGenerator(server, age),
createDimensionType() createDimensionType(age)
); );
} }
synchronizeImmersivePortals(server); synchronizeImmersivePortals(server);
@@ -85,7 +85,7 @@ public final class AgeDimensionService {
ServerLevel loaded = DynamicDimensionRegistry.from(server).loadDynamicDimension( ServerLevel loaded = DynamicDimensionRegistry.from(server).loadDynamicDimension(
definition.dimensionId(), definition.dimensionId(),
createGenerator(server, definition), createGenerator(server, definition),
createDimensionType() createDimensionType(definition)
); );
if (loaded == null) { if (loaded == null) {
Rivencraft.LOGGER.error("Failed to load Age {} as {}", definition.id(), definition.dimensionId()); 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( return new DimensionType(
OptionalLong.empty(), OptionalLong.empty(),
true, hasSkyLight,
false, false,
false, false,
true, true,
@@ -246,7 +249,7 @@ public final class AgeDimensionService {
384, 384,
BlockTags.INFINIBURN_OVERWORLD, BlockTags.INFINIBURN_OVERWORLD,
BuiltinDimensionTypes.OVERWORLD_EFFECTS, BuiltinDimensionTypes.OVERWORLD_EFFECTS,
0.0F, ambientLight,
new DimensionType.MonsterSettings(false, true, UniformInt.of(0, 7), 0) new DimensionType.MonsterSettings(false, true, UniformInt.of(0, 7), 0)
); );
} }
@@ -175,6 +175,17 @@ public final class LinkingGameTests {
helper.assertTrue(level.dimension().location().equals(definition.dimensionId()), helper.assertTrue(level.dimension().location().equals(definition.dimensionId()),
"The " + profile + " profile must retain its assigned dimension id"); "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(); helper.succeed();
} }