Public Access
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7b2c24915 |
No files matched your search
+1
-1
@@ -17,7 +17,7 @@ tasks.named('wrapper', Wrapper).configure {
|
|||||||
version = mod_version
|
version = mod_version
|
||||||
group = mod_group_id
|
group = mod_group_id
|
||||||
|
|
||||||
List<String> archivedGameTestSuites = ['linking', 'writing', 'grammar', 'desk', 'binder', 'mixer', 'recipe']
|
List<String> archivedGameTestSuites = ['linking', 'environment', 'writing', 'grammar', 'desk', 'binder', 'mixer', 'recipe']
|
||||||
List<String> selectedArchivedGameTestSuites = providers.gradleProperty('withArchivedGameTests')
|
List<String> selectedArchivedGameTestSuites = providers.gradleProperty('withArchivedGameTests')
|
||||||
.map { it.toBoolean() }.orElse(false).get() ? archivedGameTestSuites
|
.map { it.toBoolean() }.orElse(false).get() ? archivedGameTestSuites
|
||||||
: providers.gradleProperty('archivedGameTestSuites').orElse('').get()
|
: providers.gradleProperty('archivedGameTestSuites').orElse('').get()
|
||||||
|
|||||||
+27
-3
@@ -47,9 +47,11 @@ in the Binder. Bundled controls are Native, Single, Tiled, Grid, and Tiny throug
|
|||||||
Huge regions. Single needs one distinct biome; Tiled/Grid and Tiny–Huge need
|
Huge regions. Single needs one distinct biome; Tiled/Grid and Tiny–Huge need
|
||||||
two. An authored book receives seeded filler only when it falls below that
|
two. An authored book receives seeded filler only when it falls below that
|
||||||
minimum, while extra authored pages are retained as weighted entries. A book
|
minimum, while extra authored pages are retained as weighted entries. A book
|
||||||
with no biome pages selects a seeded count from 2–4 for Tiled/Grid or 2–6 for
|
with no biome pages selects a seeded count from two up to the number of
|
||||||
Tiny–Huge, capped by the number of eligible terrain biomes. Single uses one;
|
eligible biomes for Tiled/Grid and Tiny–Huge. The eligible pool comes from the
|
||||||
Native uses its preset biome pool. These random-age maximums do not truncate
|
terrain's biome preset, or `#rivencraft:cave_biomes` for Cave terrain, so future
|
||||||
|
biome integrations can expand it without changing the count rule. Single uses
|
||||||
|
one; Native uses its preset biome pool. This random-age maximum does not truncate
|
||||||
authored pages: the Binder's 27 symbol-page positions bound an authored book.
|
authored pages: the Binder's 27 symbol-page positions bound an authored book.
|
||||||
Native cannot be paired with explicit biome pages. Legacy filled Tiny–Huge to
|
Native cannot be paired with explicit biome pages. Legacy filled Tiny–Huge to
|
||||||
three; Rivencraft deliberately uses two so a pair of written biome pages stays
|
three; Rivencraft deliberately uses two so a pair of written biome pages stays
|
||||||
@@ -79,6 +81,28 @@ eligible fallback for that load; restoring the biome recovers the original
|
|||||||
selection. Generation-version-15 Ages keep their prior registry-wide biome
|
selection. Generation-version-15 Ages keep their prior registry-wide biome
|
||||||
selection algorithm instead of being silently regenerated.
|
selection algorithm instead of being silently regenerated.
|
||||||
|
|
||||||
|
## Written environment
|
||||||
|
|
||||||
|
Lighting pages select Normal, Dark, or Bright lighting for the new Age. A Sky
|
||||||
|
page selects Minecraft's Overworld, Nether, or End sky effects; the chosen
|
||||||
|
effects also determine the destination preview backdrop. Overworld sky tint
|
||||||
|
continues to come from the destination biome. A written sky changes only that
|
||||||
|
Age's dimension type, not the source world or other Ages.
|
||||||
|
|
||||||
|
Normal, Fast, Slow, Off, Always, and Storm weather pages use the existing Age
|
||||||
|
weather controller. Zero, Half, Full, and Double Length pages set the day-cycle
|
||||||
|
period, and Nadir, Rising, Zenith, and Setting pages set its initial phase.
|
||||||
|
Repeated numeric modifiers combine in written order. A Zero Length Age keeps
|
||||||
|
the nonzero minimum clock rate that avoids client skybox bounce. Pages for
|
||||||
|
Cloudy, forced Rain, and Snow are not offered: vanilla precipitation rendering
|
||||||
|
cannot reproduce those Legacy distinctions yet, and Snow remains planned for
|
||||||
|
the optional season integrations. A data pack that supplies these unsupported
|
||||||
|
weather choices receives a binding error rather than a false success.
|
||||||
|
|
||||||
|
The Pages creative tab and optional JEI page ingredients use the same generated
|
||||||
|
index of bundled environment symbols. Existing Age definitions and page-free
|
||||||
|
random Ages retain their saved or seeded environment unchanged.
|
||||||
|
|
||||||
## Persistence and reload behavior
|
## Persistence and reload behavior
|
||||||
|
|
||||||
An Age permanently stores its selected profile ID, generation version, seed,
|
An Age permanently stores its selected profile ID, generation version, seed,
|
||||||
|
|||||||
+3
-3
@@ -8,7 +8,7 @@ data migration, workstation transactions, and forged/replayed menu actions.
|
|||||||
./gradlew runGameTestServer
|
./gradlew runGameTestServer
|
||||||
```
|
```
|
||||||
|
|
||||||
The remaining 56 Rivencraft tests are archived, not deleted. They cover
|
The remaining 58 Rivencraft tests are archived, not deleted. They cover
|
||||||
completed milestone details such as every Age terrain profile, Notebook and
|
completed milestone details such as every Age terrain profile, Notebook and
|
||||||
Desk surface interactions, refill edge cases, book assembly controls, and
|
Desk surface interactions, refill edge cases, book assembly controls, and
|
||||||
workstation break/drop behavior. Run only the relevant archive alongside the
|
workstation break/drop behavior. Run only the relevant archive alongside the
|
||||||
@@ -19,8 +19,8 @@ core tests when investigating an issue:
|
|||||||
./gradlew runGameTestServer -ParchivedGameTestSuites=grammar,binder
|
./gradlew runGameTestServer -ParchivedGameTestSuites=grammar,binder
|
||||||
```
|
```
|
||||||
|
|
||||||
Available suite names are `linking`, `writing`, `grammar`, `desk`, `binder`, `mixer`, and
|
Available suite names are `linking`, `environment`, `writing`, `grammar`, `desk`,
|
||||||
`recipe`. Run all 79 Rivencraft tests before a
|
`binder`, `mixer`, and `recipe`. Run all 81 Rivencraft tests before a
|
||||||
release or after broad cross-system changes:
|
release or after broad cross-system changes:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|||||||
@@ -34,10 +34,9 @@ Invalid definitions are logged and excluded by the server. Menus and future
|
|||||||
page synchronization must obtain resolved display metadata from the server;
|
page synchronization must obtain resolved display metadata from the server;
|
||||||
clients never make a symbol valid by naming it.
|
clients never make a symbol valid by naming it.
|
||||||
|
|
||||||
Rivencraft ships a small catalog covering terrain, biomes, lighting, weather,
|
Rivencraft ships a catalog covering terrain, biomes, lighting, weather,
|
||||||
celestial behavior, and features. Its v2 semantics prepare for the full
|
sky, celestial behavior, and features. The parser and compiler apply supported
|
||||||
Legacy-inspired grammar; writing still uses random Age fallback until the
|
schema-v2 pages to newly created Ages; omitted branches retain seeded defaults.
|
||||||
parser and compiler are implemented.
|
|
||||||
|
|
||||||
## Persistent writing
|
## Persistent writing
|
||||||
|
|
||||||
@@ -54,9 +53,7 @@ book copies its writing and Age reference; merely copying it never creates a
|
|||||||
new Age. The Book Binder creates the Age when its finished output is taken.
|
new Age. The Book Binder creates the Age when its finished output is taken.
|
||||||
The Descriptive Book screen can inspect the ordered pages by turning them from
|
The Descriptive Book screen can inspect the ordered pages by turning them from
|
||||||
the bottom corners and identifies unresolved IDs using server-provided symbol
|
the bottom corners and identifies unresolved IDs using server-provided symbol
|
||||||
metadata. Until Milestone 5, the
|
metadata. Page-free books continue to use random Age generation.
|
||||||
saved symbols are informational only: Age creation uses the existing random
|
|
||||||
fallback and does not apply them to generation.
|
|
||||||
|
|
||||||
Removing a data pack never removes its IDs from saved writing. A missing ID is
|
Removing a data pack never removes its IDs from saved writing. A missing ID is
|
||||||
resolved as client-safe **Unresolved Symbol** display metadata while retaining
|
resolved as client-safe **Unresolved Symbol** display metadata while retaining
|
||||||
@@ -108,7 +105,8 @@ imported at a chosen strip position; the empty Notebook remains recoverable.
|
|||||||
The preview result is virtual. Taking the completed Descriptive Book commits the
|
The preview result is virtual. Taking the completed Descriptive Book commits the
|
||||||
inputs once, creates its Age identity, and saves schema-versioned
|
inputs once, creates its Age identity, and saves schema-versioned
|
||||||
`OrderedWriting` plus the Age reference on the book. Link-Panel-only books
|
`OrderedWriting` plus the Age reference on the book. Link-Panel-only books
|
||||||
create random Ages. A written symbol does **not** yet change that generation.
|
create random Ages. Supported written pages change the corresponding Age
|
||||||
|
generation branch; missing branches use seeded defaults.
|
||||||
Inputs, title, and pending Age identity survive Binder save/load; breaking the
|
Inputs, title, and pending Age identity survive Binder save/load; breaking the
|
||||||
Binder returns stored inputs. The completed book retains both its writing and
|
Binder returns stored inputs. The completed book retains both its writing and
|
||||||
Age identity through item save/load and copying.
|
Age identity through item save/load and copying.
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
|
|
||||||
New Binder writing has at most one Link Panel plus 27 symbol pages. The Link Panel must be first. A Link-Panel-only book, or an older book with no writing component, keeps the existing random Age path. Any authored supported symbol makes the book a partial or complete grammar. From 0.4.3.0, the server compiles it into a persistent Age plan before consuming Binder inputs or generating chunks.
|
New Binder writing has at most one Link Panel plus 27 symbol pages. The Link Panel must be first. A Link-Panel-only book, or an older book with no writing component, keeps the existing random Age path. Any authored supported symbol makes the book a partial or complete grammar. From 0.4.3.0, the server compiles it into a persistent Age plan before consuming Binder inputs or generating chunks.
|
||||||
|
|
||||||
The supported order follows the representable subset of the [Legacy grammar audit](LEGACY_AGE_GRAMMAR_AUDIT.md): terrain; zero or more biome pages; biome controller; weather; lighting; zero or more period, angle, or phase modifiers; one celestial page; then zero or more distinct features. Biome pages precede the controller that consumes them, and celestial modifiers precede the celestial page. Terrain, controller, weather, lighting, and celestial are single-choice categories; identical repeats are duplicates and differing values conflict. Repeated modifiers are intentional. Biome pages may repeat, preserving author order and any future weighting; feature IDs may not repeat.
|
The supported order follows the representable subset of the [Legacy grammar audit](LEGACY_AGE_GRAMMAR_AUDIT.md): terrain; zero or more biome pages; biome controller; weather; lighting; sky effects; zero or more period or phase modifiers; one celestial page; then zero or more distinct features. Biome pages precede the controller that consumes them, and celestial modifiers precede the celestial page. Terrain, controller, weather, lighting, sky, and celestial are single-choice categories; identical repeats are duplicates and differing values conflict. Repeated modifiers are intentional. Biome pages may repeat, preserving author order and any future weighting; feature IDs may not repeat. Angle modifiers remain recognized in the schema but are rejected at binding until a sky renderer can apply sun tilt.
|
||||||
|
|
||||||
Missing terrain, controller, weather, lighting, celestial, or the controller's minimum biome count is an **incomplete** warning, not an error: the compiler retains the seed-selected profile and traits for missing branches. The minimum is zero for Native, one for Single, and two for Tiled/Grid and Tiny–Huge. Native cannot consume authored biome pages; Single accepts only one. Unknown IDs, schema-v1 display-only symbols, wrong ordering, misplaced modifiers, duplicates, conflicts, missing/extra Link Panels, and oversized writing are errors. The Binder disables output and exposes the first error on the result-slot tooltip. When that error belongs to a page, its thumbnail is tinted and outlined red, the strip scrolls to it, and hovering it shows the diagnostic. This maps the parser's compact entry position back through any empty page positions. Rejected inputs remain removable. Binding an unwritten Descriptive Book rechecks its server-owned writing and reports the first error without creating an Age. A terrain symbol whose profile is unavailable is also rejected before Binder inputs are consumed.
|
Missing terrain, controller, weather, lighting, celestial, or the controller's minimum biome count is an **incomplete** warning, not an error: the compiler retains the seed-selected profile and traits for missing branches. The minimum is zero for Native, one for Single, and two for Tiled/Grid and Tiny–Huge. Native cannot consume authored biome pages; Single accepts only one. Unknown IDs, schema-v1 display-only symbols, wrong ordering, misplaced modifiers, duplicates, conflicts, missing/extra Link Panels, and oversized writing are errors. The Binder disables output and exposes the first error on the result-slot tooltip. When that error belongs to a page, its thumbnail is tinted and outlined red, the strip scrolls to it, and hovering it shows the diagnostic. This maps the parser's compact entry position back through any empty page positions. Rejected inputs remain removable. Binding an unwritten Descriptive Book rechecks its server-owned writing and reports the first error without creating an Age. A terrain symbol whose profile is unavailable is also rejected before Binder inputs are consumed.
|
||||||
|
|
||||||
The plan stores the original writing order, the authoritative semantic value of each resolved symbol, the Age seed, and a copy of the selected runtime profile. An explicit terrain page replaces the random terrain selection; an omitted terrain uses the seed-selected profile. The built-in Standard, Amplified, Cave, Island, Flat, and Void terrain pages now select their matching generation resources. Age loading uses the frozen runtime profile and does not need the original symbol definition or runtime-profile JSON, though its referenced noise, biome-preset, and dimension-type registry entries must remain available. Existing bound books without plans are not reinterpreted. Page-free and Link-Panel-only books keep the pre-existing random path. Biome, lighting, weather, celestial, and feature effects are retained in the plan but will be applied in issues #33–#35; instability remains Milestone 6 work.
|
The plan stores the original writing order, the authoritative semantic value of each resolved symbol, the Age seed, and a copy of the selected runtime profile. An explicit terrain page replaces the random terrain selection; an omitted terrain uses the seed-selected profile. The built-in Standard, Amplified, Cave, Island, Flat, and Void terrain pages select their matching generation resources. Age loading uses the frozen runtime profile and does not need the original symbol definition or runtime-profile JSON, though its referenced noise, biome-preset, and dimension-type registry entries must remain available. Existing bound books without plans are not reinterpreted. Page-free and Link-Panel-only books keep the pre-existing random path. Biome and environment pages now affect new Ages; feature effects remain issue #35 work, and instability remains Milestone 6 work.
|
||||||
|
|
||||||
The Rivencraft Pages creative tab reads a generated index of bundled symbol definitions. Adding another valid JSON symbol under `src/main/resources/data/rivencraft/rivencraft/symbols/` includes its page automatically in the next build; no Java starter-page list needs updating. The server catalog still decides whether that page is valid for writing. External server data-pack symbols are not included in this bundled index.
|
The Rivencraft Pages creative tab reads a generated index of bundled symbol definitions. Adding another valid JSON symbol under `src/main/resources/data/rivencraft/rivencraft/symbols/` includes its page automatically in the next build; no Java starter-page list needs updating. The server catalog still decides whether that page is valid for writing. External server data-pack symbols are not included in this bundled index.
|
||||||
+1
-1
@@ -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.
|
# 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.4.5.3
|
mod_version=0.4.6.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.
|
||||||
|
|||||||
@@ -64,24 +64,27 @@ public record AgeBiomeSelection(AgeTraits.BiomeDistribution distribution, List<R
|
|||||||
+ " is not a cave or Nether biome; use #rivencraft:cave_biomes or #minecraft:is_nether");
|
+ " is not a cave or Nether biome; use #rivencraft:cave_biomes or #minecraft:is_nether");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<ResourceLocation> eligible = eligible(registries, profile);
|
List<ResourceLocation> availableBiomes = eligible(registries, profile);
|
||||||
if (eligible.isEmpty()) throw new IllegalArgumentException("No eligible biomes for terrain " + profile.noiseSettings());
|
if (availableBiomes.isEmpty()) throw new IllegalArgumentException("No eligible biomes for terrain " + profile.noiseSettings());
|
||||||
if (distribution == AgeTraits.BiomeDistribution.NATIVE) {
|
if (distribution == AgeTraits.BiomeDistribution.NATIVE) {
|
||||||
if (!authored.isEmpty()) throw new IllegalArgumentException("Native biome distribution cannot use biome pages");
|
if (!authored.isEmpty()) throw new IllegalArgumentException("Native biome distribution cannot use biome pages");
|
||||||
return new AgeBiomeSelection(distribution, profile.terrain() == AgeRuntimeProfile.Terrain.FLAT
|
return new AgeBiomeSelection(distribution, profile.terrain() == AgeRuntimeProfile.Terrain.FLAT
|
||||||
? List.of(ResourceLocation.withDefaultNamespace("plains")) : eligible);
|
? List.of(ResourceLocation.withDefaultNamespace("plains")) : availableBiomes);
|
||||||
}
|
}
|
||||||
List<ResourceLocation> selected = new ArrayList<>(authored);
|
List<ResourceLocation> selected = new ArrayList<>(authored);
|
||||||
Set<ResourceLocation> distinct = new LinkedHashSet<>(selected);
|
Set<ResourceLocation> distinct = new LinkedHashSet<>(selected);
|
||||||
int minimum = minimum(distribution);
|
int minimum = minimum(distribution);
|
||||||
int target = minimum;
|
int target = minimum;
|
||||||
if (authored.isEmpty()) {
|
if (authored.isEmpty()) {
|
||||||
int maximum = Math.min(maximum(distribution), new LinkedHashSet<>(eligible).size());
|
// The terrain's available pool is the upper bound. For Cave terrain,
|
||||||
|
// eligible() returns the cave tag; other terrains use their preset.
|
||||||
|
int availableBiomeCount = new LinkedHashSet<>(availableBiomes).size();
|
||||||
|
int maximum = distribution == AgeTraits.BiomeDistribution.SINGLE ? 1 : availableBiomeCount;
|
||||||
if (maximum >= minimum) {
|
if (maximum >= minimum) {
|
||||||
target += new Random(seed ^ 0x42494F4D45434F55L).nextInt(maximum - minimum + 1);
|
target += new Random(seed ^ 0x42494F4D45434F55L).nextInt(maximum - minimum + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<ResourceLocation> filler = new ArrayList<>(eligible);
|
List<ResourceLocation> filler = new ArrayList<>(availableBiomes);
|
||||||
java.util.Collections.shuffle(filler, new Random(seed ^ 0x42494F4D45504F4FL));
|
java.util.Collections.shuffle(filler, new Random(seed ^ 0x42494F4D45504F4FL));
|
||||||
for (ResourceLocation id : filler) {
|
for (ResourceLocation id : filler) {
|
||||||
if (distinct.size() >= target) break;
|
if (distinct.size() >= target) break;
|
||||||
@@ -128,12 +131,4 @@ public record AgeBiomeSelection(AgeTraits.BiomeDistribution distribution, List<R
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Random-age limits; authored biome pages are never truncated to this maximum. */
|
|
||||||
public static int maximum(AgeTraits.BiomeDistribution distribution) {
|
|
||||||
return switch (distribution) {
|
|
||||||
case NATIVE, SINGLE -> 1;
|
|
||||||
case TILED, GRID -> 4;
|
|
||||||
case TINY, SMALL, MEDIUM, LARGE, HUGE -> 6;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -180,6 +180,10 @@ public final class AgeDimensionService {
|
|||||||
|
|
||||||
private static void applyInitialCelestialPhase(ServerLevel level, AgeDefinition age) {
|
private static void applyInitialCelestialPhase(ServerLevel level, AgeDefinition age) {
|
||||||
long phaseTime = (long)(age.traits().celestialPhase() * Level.TICKS_PER_DAY);
|
long phaseTime = (long)(age.traits().celestialPhase() * Level.TICKS_PER_DAY);
|
||||||
|
if (AgeEnvironmentCompiler.hasWrittenPhase(age.plan())) {
|
||||||
|
// Legacy's Nadir is midnight, while vanilla day time zero is sunrise.
|
||||||
|
phaseTime = (phaseTime + 18_000L) % Level.TICKS_PER_DAY;
|
||||||
|
}
|
||||||
level.setDayTime(phaseTime);
|
level.setDayTime(phaseTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,7 +486,7 @@ public final class AgeDimensionService {
|
|||||||
base.height(),
|
base.height(),
|
||||||
base.logicalHeight(),
|
base.logicalHeight(),
|
||||||
base.infiniburn(),
|
base.infiniburn(),
|
||||||
base.effectsLocation(),
|
AgeEnvironmentCompiler.skyEffects(age.plan(), base.effectsLocation()),
|
||||||
ambientLight,
|
ambientLight,
|
||||||
base.monsterSettings()
|
base.monsterSettings()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package net.dnorberg.rivencraft.book;
|
||||||
|
|
||||||
|
import net.dnorberg.rivencraft.writing.SymbolSemantics;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.level.dimension.BuiltinDimensionTypes;
|
||||||
|
|
||||||
|
/** Resolves written environment pages without changing the seeded page-free Age path. */
|
||||||
|
public final class AgeEnvironmentCompiler {
|
||||||
|
private AgeEnvironmentCompiler() {}
|
||||||
|
|
||||||
|
public static AgeTraits apply(AgeGenerationPlan plan, AgeTraits seeded) {
|
||||||
|
if (plan == null) return seeded;
|
||||||
|
|
||||||
|
AgeTraits.Lighting lighting = seeded.lighting();
|
||||||
|
AgeTraits.Weather weather = seeded.weather();
|
||||||
|
double period = seeded.celestialPeriod();
|
||||||
|
float phase = seeded.celestialPhase();
|
||||||
|
boolean normalTime = plan.symbols().stream()
|
||||||
|
.anyMatch(symbol -> symbol.semantics().role() == SymbolSemantics.Role.CELESTIAL);
|
||||||
|
if (normalTime) period = 1.0D;
|
||||||
|
boolean writtenPeriod = false;
|
||||||
|
boolean writtenPhase = false;
|
||||||
|
float phaseDegrees = 0.0F;
|
||||||
|
|
||||||
|
for (AgeGenerationPlan.ResolvedSymbol symbol : plan.symbols()) {
|
||||||
|
SymbolSemantics semantics = symbol.semantics();
|
||||||
|
switch (semantics.role()) {
|
||||||
|
case LIGHTING -> lighting = AgeTraits.Lighting.valueOf(
|
||||||
|
((SymbolSemantics.ChoiceValue) semantics.value()).id().toUpperCase(java.util.Locale.ROOT));
|
||||||
|
case WEATHER -> {
|
||||||
|
String choice = ((SymbolSemantics.ChoiceValue) semantics.value()).id();
|
||||||
|
if (choice.equals("snow")) {
|
||||||
|
throw new IllegalArgumentException("Always Snow requires optional season integration");
|
||||||
|
}
|
||||||
|
if (choice.equals("cloudy") || choice.equals("rain")) {
|
||||||
|
throw new IllegalArgumentException(choice + " weather needs precipitation rendering support");
|
||||||
|
}
|
||||||
|
weather = AgeTraits.Weather.valueOf(choice.toUpperCase(java.util.Locale.ROOT));
|
||||||
|
}
|
||||||
|
case PERIOD_MODIFIER -> {
|
||||||
|
double next = ((SymbolSemantics.NumberValue) semantics.value()).amount();
|
||||||
|
period = writtenPeriod ? (period + next) / 2.0D : next;
|
||||||
|
writtenPeriod = true;
|
||||||
|
}
|
||||||
|
case PHASE_MODIFIER -> {
|
||||||
|
float next = (float) ((SymbolSemantics.NumberValue) semantics.value()).amount();
|
||||||
|
phaseDegrees = writtenPhase ? circularMidpoint(phaseDegrees, next) : next;
|
||||||
|
writtenPhase = true;
|
||||||
|
}
|
||||||
|
case ANGLE_MODIFIER -> throw new IllegalArgumentException(
|
||||||
|
"Sun angle pages require a custom sky renderer and are not supported yet");
|
||||||
|
default -> { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (writtenPhase) phase = phaseDegrees / 360.0F;
|
||||||
|
return new AgeTraits(plan.biomeSelection() == null ? seeded.biomeDistribution()
|
||||||
|
: plan.biomeSelection().distribution(), lighting, weather, period,
|
||||||
|
seeded.celestialAngle(), phase);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Vanilla effects are the sky styles the current renderer can honor exactly. */
|
||||||
|
public static ResourceLocation skyEffects(AgeGenerationPlan plan, ResourceLocation fallback) {
|
||||||
|
if (plan == null) return fallback;
|
||||||
|
return plan.symbols().stream()
|
||||||
|
.filter(symbol -> symbol.semantics().role() == SymbolSemantics.Role.SKY)
|
||||||
|
.map(symbol -> ((SymbolSemantics.ChoiceValue) symbol.semantics().value()).id())
|
||||||
|
.map(choice -> switch (choice) {
|
||||||
|
case "overworld" -> BuiltinDimensionTypes.OVERWORLD_EFFECTS;
|
||||||
|
case "nether" -> BuiltinDimensionTypes.NETHER_EFFECTS;
|
||||||
|
case "end" -> BuiltinDimensionTypes.END_EFFECTS;
|
||||||
|
default -> throw new IllegalArgumentException("Unsupported sky effect " + choice);
|
||||||
|
}).findFirst().orElse(fallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean hasWrittenPhase(AgeGenerationPlan plan) {
|
||||||
|
return plan != null && plan.symbols().stream()
|
||||||
|
.anyMatch(symbol -> symbol.semantics().role() == SymbolSemantics.Role.PHASE_MODIFIER);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int previewSkyColor(ResourceLocation effects, int biomeSkyColor) {
|
||||||
|
if (effects.equals(BuiltinDimensionTypes.NETHER_EFFECTS)) return 0xFF6B2725;
|
||||||
|
if (effects.equals(BuiltinDimensionTypes.END_EFFECTS)) return 0xFF211835;
|
||||||
|
return biomeSkyColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float circularMidpoint(float current, float next) {
|
||||||
|
float difference = (next - current + 540.0F) % 360.0F - 180.0F;
|
||||||
|
return (current + difference / 2.0F + 360.0F) % 360.0F;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -65,10 +65,12 @@ public record AgeGenerationPlan(int version, long ageSeed, OrderedWriting writin
|
|||||||
AgeRuntimeProfile profile = AgeRuntimeProfiles.profiles().get(selected);
|
AgeRuntimeProfile profile = AgeRuntimeProfiles.profiles().get(selected);
|
||||||
if (profile == null) throw new IllegalArgumentException("Unsupported Age terrain profile " + selected);
|
if (profile == null) throw new IllegalArgumentException("Unsupported Age terrain profile " + selected);
|
||||||
AgeBiomeSelection biomes = AgeBiomeSelection.compile(parsed, traits, profile, ageSeed, registries);
|
AgeBiomeSelection biomes = AgeBiomeSelection.compile(parsed, traits, profile, ageSeed, registries);
|
||||||
return new AgeGenerationPlan(CURRENT_VERSION, ageSeed, writing,
|
AgeGenerationPlan plan = new AgeGenerationPlan(CURRENT_VERSION, ageSeed, writing,
|
||||||
parsed.symbols().stream().map(symbol -> new ResolvedSymbol(
|
parsed.symbols().stream().map(symbol -> new ResolvedSymbol(
|
||||||
symbol.index(), symbol.reference(), symbol.semantics())).toList(),
|
symbol.index(), symbol.reference(), symbol.semantics())).toList(),
|
||||||
profile, biomes);
|
profile, biomes);
|
||||||
|
AgeEnvironmentCompiler.apply(plan, traits);
|
||||||
|
return plan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResourceLocation authoredTerrain() {
|
public ResourceLocation authoredTerrain() {
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ public final class AgeRegistrySavedData extends SavedData {
|
|||||||
createdGameTime,
|
createdGameTime,
|
||||||
dimensionId,
|
dimensionId,
|
||||||
null,
|
null,
|
||||||
traits,
|
AgeEnvironmentCompiler.apply(plan, traits),
|
||||||
plan
|
plan
|
||||||
);
|
);
|
||||||
ages.put(created.id(), created);
|
ages.put(created.id(), created);
|
||||||
|
|||||||
@@ -0,0 +1,115 @@
|
|||||||
|
package net.dnorberg.rivencraft.book;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import net.dnorberg.rivencraft.item.PageItem;
|
||||||
|
import net.dnorberg.rivencraft.writing.OrderedWriting;
|
||||||
|
import net.dnorberg.rivencraft.writing.SymbolCatalog;
|
||||||
|
import net.dnorberg.rivencraft.writing.SymbolReference;
|
||||||
|
import net.dnorberg.rivencraft.writing.WritingEntry;
|
||||||
|
import net.minecraft.gametest.framework.GameTest;
|
||||||
|
import net.minecraft.gametest.framework.GameTestHelper;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.level.dimension.BuiltinDimensionTypes;
|
||||||
|
import net.neoforged.neoforge.gametest.GameTestHolder;
|
||||||
|
import net.neoforged.neoforge.gametest.PrefixGameTestTemplate;
|
||||||
|
|
||||||
|
/** Issue #34: written environment effects and the shared creative/JEI page feed. */
|
||||||
|
@GameTestHolder("rivencraft_archive_environment")
|
||||||
|
@PrefixGameTestTemplate(false)
|
||||||
|
public final class EnvironmentWritingGameTests {
|
||||||
|
private EnvironmentWritingGameTests() {}
|
||||||
|
|
||||||
|
@GameTest(template = "empty")
|
||||||
|
public static void environmentPagesEnterCreativeAndJeiFeed(GameTestHelper helper) {
|
||||||
|
Set<String> expected = Set.of(
|
||||||
|
"lighting/normal", "lighting/dark", "lighting/bright",
|
||||||
|
"sky/overworld", "sky/nether", "sky/end",
|
||||||
|
"weather/normal", "weather/fast", "weather/slow", "weather/off",
|
||||||
|
"weather/always", "weather/storm", "celestial/normal_time",
|
||||||
|
"period/zero", "period/half", "period/full", "period/double",
|
||||||
|
"phase/nadir", "phase/rising", "phase/zenith", "phase/setting");
|
||||||
|
Set<String> creative = PageItem.creativeSymbolPages(helper.getLevel().registryAccess()).stream()
|
||||||
|
.map(PageItem::content)
|
||||||
|
.filter(content -> content.symbol().isPresent())
|
||||||
|
.map(content -> content.symbol().orElseThrow().id().getPath())
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
helper.assertTrue(PageItem.bundledCreativeSymbols().containsAll(expected)
|
||||||
|
&& creative.containsAll(expected),
|
||||||
|
"Every supported environment page must enter the creative index JEI also consumes");
|
||||||
|
for (String path : expected) {
|
||||||
|
var id = ResourceLocation.fromNamespaceAndPath("rivencraft", path);
|
||||||
|
helper.assertTrue(SymbolCatalog.isKnown(new SymbolReference(id))
|
||||||
|
&& PageItem.isUsableWriting(PageItem.createBundledCreativePage(path)),
|
||||||
|
"Environment page must resolve as valid writing: " + path);
|
||||||
|
}
|
||||||
|
helper.assertFalse(creative.contains("weather/snow") || creative.contains("weather/cloudy")
|
||||||
|
|| creative.contains("weather/rain"),
|
||||||
|
"Unsupported precipitation variants must not appear as working pages");
|
||||||
|
helper.succeed();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GameTest(template = "empty")
|
||||||
|
public static void writtenEnvironmentPersistsAndPageFreeAgesStaySeeded(GameTestHelper helper) {
|
||||||
|
OrderedWriting writing = new OrderedWriting(List.of(
|
||||||
|
WritingEntry.linkPanel(),
|
||||||
|
page("terrain/standard"), page("weather/off"), page("lighting/dark"),
|
||||||
|
page("sky/end"), page("period/zero"), page("phase/rising"),
|
||||||
|
page("celestial/normal_time")));
|
||||||
|
AgeTraits seeded = AgeTraits.select(42L);
|
||||||
|
var plan = AgeGenerationPlan.compile(writing, 42L, AgeGenerationProfiles.STANDARD,
|
||||||
|
seeded, helper.getLevel().registryAccess());
|
||||||
|
var effective = AgeEnvironmentCompiler.apply(plan, seeded);
|
||||||
|
helper.assertValueEqual(effective.lighting(), AgeTraits.Lighting.DARK,
|
||||||
|
"Written Dark Lighting must override the seeded lighting");
|
||||||
|
helper.assertValueEqual(effective.weather(), AgeTraits.Weather.OFF,
|
||||||
|
"Written No Weather must override the seeded weather");
|
||||||
|
helper.assertTrue(effective.hasStoppedCelestialCycle(),
|
||||||
|
"A written Zero Length page must stop the celestial cycle");
|
||||||
|
helper.assertValueEqual(effective.celestialPhase(), 0.25F,
|
||||||
|
"Written Rising phase must be stored as a quarter turn");
|
||||||
|
helper.assertValueEqual(AgeEnvironmentCompiler.skyEffects(plan, BuiltinDimensionTypes.OVERWORLD_EFFECTS),
|
||||||
|
BuiltinDimensionTypes.END_EFFECTS, "Written End Sky must select the End sky effects");
|
||||||
|
helper.assertValueEqual(AgeEnvironmentCompiler.previewSkyColor(BuiltinDimensionTypes.END_EFFECTS, 0xFF77AAFF),
|
||||||
|
0xFF211835, "End sky preview must not retain an Overworld biome's blue tint");
|
||||||
|
helper.assertValueEqual(AgeEnvironmentCompiler.previewSkyColor(BuiltinDimensionTypes.NETHER_EFFECTS, 0xFF77AAFF),
|
||||||
|
0xFF6B2725, "Nether sky preview must use its red tint");
|
||||||
|
helper.assertValueEqual(AgeEnvironmentCompiler.previewSkyColor(BuiltinDimensionTypes.OVERWORLD_EFFECTS, 0xFF77AAFF),
|
||||||
|
0xFF77AAFF, "Overworld sky preview must retain the destination biome tint");
|
||||||
|
helper.assertValueEqual(AgeEnvironmentCompiler.apply(AgeGenerationPlan.load(plan.save()), seeded), effective,
|
||||||
|
"Written environment values must survive a plan save/load round trip");
|
||||||
|
helper.assertValueEqual(AgeEnvironmentCompiler.apply(null, seeded), seeded,
|
||||||
|
"Page-free Ages must retain their seeded environment without recompilation");
|
||||||
|
|
||||||
|
var player = helper.makeMockServerPlayerInLevel();
|
||||||
|
var reference = new AgeReference(UUID.randomUUID(), "Written Environment");
|
||||||
|
var target = AgeDimensionService.resolve(player, reference, writing).orElseThrow();
|
||||||
|
var definition = AgeRegistrySavedData.get(helper.getLevel()).find(reference.id()).orElseThrow();
|
||||||
|
helper.assertValueEqual(definition.traits(), AgeEnvironmentCompiler.apply(
|
||||||
|
definition.plan(), AgeTraits.select(definition.seed())),
|
||||||
|
"The effective authored environment must persist with the Age definition");
|
||||||
|
helper.runAfterDelay(1, () -> {
|
||||||
|
var level = helper.getLevel().getServer().getLevel(target.location().dimension());
|
||||||
|
helper.assertTrue(level != null, "Written environment Age must load");
|
||||||
|
helper.assertFalse(level.dimensionType().hasSkyLight(), "Dark Lighting must remove skylight");
|
||||||
|
helper.assertValueEqual(level.dimensionType().effectsLocation(), BuiltinDimensionTypes.END_EFFECTS,
|
||||||
|
"The runtime Age must render the written End sky");
|
||||||
|
helper.assertValueEqual(level.getDayTimePerTick(), Float.MIN_VALUE,
|
||||||
|
"Zero Length must use the non-bouncing stopped clock");
|
||||||
|
helper.assertTrue(Math.floorMod(level.getDayTime(), 24_000L) < 5L,
|
||||||
|
"Legacy Rising phase must begin at vanilla sunrise");
|
||||||
|
level.setWeatherParameters(0, 6_000, true, true);
|
||||||
|
helper.runAfterDelay(2, () -> {
|
||||||
|
helper.assertFalse(level.isRaining() || level.isThundering(),
|
||||||
|
"Written No Weather must clear rain and thunder in this Age");
|
||||||
|
helper.succeed();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static WritingEntry page(String path) {
|
||||||
|
return WritingEntry.symbol(new SymbolReference(ResourceLocation.fromNamespaceAndPath("rivencraft", path)));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -147,16 +147,42 @@ public final class TerrainWritingGameTests {
|
|||||||
var randomWriting = net.dnorberg.rivencraft.writing.WritingGrammar.parse(OrderedWriting.EMPTY);
|
var randomWriting = net.dnorberg.rivencraft.writing.WritingGrammar.parse(OrderedWriting.EMPTY);
|
||||||
var traits = new AgeTraits(AgeTraits.BiomeDistribution.TINY, AgeTraits.Lighting.NORMAL,
|
var traits = new AgeTraits(AgeTraits.BiomeDistribution.TINY, AgeTraits.Lighting.NORMAL,
|
||||||
AgeTraits.Weather.NORMAL, 1.0D, 0.0F, 0.0F);
|
AgeTraits.Weather.NORMAL, 1.0D, 0.0F, 0.0F);
|
||||||
|
int availableBiomeCount = new java.util.LinkedHashSet<>(AgeBiomeSelection.eligible(registries, profile)).size();
|
||||||
java.util.Set<Integer> counts = new java.util.HashSet<>();
|
java.util.Set<Integer> counts = new java.util.HashSet<>();
|
||||||
for (long seed = 0; seed < 64; seed++) {
|
for (long seed = 0; seed < 64; seed++) {
|
||||||
var random = AgeBiomeSelection.compile(randomWriting, traits, profile, seed, registries);
|
var random = AgeBiomeSelection.compile(randomWriting, traits, profile, seed, registries);
|
||||||
helper.assertTrue(random.biomes().size() >= 2 && random.biomes().size() <= 6,
|
helper.assertTrue(random.biomes().size() >= 2 && random.biomes().size() <= availableBiomeCount,
|
||||||
"Random Tiny ages must select between two and six distinct biomes");
|
"Random Tiny ages must not exceed their available biome pool");
|
||||||
helper.assertValueEqual(random, AgeBiomeSelection.compile(randomWriting, traits, profile, seed, registries),
|
helper.assertValueEqual(random, AgeBiomeSelection.compile(randomWriting, traits, profile, seed, registries),
|
||||||
"The random count and chosen biomes must be deterministic for an Age seed");
|
"The random count and chosen biomes must be deterministic for an Age seed");
|
||||||
counts.add(random.biomes().size());
|
counts.add(random.biomes().size());
|
||||||
}
|
}
|
||||||
helper.assertTrue(counts.size() > 1, "Random Ages must vary their biome count across seeds");
|
helper.assertTrue(counts.size() > 1, "Random Ages must vary their biome count across seeds");
|
||||||
|
if (availableBiomeCount > 6) {
|
||||||
|
helper.assertTrue(counts.stream().anyMatch(count -> count > 6),
|
||||||
|
"The available biome pool, not the old fixed cap, must bound random Ages");
|
||||||
|
}
|
||||||
|
|
||||||
|
var tiledTraits = new AgeTraits(AgeTraits.BiomeDistribution.TILED, AgeTraits.Lighting.NORMAL,
|
||||||
|
AgeTraits.Weather.NORMAL, 1.0D, 0.0F, 0.0F);
|
||||||
|
if (availableBiomeCount > 4) {
|
||||||
|
boolean exceededOldCap = false;
|
||||||
|
for (long seed = 0; seed < 64; seed++) {
|
||||||
|
var random = AgeBiomeSelection.compile(randomWriting, tiledTraits, profile, seed, registries);
|
||||||
|
helper.assertTrue(random.biomes().size() >= 2 && random.biomes().size() <= availableBiomeCount,
|
||||||
|
"Random Tiled ages must not exceed their available biome pool");
|
||||||
|
exceededOldCap |= random.biomes().size() > 4;
|
||||||
|
}
|
||||||
|
helper.assertTrue(exceededOldCap, "Tiled Ages must also be able to exceed the old fixed cap");
|
||||||
|
}
|
||||||
|
|
||||||
|
var caveProfile = AgeRuntimeProfiles.resolve(AgeGenerationProfiles.CAVE);
|
||||||
|
int caveBiomeCount = new java.util.LinkedHashSet<>(AgeBiomeSelection.eligible(registries, caveProfile)).size();
|
||||||
|
for (long seed = 0; seed < 64; seed++) {
|
||||||
|
var random = AgeBiomeSelection.compile(randomWriting, traits, caveProfile, seed, registries);
|
||||||
|
helper.assertTrue(random.biomes().size() >= 2 && random.biomes().size() <= caveBiomeCount,
|
||||||
|
"Random Cave ages must use the cave biome pool as their upper bound");
|
||||||
|
}
|
||||||
helper.succeed();
|
helper.succeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -247,8 +247,6 @@ public final class DescriptiveBookScreen extends Screen implements ExplorableBoo
|
|||||||
x, top + 39, 126, color);
|
x, top + 39, 126, color);
|
||||||
drawWrappedWithoutShadow(graphics, Component.literal(display.id().toString()),
|
drawWrappedWithoutShadow(graphics, Component.literal(display.id().toString()),
|
||||||
x, top + 64, 126, color);
|
x, top + 64, 126, color);
|
||||||
drawWrappedWithoutShadow(graphics, Component.translatable("screen.rivencraft.age.pages_not_applied"),
|
|
||||||
x, top + 137, 126);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void turnPage(int direction) {
|
private void turnPage(int direction) {
|
||||||
|
|||||||
@@ -421,9 +421,11 @@ public final class LinkingGameTests {
|
|||||||
}
|
}
|
||||||
if (profile.equals(AgeGenerationProfiles.AMPLIFIED)) {
|
if (profile.equals(AgeGenerationProfiles.AMPLIFIED)) {
|
||||||
var biomeSource = level.getChunkSource().getGenerator().getBiomeSource();
|
var biomeSource = level.getChunkSource().getGenerator().getBiomeSource();
|
||||||
|
int availableBiomes = AgeBiomeSelection.eligible(helper.getLevel().registryAccess(),
|
||||||
|
AgeRuntimeProfiles.resolve(profile)).size();
|
||||||
helper.assertTrue(biomeSource.possibleBiomes().size() >= 2
|
helper.assertTrue(biomeSource.possibleBiomes().size() >= 2
|
||||||
&& biomeSource.possibleBiomes().size() <= 4,
|
&& biomeSource.possibleBiomes().size() <= availableBiomes,
|
||||||
"Random Tiled distribution must use two to four seeded biomes");
|
"Random Tiled distribution must stay within the available biome pool");
|
||||||
var origin = biomeSource.getNoiseBiome(0, 0, 0, null);
|
var origin = biomeSource.getNoiseBiome(0, 0, 0, null);
|
||||||
var eastTile = biomeSource.getNoiseBiome(64, 0, 0, null);
|
var eastTile = biomeSource.getNoiseBiome(64, 0, 0, null);
|
||||||
helper.assertFalse(origin.equals(eastTile),
|
helper.assertFalse(origin.equals(eastTile),
|
||||||
@@ -431,9 +433,11 @@ public final class LinkingGameTests {
|
|||||||
}
|
}
|
||||||
if (profile.equals(AgeGenerationProfiles.ISLAND)) {
|
if (profile.equals(AgeGenerationProfiles.ISLAND)) {
|
||||||
var biomeSource = level.getChunkSource().getGenerator().getBiomeSource();
|
var biomeSource = level.getChunkSource().getGenerator().getBiomeSource();
|
||||||
|
int availableBiomes = AgeBiomeSelection.eligible(helper.getLevel().registryAccess(),
|
||||||
|
AgeRuntimeProfiles.resolve(profile)).size();
|
||||||
helper.assertTrue(biomeSource.possibleBiomes().size() >= 2
|
helper.assertTrue(biomeSource.possibleBiomes().size() >= 2
|
||||||
&& biomeSource.possibleBiomes().size() <= 4,
|
&& biomeSource.possibleBiomes().size() <= availableBiomes,
|
||||||
"Random Grid distribution must use two to four seeded biomes");
|
"Random Grid distribution must stay within the available biome pool");
|
||||||
var origin = biomeSource.getNoiseBiome(0, 0, 0, null);
|
var origin = biomeSource.getNoiseBiome(0, 0, 0, null);
|
||||||
var insideOriginChunk = biomeSource.getNoiseBiome(3, 0, 3, null);
|
var insideOriginChunk = biomeSource.getNoiseBiome(3, 0, 3, null);
|
||||||
var eastChunk = biomeSource.getNoiseBiome(4, 0, 0, null);
|
var eastChunk = biomeSource.getNoiseBiome(4, 0, 0, null);
|
||||||
@@ -444,11 +448,13 @@ public final class LinkingGameTests {
|
|||||||
}
|
}
|
||||||
if (profile.equals(AgeGenerationProfiles.CAVE)) {
|
if (profile.equals(AgeGenerationProfiles.CAVE)) {
|
||||||
var biomeSource = level.getChunkSource().getGenerator().getBiomeSource();
|
var biomeSource = level.getChunkSource().getGenerator().getBiomeSource();
|
||||||
|
int caveBiomeCount = AgeBiomeSelection.eligible(helper.getLevel().registryAccess(),
|
||||||
|
AgeRuntimeProfiles.resolve(profile)).size();
|
||||||
helper.assertTrue(biomeSource instanceof net.dnorberg.rivencraft.world.ScaledBiomeSource,
|
helper.assertTrue(biomeSource instanceof net.dnorberg.rivencraft.world.ScaledBiomeSource,
|
||||||
"Tiny Biome Distribution must use the serializable scaled biome source");
|
"Tiny Biome Distribution must use the serializable scaled biome source");
|
||||||
helper.assertTrue(biomeSource.possibleBiomes().size() >= 2
|
helper.assertTrue(biomeSource.possibleBiomes().size() >= 2
|
||||||
&& biomeSource.possibleBiomes().size() <= 3,
|
&& biomeSource.possibleBiomes().size() <= caveBiomeCount,
|
||||||
"Random cave Tiny distribution must use two to three eligible biomes");
|
"Random cave Tiny distribution must use only eligible cave biomes");
|
||||||
java.util.Set<net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome>> sampled =
|
java.util.Set<net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome>> sampled =
|
||||||
new java.util.HashSet<>();
|
new java.util.HashSet<>();
|
||||||
for (int x = -32; x <= 32; x += 4) {
|
for (int x = -32; x <= 32; x += 4) {
|
||||||
@@ -520,11 +526,13 @@ public final class LinkingGameTests {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var biomeSource = level.getChunkSource().getGenerator().getBiomeSource();
|
var biomeSource = level.getChunkSource().getGenerator().getBiomeSource();
|
||||||
|
int availableBiomes = AgeBiomeSelection.eligible(helper.getLevel().registryAccess(),
|
||||||
|
AgeRuntimeProfiles.resolve(AgeGenerationProfiles.STANDARD)).size();
|
||||||
helper.assertTrue(biomeSource instanceof net.dnorberg.rivencraft.world.ScaledBiomeSource,
|
helper.assertTrue(biomeSource instanceof net.dnorberg.rivencraft.world.ScaledBiomeSource,
|
||||||
distribution + " Biome Distribution must use the serializable scaled biome source");
|
distribution + " Biome Distribution must use the serializable scaled biome source");
|
||||||
helper.assertTrue(biomeSource.possibleBiomes().size() >= 2
|
helper.assertTrue(biomeSource.possibleBiomes().size() >= 2
|
||||||
&& biomeSource.possibleBiomes().size() <= 6,
|
&& biomeSource.possibleBiomes().size() <= availableBiomes,
|
||||||
distribution + " random distribution must use two to six seeded biomes");
|
distribution + " random distribution must stay within the available biome pool");
|
||||||
helper.assertValueEqual(
|
helper.assertValueEqual(
|
||||||
((net.dnorberg.rivencraft.world.ScaledBiomeSource)biomeSource).scale(),
|
((net.dnorberg.rivencraft.world.ScaledBiomeSource)biomeSource).scale(),
|
||||||
scale,
|
scale,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import net.dnorberg.rivencraft.book.AgeRegistrySavedData;
|
|||||||
import net.dnorberg.rivencraft.book.AgeDimensionService;
|
import net.dnorberg.rivencraft.book.AgeDimensionService;
|
||||||
import net.dnorberg.rivencraft.book.AgeGenerationPlan;
|
import net.dnorberg.rivencraft.book.AgeGenerationPlan;
|
||||||
import net.dnorberg.rivencraft.book.AgeGenerationProfiles;
|
import net.dnorberg.rivencraft.book.AgeGenerationProfiles;
|
||||||
|
import net.dnorberg.rivencraft.book.AgeEnvironmentCompiler;
|
||||||
import net.dnorberg.rivencraft.block.entity.BookStandBlockEntity;
|
import net.dnorberg.rivencraft.block.entity.BookStandBlockEntity;
|
||||||
import net.dnorberg.rivencraft.client.ClientLinkPreviewHandler;
|
import net.dnorberg.rivencraft.client.ClientLinkPreviewHandler;
|
||||||
import net.dnorberg.rivencraft.client.ClientBookInteractionHandler;
|
import net.dnorberg.rivencraft.client.ClientBookInteractionHandler;
|
||||||
@@ -313,15 +314,10 @@ public final class ModNetworking {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Vanilla Nether and End renderers do not use their biomes' blue Overworld sky tint. */
|
/** Sky effects, not dimension IDs, decide the backdrop for custom Ages. */
|
||||||
private static int previewSkyColor(ServerLevel level, BlockPos origin) {
|
private static int previewSkyColor(ServerLevel level, BlockPos origin) {
|
||||||
if (level.dimension().equals(Level.NETHER)) {
|
return AgeEnvironmentCompiler.previewSkyColor(level.dimensionType().effectsLocation(),
|
||||||
return 0xFF6B2725;
|
level.getBiome(origin).value().getSkyColor());
|
||||||
}
|
|
||||||
if (level.dimension().equals(Level.END)) {
|
|
||||||
return 0xFF211835;
|
|
||||||
}
|
|
||||||
return level.getBiome(origin).value().getSkyColor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static InteractionHand hand(boolean offhand) {
|
private static InteractionHand hand(boolean offhand) {
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ public record SymbolSemantics(Role role, Value value) {
|
|||||||
"native", "single", "tiled", "grid", "tiny", "small", "medium", "large", "huge"),
|
"native", "single", "tiled", "grid", "tiny", "small", "medium", "large", "huge"),
|
||||||
BIOME("biome", Kind.RESOURCE),
|
BIOME("biome", Kind.RESOURCE),
|
||||||
LIGHTING("lighting", Kind.CHOICE, "normal", "dark", "bright"),
|
LIGHTING("lighting", Kind.CHOICE, "normal", "dark", "bright"),
|
||||||
|
SKY("sky", Kind.CHOICE, "overworld", "nether", "end"),
|
||||||
WEATHER("weather", Kind.CHOICE,
|
WEATHER("weather", Kind.CHOICE,
|
||||||
"normal", "fast", "slow", "off", "always", "cloudy", "rain", "snow", "storm"),
|
"normal", "fast", "slow", "off", "always", "cloudy", "rain", "snow", "storm"),
|
||||||
CELESTIAL("celestial", Kind.CHOICE, "normal_time"),
|
CELESTIAL("celestial", Kind.CHOICE, "normal_time"),
|
||||||
|
|||||||
@@ -69,6 +69,12 @@ public final class WritingGrammar {
|
|||||||
Role role = semantics.orElseThrow().role();
|
Role role = semantics.orElseThrow().role();
|
||||||
ParsedSymbol parsed = new ParsedSymbol(index, reference, semantics.orElseThrow());
|
ParsedSymbol parsed = new ParsedSymbol(index, reference, semantics.orElseThrow());
|
||||||
symbols.add(parsed);
|
symbols.add(parsed);
|
||||||
|
if (role == Role.ANGLE_MODIFIER || role == Role.WEATHER
|
||||||
|
&& parsed.semantics().value() instanceof ChoiceValue choice
|
||||||
|
&& Set.of("snow", "cloudy", "rain").contains(choice.id())) {
|
||||||
|
diagnostics.add(new Diagnostic(Code.UNSUPPORTED_ENVIRONMENT, index,
|
||||||
|
"This environment effect needs renderer or precipitation support"));
|
||||||
|
}
|
||||||
if (singular(role)) {
|
if (singular(role)) {
|
||||||
ParsedSymbol previous = singular.putIfAbsent(role, parsed);
|
ParsedSymbol previous = singular.putIfAbsent(role, parsed);
|
||||||
if (previous != null) {
|
if (previous != null) {
|
||||||
@@ -127,7 +133,7 @@ public final class WritingGrammar {
|
|||||||
|
|
||||||
private static boolean singular(Role role) {
|
private static boolean singular(Role role) {
|
||||||
return switch (role) {
|
return switch (role) {
|
||||||
case TERRAIN, BIOME_CONTROLLER, WEATHER, LIGHTING, CELESTIAL -> true;
|
case TERRAIN, BIOME_CONTROLLER, WEATHER, LIGHTING, SKY, CELESTIAL -> true;
|
||||||
default -> false;
|
default -> false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -143,16 +149,17 @@ public final class WritingGrammar {
|
|||||||
case BIOME_CONTROLLER -> 2;
|
case BIOME_CONTROLLER -> 2;
|
||||||
case WEATHER -> 3;
|
case WEATHER -> 3;
|
||||||
case LIGHTING -> 4;
|
case LIGHTING -> 4;
|
||||||
case PERIOD_MODIFIER, ANGLE_MODIFIER, PHASE_MODIFIER -> 5;
|
case SKY -> 5;
|
||||||
case CELESTIAL -> 6;
|
case PERIOD_MODIFIER, ANGLE_MODIFIER, PHASE_MODIFIER -> 6;
|
||||||
case FEATURE -> 7;
|
case CELESTIAL -> 7;
|
||||||
|
case FEATURE -> 8;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Code {
|
public enum Code {
|
||||||
TOO_MANY, MISSING_PANEL, PANEL_ORDER, DUPLICATE_PANEL, UNRESOLVED, UNSUPPORTED,
|
TOO_MANY, MISSING_PANEL, PANEL_ORDER, DUPLICATE_PANEL, UNRESOLVED, UNSUPPORTED,
|
||||||
DUPLICATE, CONFLICT, OUT_OF_ORDER, MISPLACED_MODIFIER, INCOMPLETE, UNSUPPORTED_PROFILE,
|
DUPLICATE, CONFLICT, OUT_OF_ORDER, MISPLACED_MODIFIER, INCOMPLETE, UNSUPPORTED_PROFILE,
|
||||||
UNKNOWN_BIOME, UNSUPPORTED_BIOME
|
UNKNOWN_BIOME, UNSUPPORTED_BIOME, UNSUPPORTED_ENVIRONMENT
|
||||||
}
|
}
|
||||||
|
|
||||||
public record Diagnostic(Code code, int index, String message) {
|
public record Diagnostic(Code code, int index, String message) {
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
"screen.rivencraft.book_binder.grammar.unresolved": "Page %s: missing symbol definition; restore its data pack or remove it",
|
"screen.rivencraft.book_binder.grammar.unresolved": "Page %s: missing symbol definition; restore its data pack or remove it",
|
||||||
"screen.rivencraft.book_binder.grammar.unsupported": "Page %s: this symbol needs semantic schema v2; update its data pack or remove it",
|
"screen.rivencraft.book_binder.grammar.unsupported": "Page %s: this symbol needs semantic schema v2; update its data pack or remove it",
|
||||||
"screen.rivencraft.book_binder.grammar.unsupported_profile": "Page %s: its Age profile is unavailable; restore the data pack or remove this page",
|
"screen.rivencraft.book_binder.grammar.unsupported_profile": "Page %s: its Age profile is unavailable; restore the data pack or remove this page",
|
||||||
|
"screen.rivencraft.book_binder.grammar.unsupported_environment": "Page %s: this weather or sky effect is not supported yet",
|
||||||
"screen.rivencraft.book_binder.grammar.duplicate": "Page %s: remove the duplicate symbol",
|
"screen.rivencraft.book_binder.grammar.duplicate": "Page %s: remove the duplicate symbol",
|
||||||
"screen.rivencraft.book_binder.grammar.conflict": "Page %s: replace the conflicting symbol",
|
"screen.rivencraft.book_binder.grammar.conflict": "Page %s: replace the conflicting symbol",
|
||||||
"screen.rivencraft.book_binder.grammar.out_of_order": "Page %s: move this symbol before later categories",
|
"screen.rivencraft.book_binder.grammar.out_of_order": "Page %s: move this symbol before later categories",
|
||||||
@@ -87,7 +88,6 @@
|
|||||||
"screen.rivencraft.age.pages": "Pages",
|
"screen.rivencraft.age.pages": "Pages",
|
||||||
"screen.rivencraft.age.details": "Details",
|
"screen.rivencraft.age.details": "Details",
|
||||||
"screen.rivencraft.age.pages_count": "Writing %s/%s",
|
"screen.rivencraft.age.pages_count": "Writing %s/%s",
|
||||||
"screen.rivencraft.age.pages_not_applied": "Symbols not applied yet",
|
|
||||||
"screen.rivencraft.age.trait.biomes": "Biomes: %s",
|
"screen.rivencraft.age.trait.biomes": "Biomes: %s",
|
||||||
"screen.rivencraft.age.trait.lighting": "Lighting: %s",
|
"screen.rivencraft.age.trait.lighting": "Lighting: %s",
|
||||||
"screen.rivencraft.age.trait.weather": "Weather: %s",
|
"screen.rivencraft.age.trait.weather": "Weather: %s",
|
||||||
@@ -167,10 +167,46 @@
|
|||||||
"symbol.rivencraft.biome.huge.description": "Distribute selected biomes in huge regions.",
|
"symbol.rivencraft.biome.huge.description": "Distribute selected biomes in huge regions.",
|
||||||
"symbol.rivencraft.lighting.normal": "Normal Lighting",
|
"symbol.rivencraft.lighting.normal": "Normal Lighting",
|
||||||
"symbol.rivencraft.lighting.normal.description": "Use normal skylight and ambient brightness.",
|
"symbol.rivencraft.lighting.normal.description": "Use normal skylight and ambient brightness.",
|
||||||
|
"symbol.rivencraft.lighting.dark": "Dark Lighting",
|
||||||
|
"symbol.rivencraft.lighting.dark.description": "Remove skylight from this Age.",
|
||||||
|
"symbol.rivencraft.lighting.bright": "Bright Lighting",
|
||||||
|
"symbol.rivencraft.lighting.bright.description": "Increase this Age's ambient brightness.",
|
||||||
|
"symbol.rivencraft.sky.overworld": "Overworld Sky",
|
||||||
|
"symbol.rivencraft.sky.overworld.description": "Use the Overworld sky and biome sky tint.",
|
||||||
|
"symbol.rivencraft.sky.nether": "Nether Sky",
|
||||||
|
"symbol.rivencraft.sky.nether.description": "Use the Nether sky and red preview background.",
|
||||||
|
"symbol.rivencraft.sky.end": "End Sky",
|
||||||
|
"symbol.rivencraft.sky.end.description": "Use the End sky and dark preview background.",
|
||||||
"symbol.rivencraft.weather.normal": "Normal Weather",
|
"symbol.rivencraft.weather.normal": "Normal Weather",
|
||||||
"symbol.rivencraft.weather.normal.description": "Use the normal weather cycle.",
|
"symbol.rivencraft.weather.normal.description": "Use the normal weather cycle.",
|
||||||
|
"symbol.rivencraft.weather.fast": "Fast Weather",
|
||||||
|
"symbol.rivencraft.weather.fast.description": "Change weather more quickly.",
|
||||||
|
"symbol.rivencraft.weather.slow": "Slow Weather",
|
||||||
|
"symbol.rivencraft.weather.slow.description": "Change weather more slowly.",
|
||||||
|
"symbol.rivencraft.weather.off": "No Weather",
|
||||||
|
"symbol.rivencraft.weather.off.description": "Keep the Age clear.",
|
||||||
|
"symbol.rivencraft.weather.always": "Always Weather",
|
||||||
|
"symbol.rivencraft.weather.always.description": "Keep the Age rainy.",
|
||||||
|
"symbol.rivencraft.weather.storm": "Storm Weather",
|
||||||
|
"symbol.rivencraft.weather.storm.description": "Keep the Age rainy and thundering.",
|
||||||
"symbol.rivencraft.celestial.normal_time": "Normal Time",
|
"symbol.rivencraft.celestial.normal_time": "Normal Time",
|
||||||
"symbol.rivencraft.celestial.normal_time.description": "Use a normal-length celestial cycle.",
|
"symbol.rivencraft.celestial.normal_time.description": "Use a normal-length celestial cycle.",
|
||||||
|
"symbol.rivencraft.period.zero": "Zero Length",
|
||||||
|
"symbol.rivencraft.period.zero.description": "Stop the celestial cycle at its written phase.",
|
||||||
|
"symbol.rivencraft.period.half": "Half Length",
|
||||||
|
"symbol.rivencraft.period.half.description": "Use a half-length celestial cycle.",
|
||||||
|
"symbol.rivencraft.period.full": "Full Length",
|
||||||
|
"symbol.rivencraft.period.full.description": "Use a normal-length celestial cycle.",
|
||||||
|
"symbol.rivencraft.period.double": "Double Length",
|
||||||
|
"symbol.rivencraft.period.double.description": "Use a double-length celestial cycle.",
|
||||||
|
"symbol.rivencraft.phase.nadir": "Nadir Phase",
|
||||||
|
"symbol.rivencraft.phase.nadir.description": "Set the celestial phase to nadir.",
|
||||||
|
"symbol.rivencraft.phase.rising": "Rising Phase",
|
||||||
|
"symbol.rivencraft.phase.rising.description": "Set the celestial phase to rising.",
|
||||||
|
"symbol.rivencraft.phase.zenith": "Zenith Phase",
|
||||||
|
"symbol.rivencraft.phase.zenith.description": "Set the celestial phase to zenith.",
|
||||||
|
"symbol.rivencraft.phase.setting": "Setting Phase",
|
||||||
|
"symbol.rivencraft.phase.setting.description": "Set the celestial phase to setting.",
|
||||||
"symbol.rivencraft.feature.caves": "Caves",
|
"symbol.rivencraft.feature.caves": "Caves",
|
||||||
"symbol.rivencraft.feature.caves.description": "Describe underground cave features.",
|
"symbol.rivencraft.feature.caves.description": "Describe underground cave features.",
|
||||||
"generator.rivencraft.standard": "Standard",
|
"generator.rivencraft.standard": "Standard",
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema_version":2,"name":"symbol.rivencraft.lighting.bright","description":"symbol.rivencraft.lighting.bright.description","category":"rivencraft:lighting","semantics":{"role":"lighting","value":"bright"},"poem":"Ethereal Sustain Cycle Balance"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema_version":2,"name":"symbol.rivencraft.lighting.dark","description":"symbol.rivencraft.lighting.dark.description","category":"rivencraft:lighting","semantics":{"role":"lighting","value":"dark"},"poem":"Ethereal Void Cycle Balance"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema_version":2,"name":"symbol.rivencraft.period.double","description":"symbol.rivencraft.period.double.description","category":"rivencraft:celestial","semantics":{"role":"period_modifier","value":2.0},"poem":"Transform Time Cycle Dynamic"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema_version":2,"name":"symbol.rivencraft.period.full","description":"symbol.rivencraft.period.full.description","category":"rivencraft:celestial","semantics":{"role":"period_modifier","value":1.0},"poem":"Transform Time Cycle Balance"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema_version":2,"name":"symbol.rivencraft.period.half","description":"symbol.rivencraft.period.half.description","category":"rivencraft:celestial","semantics":{"role":"period_modifier","value":0.5},"poem":"Transform Time Cycle Constraint"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema_version":2,"name":"symbol.rivencraft.period.zero","description":"symbol.rivencraft.period.zero.description","category":"rivencraft:celestial","semantics":{"role":"period_modifier","value":0.0},"poem":"Transform Time Void Balance"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema_version":2,"name":"symbol.rivencraft.phase.nadir","description":"symbol.rivencraft.phase.nadir.description","category":"rivencraft:celestial","semantics":{"role":"phase_modifier","value":0.0},"poem":"Transform Time Void Tradition"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema_version":2,"name":"symbol.rivencraft.phase.rising","description":"symbol.rivencraft.phase.rising.description","category":"rivencraft:celestial","semantics":{"role":"phase_modifier","value":90.0},"poem":"Transform Time Flow Tradition"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema_version":2,"name":"symbol.rivencraft.phase.setting","description":"symbol.rivencraft.phase.setting.description","category":"rivencraft:celestial","semantics":{"role":"phase_modifier","value":270.0},"poem":"Transform Time Nature Tradition"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema_version":2,"name":"symbol.rivencraft.phase.zenith","description":"symbol.rivencraft.phase.zenith.description","category":"rivencraft:celestial","semantics":{"role":"phase_modifier","value":180.0},"poem":"Transform Time Ethereal Tradition"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema_version":2,"name":"symbol.rivencraft.sky.end","description":"symbol.rivencraft.sky.end.description","category":"rivencraft:sky","semantics":{"role":"sky","value":"end"},"poem":"Ethereal Void Sky Balance"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema_version":2,"name":"symbol.rivencraft.sky.nether","description":"symbol.rivencraft.sky.nether.description","category":"rivencraft:sky","semantics":{"role":"sky","value":"nether"},"poem":"Ethereal Void Sky Transform"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema_version":2,"name":"symbol.rivencraft.sky.overworld","description":"symbol.rivencraft.sky.overworld.description","category":"rivencraft:sky","semantics":{"role":"sky","value":"overworld"},"poem":"Ethereal Nature Sky Balance"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema_version":2,"name":"symbol.rivencraft.weather.always","description":"symbol.rivencraft.weather.always.description","category":"rivencraft:weather","semantics":{"role":"weather","value":"always"},"poem":"Sustain Flow Cycle Tradition"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema_version":2,"name":"symbol.rivencraft.weather.fast","description":"symbol.rivencraft.weather.fast.description","category":"rivencraft:weather","semantics":{"role":"weather","value":"fast"},"poem":"Sustain Dynamic Flow Transform"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema_version":2,"name":"symbol.rivencraft.weather.off","description":"symbol.rivencraft.weather.off.description","category":"rivencraft:weather","semantics":{"role":"weather","value":"off"},"poem":"Sustain Void Flow Balance"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema_version":2,"name":"symbol.rivencraft.weather.slow","description":"symbol.rivencraft.weather.slow.description","category":"rivencraft:weather","semantics":{"role":"weather","value":"slow"},"poem":"Sustain Dynamic Flow Balance"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema_version":2,"name":"symbol.rivencraft.weather.storm","description":"symbol.rivencraft.weather.storm.description","category":"rivencraft:weather","semantics":{"role":"weather","value":"storm"},"poem":"Sustain Nature Flow Dynamic"}
|
||||||
Reference in new issue
Block a user