Public Access
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6dbe208c42 | ||
|
|
a9a6f7205d | ||
|
|
98a959f621 |
No files matched your search
@@ -65,6 +65,65 @@ writing. Each unpaired material gets its own compatible feature, and repeated
|
||||
decorations use separate placement rolls. Repeated unmodified feature pages
|
||||
choose different compatible materials until their material pool is exhausted.
|
||||
|
||||
Structure pages are separate Feature symbols. Legacy's Dungeons, Mineshafts,
|
||||
Nether Fortresses, Strongholds, and Villages have writable pages, as do modern
|
||||
Trial Chambers, Bastion Remnants, Buried Treasure, Shipwrecks, Ocean Ruins,
|
||||
Pillager Outposts, Ruined Portals, Nether Fossils, Ancient Cities, and Trail
|
||||
Ruins. They use Minecraft's 1.21.1 structure templates and placement rules,
|
||||
not a recreation of 1.12.2 structure geometry. A page enables only its own
|
||||
structure set; absent pages do not inherit these structures from a biome.
|
||||
Nether Fortresses and Bastions use separate sets instead of vanilla's shared
|
||||
Nether-complexes set, so writing one does not enable the other. Dungeons use
|
||||
the vanilla monster-room feature with eight attempts per chunk; unpaged Ages
|
||||
do not inherit biome-default monster-room attempts. A page-free random Age
|
||||
may choose zero to two distinct compatible structure types, frozen on creation.
|
||||
An authored structure needs a compatible biome in the Age's selected pool.
|
||||
Fortresses, Bastions, and Nether Fossils require Cave terrain plus a Nether
|
||||
biome; surface-only structures reject Cave terrain. Void rejects all of these
|
||||
structure pages. Villages and Strongholds can also be written into Flat Ages.
|
||||
|
||||
For visual testing, write a Standard/Plains/Single Age with Mineshafts,
|
||||
Villages, and Trial Chambers, then use `/locate structure` in that Age to find
|
||||
each. An unwritten Pillager Outpost should not locate there. Test a Cave Age
|
||||
with Nether Wastes/Single and either the Nether Fortresses or Bastion page:
|
||||
only the selected type should locate. Ocean structures need their matching
|
||||
ocean or beach biome page; Ancient Cities need Deep Dark. Check the new pages
|
||||
in Rivencraft's Feature creative tab and JEI as well.
|
||||
|
||||
**Dense Ores** is an authored-only Feature page. Each copy replays one extra
|
||||
pass of every ore placement registered in the Age's nearby biomes, using that
|
||||
placement's existing height, vein-size, rarity, and biome rules. It therefore
|
||||
also densifies conventional mod-added ores without hard-coded mod IDs. Output
|
||||
blocks tagged `c:ores` qualify; OreConfiguration outputs with `_ore` in their
|
||||
registry name also qualify. A mod with a custom, non-OreConfiguration placed
|
||||
feature can opt in by tagging that feature `rivencraft:dense_ores`. Non-ore
|
||||
stone/dirt blobs are not repeated. Flat and Void reject the page, as does a
|
||||
biome pool without any ore placements. Page-free random Ages never roll Dense
|
||||
Ores. The extra pass applies only as new chunks generate; it does not retrofit
|
||||
existing chunks or discover ore systems that bypass biome placed features.
|
||||
|
||||
For an in-game check, write a Standard/Plains/Single Age with Dense Ores and
|
||||
verify that new underground chunks contain visibly more vanilla ore while
|
||||
stone/dirt blob frequency remains unchanged. With an ore-adding mod installed,
|
||||
write an Age using a biome where that mod registers its ore and verify the ore
|
||||
also appears more often. Check that Flat plus Dense Ores is rejected by the
|
||||
Binder and that a random, Link-Panel-only Age has no Dense Ores feature page.
|
||||
|
||||
**Obelisks** adds Legacy-shaped, rare 4×4 plinths with a 2×2 shaft rising 12
|
||||
blocks, at most one attempt per 128 chunks per page. A preceding full-block
|
||||
Block page chooses the material; otherwise the Age seed chooses from valid
|
||||
block pages. Repeated Obelisks pages make independent attempts. Generation is
|
||||
deterministic and stays within one chunk; it requires a reasonably level,
|
||||
exposed solid surface, so Cave and Void terrain reject the page. Standard,
|
||||
Amplified, Sky Islands, and Flat terrain permit it. Page-free random surface
|
||||
Ages can roll Obelisks as one of their material features.
|
||||
|
||||
For a visual check, write a Standard or Flat Age with an Obelisks page and
|
||||
search newly generated terrain for the 4×4 base and 12-block shaft. Try a
|
||||
Block page such as Obsidian immediately before Obelisks to verify its material
|
||||
changes. The Binder should reject Obelisks in Cave and Void Ages. Placement
|
||||
is deliberately rare, so several hundred fresh chunks may be needed.
|
||||
|
||||
For an in-game visual check, bind Descriptive Books with a Link Panel,
|
||||
one of Standard, Amplified, Sky Islands, Flat, or Void terrain, and the Floating Islands
|
||||
feature page in that order. Fly through each Age at roughly Y=170–220 and
|
||||
|
||||
@@ -18,7 +18,7 @@ Legacy does **not** reject a book just because it omits terrain, biome, weather,
|
||||
| `WeatherNorm`, `Fast`, `Slow`, `Off`, `On`, `Cloudy`, `Rain`, `Snow`, `Storm` | `AgeTraits.Weather` has matching names except Legacy `On` maps to `ALWAYS` | Compile weather semantics separately from biome selection. `Snow` must remain deferred until optional season integration; do not silently substitute another weather mode. |
|
||||
| Suns, moons, starfields; angle, phase, period, color/gradient/sunset modifiers | One `celestialPeriod`, `celestialAngle`, `celestialPhase` on `AgeTraits` | Compile only the representable single-cycle subset first. Multiple celestial bodies, independent periods, custom stars, gradients and sunsets need a richer definition and renderer, not flattening into one value. |
|
||||
| Sky/fog/cloud/grass/foliage/water colors, natural variants, horizon, rainbow | Existing sky/dimension visuals and preview | Require an explicit modern client/biome-color design; metadata-only symbol pages must not pretend to change rendering. |
|
||||
| Caves, ores, huge trees, lakes, floating islands, tendrils, skylands, spheres, spikes, crystals; vanilla villages, strongholds, mineshafts, dungeons, fortresses, obelisks, fissures | Current cave profile, vanilla data-pack generation, and authored Floating Islands/Tendrils/Skylands/Spheres/Spikes | Compile supported vanilla placements and port bespoke shapes explicitly. Remaining bespoke structures and polish stay in later issues. |
|
||||
| Caves, ores, huge trees, lakes, floating islands, tendrils, skylands, spheres, spikes, crystals; vanilla villages, strongholds, mineshafts, dungeons, fortresses, obelisks, fissures | Current cave profile, authored Floating Islands/Tendrils/Skylands/Spheres/Spikes/Obelisks and Dense Ores, and page-gated vanilla Dungeons/Mineshafts/Nether Fortresses/Strongholds/Villages | The five Legacy vanilla structure symbols gate Minecraft 1.21.1 generation. Dungeons use monster-room placement; the others use vanilla structure sets. Obelisks use a bespoke 4×4 plinth and 2×12×2 shaft with safe modern placement. Fissures, crystals, and exact 1.12 structure geometry remain separate work. |
|
||||
| `EnvAccel`, explosions, lightning, meteors, scorching; PvP and dummy suppression pages | No equivalent Age-definition effect | Defer environmental hazards/instability effects to milestone 6, PvP rule to a separately scoped server policy; retain authored IDs without fake behavior. |
|
||||
|
||||
The Legacy symbol list and page names come from [ModSymbols](https://github.com/Mystcraft/Mystcraft-Legacy/blob/9bc8ddc061845df0cd5ea47f4fdef773cff786ae/src/main/java/com/xcompwiz/mystcraft/data/ModSymbols.java#L129-L240) and [SymbolRules](https://github.com/Mystcraft/Mystcraft-Legacy/blob/9bc8ddc061845df0cd5ea47f4fdef773cff786ae/src/main/java/com/xcompwiz/mystcraft/data/SymbolRules.java#L19-L137). Rivencraft's [catalog](../src/main/java/net/dnorberg/rivencraft/writing/SymbolCatalog.java) currently holds display metadata only; its built-in set is just standard terrain, native biomes, normal weather, normal lighting, normal time, and caves. [OrderedWriting](../src/main/java/net/dnorberg/rivencraft/writing/OrderedWriting.java) preserves page order, but no compiler yet connects it to [AgeTraits](../src/main/java/net/dnorberg/rivencraft/book/AgeTraits.java) or [Age profiles](AGE_PROFILES.md).
|
||||
|
||||
+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.
|
||||
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.4.14.0
|
||||
mod_version=0.4.17.0
|
||||
immersive_portals_version=6.0.7
|
||||
terrablender_version=4.1.0.8
|
||||
serene_seasons_version_id=B6nTjh4b
|
||||
|
||||
@@ -329,7 +329,8 @@ public final class AgeDimensionService {
|
||||
Registries.NOISE_SETTINGS, profile.noiseSettings());
|
||||
NoiseGeneratorSettings baseSettings = noiseSettings.getOrThrow(settingsKey).value();
|
||||
Holder<NoiseGeneratorSettings> settings = Holder.direct(withBiomeMaterialRules(baseSettings));
|
||||
return features.isEmpty() ? new NoiseBasedChunkGenerator(biomeSource, settings)
|
||||
return age.generationVersion() < AgeDefinition.CURRENT_GENERATION_VERSION
|
||||
? new NoiseBasedChunkGenerator(biomeSource, settings)
|
||||
: new AgeFeatureChunkGenerator(biomeSource, settings, features, age.seed());
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,10 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import net.dnorberg.rivencraft.writing.BlockSymbolPages;
|
||||
import net.dnorberg.rivencraft.writing.OrderedWriting;
|
||||
import net.dnorberg.rivencraft.writing.SymbolSemantics;
|
||||
import net.dnorberg.rivencraft.writing.WritingGrammar;
|
||||
import net.dnorberg.rivencraft.world.AgeDenseOres;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
@@ -25,7 +27,8 @@ import net.minecraft.world.level.block.Blocks;
|
||||
/** Validates and freezes supported feature pages and their preceding material modifiers. */
|
||||
public final class AgeFeatureSelection {
|
||||
private static final List<ResourceLocation> BLOCK_FEATURES = List.of(
|
||||
id("rocks"), id("floating_islands"), id("tendrils"), id("spheres"), id("spikes"));
|
||||
id("rocks"), id("floating_islands"), id("tendrils"), id("spheres"), id("spikes"),
|
||||
id("obelisks"));
|
||||
private static final List<ResourceLocation> FLUID_FEATURES = List.of(
|
||||
id("surface_lakes"), id("deep_lakes"), id("lava_lakes"));
|
||||
private static final long RANDOM_SKYLANDS_SALT = 0x534B594C414E4453L;
|
||||
@@ -49,6 +52,10 @@ public final class AgeFeatureSelection {
|
||||
.map(symbol -> symbol.semantics()).toList(), profile, ageSeed);
|
||||
for (Choice choice : choices) {
|
||||
String error = error(choice.id(), profile, registries);
|
||||
if (error == null && AgeStructureSelection.feature(choice.id()))
|
||||
error = AgeStructureSelection.error(choice.id(), profile, biomes, registries);
|
||||
if (error == null && choice.id().equals(AgeDenseOres.ID))
|
||||
error = AgeDenseOres.error(profile, biomes, registries);
|
||||
if (error == null) error = materialError(choice);
|
||||
if (error != null) throw new IllegalArgumentException(error);
|
||||
if (surfaceVegetation(choice.id()) && biomes.biomes().stream()
|
||||
@@ -115,6 +122,8 @@ public final class AgeFeatureSelection {
|
||||
|
||||
private static boolean compatible(ResourceLocation feature, AgeRuntimeProfile profile) {
|
||||
if (tendrils(feature) || spheres(feature)) return true;
|
||||
if (obelisks(feature)) return !AgeBiomeSelection.isCave(profile)
|
||||
&& profile.terrain() != AgeRuntimeProfile.Terrain.VOID;
|
||||
if (AgeBiomeSelection.isCave(profile)) return false;
|
||||
if (spikes(feature)) return profile.terrain() != AgeRuntimeProfile.Terrain.VOID;
|
||||
return floatingIslands(feature) || profile.terrain() == AgeRuntimeProfile.Terrain.NOISE;
|
||||
@@ -130,7 +139,8 @@ public final class AgeFeatureSelection {
|
||||
if (choice.material().isPresent()
|
||||
|| !isRock(choice.id()) && !isLake(choice.id())
|
||||
&& !floatingIslands(choice.id()) && !tendrils(choice.id())
|
||||
&& !spheres(choice.id()) && !spikes(choice.id())) {
|
||||
&& !spheres(choice.id()) && !spikes(choice.id())
|
||||
&& !obelisks(choice.id())) {
|
||||
resolved.add(choice);
|
||||
continue;
|
||||
}
|
||||
@@ -163,6 +173,9 @@ public final class AgeFeatureSelection {
|
||||
if (profile.terrain() == AgeRuntimeProfile.Terrain.NOISE
|
||||
&& Math.floorMod(mix(ageSeed ^ RANDOM_SKYLANDS_SALT), 8) == 0)
|
||||
choices.add(new Choice(id("skylands"), Optional.empty()));
|
||||
AgeBiomeSelection biomes = AgeBiomeSelection.compile(WritingGrammar.parse(OrderedWriting.EMPTY),
|
||||
AgeTraits.select(ageSeed), profile, ageSeed, registries);
|
||||
choices.addAll(AgeStructureSelection.randomChoices(ageSeed, profile, biomes, registries));
|
||||
return List.copyOf(choices);
|
||||
}
|
||||
|
||||
@@ -187,6 +200,10 @@ public final class AgeFeatureSelection {
|
||||
}
|
||||
|
||||
public static String error(ResourceLocation choice, AgeRuntimeProfile profile, RegistryAccess registries) {
|
||||
if (AgeStructureSelection.feature(choice))
|
||||
return AgeStructureSelection.error(choice, profile, null, registries);
|
||||
if (choice.equals(AgeDenseOres.ID))
|
||||
return AgeDenseOres.error(profile, null, registries);
|
||||
if (skylands(choice)) return null;
|
||||
if (tendrils(choice)) return null;
|
||||
if (spheres(choice)) return null;
|
||||
@@ -195,6 +212,11 @@ public final class AgeFeatureSelection {
|
||||
return "Feature " + choice + " needs an exposed solid surface, not Cave or Void terrain";
|
||||
return null;
|
||||
}
|
||||
if (obelisks(choice)) {
|
||||
if (AgeBiomeSelection.isCave(profile) || profile.terrain() == AgeRuntimeProfile.Terrain.VOID)
|
||||
return "Feature " + choice + " needs exposed solid surface terrain, not Cave or Void";
|
||||
return null;
|
||||
}
|
||||
if (floatingIslands(choice)) {
|
||||
if (AgeBiomeSelection.isCave(profile))
|
||||
return "Feature " + choice + " cannot form above Cave terrain";
|
||||
@@ -285,9 +307,13 @@ public final class AgeFeatureSelection {
|
||||
return choice.equals(id("spikes"));
|
||||
}
|
||||
|
||||
public static boolean obelisks(ResourceLocation choice) {
|
||||
return choice.equals(id("obelisks"));
|
||||
}
|
||||
|
||||
private static boolean solidFeature(ResourceLocation choice) {
|
||||
return isRock(choice) || floatingIslands(choice) || tendrils(choice)
|
||||
|| spheres(choice) || spikes(choice);
|
||||
|| spheres(choice) || spikes(choice) || obelisks(choice);
|
||||
}
|
||||
|
||||
public static boolean skylands(ResourceLocation choice) {
|
||||
@@ -313,6 +339,7 @@ public final class AgeFeatureSelection {
|
||||
case "trees" -> ResourceLocation.withDefaultNamespace("trees_plains");
|
||||
case "huge_trees" -> ResourceLocation.withDefaultNamespace("trees_old_growth_spruce_taiga");
|
||||
case "rocks" -> ResourceLocation.withDefaultNamespace("forest_rock");
|
||||
case "dungeons" -> ResourceLocation.fromNamespaceAndPath("rivencraft", "dungeons");
|
||||
case "surface_lakes", "lava_lakes" -> ResourceLocation.withDefaultNamespace("lake_lava_surface");
|
||||
case "deep_lakes" -> ResourceLocation.withDefaultNamespace("lake_lava_underground");
|
||||
default -> null;
|
||||
|
||||
@@ -74,12 +74,16 @@ public final class AgePersistenceGameTests {
|
||||
helper.assertTrue(age.randomFeatures().stream().filter(choice ->
|
||||
AgeFeatureSelection.skylands(choice.id())).count() <= 1,
|
||||
"A random Age may roll at most one Skylands filter");
|
||||
helper.assertTrue(age.randomFeatures().stream().filter(choice ->
|
||||
AgeStructureSelection.feature(choice.id())).count() <= 2,
|
||||
"A random Age may roll at most two distinct structure features");
|
||||
for (AgeFeatureSelection.Choice choice : age.randomFeatures()) {
|
||||
helper.assertTrue(AgeFeatureSelection.skylands(choice.id())
|
||||
|| AgeStructureSelection.feature(choice.id())
|
||||
? choice.material().isEmpty()
|
||||
: choice.material().isPresent()
|
||||
&& AgeFeatureSelection.materialError(choice) == null,
|
||||
"Random material features, including Spheres and Spikes, need valid blocks or fluids; Skylands needs none");
|
||||
"Random material features need valid blocks or fluids; Skylands and structures need none");
|
||||
}
|
||||
}
|
||||
AgeRegistrySavedData registry = AgeRegistrySavedData.get(helper.getLevel());
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
package net.dnorberg.rivencraft.book;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import net.dnorberg.rivencraft.Rivencraft;
|
||||
import net.dnorberg.rivencraft.writing.OrderedWriting;
|
||||
import net.dnorberg.rivencraft.writing.SymbolReference;
|
||||
import net.dnorberg.rivencraft.writing.WritingEntry;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.gametest.framework.GameTest;
|
||||
import net.minecraft.gametest.framework.GameTestHelper;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.levelgen.structure.BuiltinStructureSets;
|
||||
import net.minecraft.world.level.levelgen.structure.StructureSet;
|
||||
import net.neoforged.neoforge.gametest.GameTestHolder;
|
||||
import net.neoforged.neoforge.gametest.PrefixGameTestTemplate;
|
||||
|
||||
/** Authored structure pages gate their own structure sets without enabling unrelated structures. */
|
||||
@GameTestHolder(Rivencraft.MOD_ID)
|
||||
@PrefixGameTestTemplate(false)
|
||||
public final class AgeStructureGameTests {
|
||||
private static final Map<String, ResourceLocation> SETS = Map.ofEntries(
|
||||
Map.entry("mineshafts", BuiltinStructureSets.MINESHAFTS.location()),
|
||||
Map.entry("nether_fortresses", id("fortresses")),
|
||||
Map.entry("strongholds", BuiltinStructureSets.STRONGHOLDS.location()),
|
||||
Map.entry("villages", BuiltinStructureSets.VILLAGES.location()),
|
||||
Map.entry("trial_chambers", BuiltinStructureSets.TRIAL_CHAMBERS.location()),
|
||||
Map.entry("bastions", id("bastions")),
|
||||
Map.entry("buried_treasure", BuiltinStructureSets.BURIED_TREASURES.location()),
|
||||
Map.entry("shipwrecks", BuiltinStructureSets.SHIPWRECKS.location()),
|
||||
Map.entry("ocean_ruins", BuiltinStructureSets.OCEAN_RUINS.location()),
|
||||
Map.entry("pillager_outposts", BuiltinStructureSets.PILLAGER_OUTPOSTS.location()),
|
||||
Map.entry("ruined_portals", BuiltinStructureSets.RUINED_PORTALS.location()),
|
||||
Map.entry("nether_fossils", BuiltinStructureSets.NETHER_FOSSILS.location()),
|
||||
Map.entry("ancient_cities", BuiltinStructureSets.ANCIENT_CITIES.location()),
|
||||
Map.entry("trail_ruins", BuiltinStructureSets.TRAIL_RUINS.location()));
|
||||
|
||||
private AgeStructureGameTests() {}
|
||||
|
||||
@GameTest(template = "empty")
|
||||
public static void structurePagesGateDistinctVanillaSets(GameTestHelper helper) {
|
||||
var lookup = helper.getLevel().registryAccess().lookupOrThrow(Registries.STRUCTURE_SET);
|
||||
for (var entry : SETS.entrySet()) {
|
||||
var setKey = ResourceKey.create(Registries.STRUCTURE_SET, entry.getValue());
|
||||
helper.assertTrue(lookup.get(setKey).isPresent(), entry.getKey() + " needs a registered structure set");
|
||||
var filtered = AgeStructureSelection.filteredLookup(lookup,
|
||||
List.of(new AgeFeatureSelection.Choice(id(entry.getKey()), Optional.empty())));
|
||||
helper.assertTrue(filtered.get(setKey).isPresent(), entry.getKey() + " must enable its structure set");
|
||||
helper.assertTrue(filtered.get(ResourceKey.create(Registries.STRUCTURE_SET,
|
||||
BuiltinStructureSets.NETHER_COMPLEXES.location())).isEmpty(),
|
||||
"Vanilla Nether complexes must stay disabled to keep fortresses and bastions separate");
|
||||
for (var other : SETS.entrySet()) {
|
||||
if (other.getKey().equals(entry.getKey())) continue;
|
||||
helper.assertTrue(filtered.get(ResourceKey.create(Registries.STRUCTURE_SET,
|
||||
other.getValue())).isEmpty(),
|
||||
entry.getKey() + " must not enable " + other.getKey());
|
||||
}
|
||||
}
|
||||
helper.assertTrue(AgeStructureSelection.filteredLookup(lookup, List.of()).listElements()
|
||||
.noneMatch(holder -> SETS.containsValue(holder.key().location())),
|
||||
"An Age without structure pages must not inherit these structures from vanilla biomes");
|
||||
helper.succeed();
|
||||
}
|
||||
|
||||
@GameTest(template = "empty")
|
||||
public static void authoredPagesPersistAndRejectIncompatibleTerrain(GameTestHelper helper) {
|
||||
var registries = helper.getLevel().registryAccess();
|
||||
OrderedWriting written = new OrderedWriting(List.of(WritingEntry.linkPanel(), page("terrain/standard"),
|
||||
page("biome/plains"), page("biome/single"), page("feature/mineshafts"),
|
||||
page("feature/villages"), page("feature/trial_chambers")));
|
||||
AgeGenerationPlan plan = AgeGenerationPlan.compile(written, 149L, AgeGenerationProfiles.STANDARD,
|
||||
AgeTraits.select(149L), registries);
|
||||
List<AgeFeatureSelection.Choice> expected = AgeFeatureSelection.resolved(plan);
|
||||
helper.assertValueEqual(expected.stream().map(AgeFeatureSelection.Choice::id).toList(),
|
||||
List.of(id("mineshafts"), id("villages"), id("trial_chambers")),
|
||||
"Authored structure pages must retain their order");
|
||||
helper.assertValueEqual(AgeFeatureSelection.resolved(AgeGenerationPlan.load(plan.save())), expected,
|
||||
"Authored structure choices must survive an Age plan reload");
|
||||
var filtered = AgeStructureSelection.filteredLookup(registries.lookupOrThrow(Registries.STRUCTURE_SET), expected);
|
||||
helper.assertTrue(filtered.get(ResourceKey.create(Registries.STRUCTURE_SET,
|
||||
BuiltinStructureSets.VILLAGES.location())).isPresent(), "Village set must be enabled");
|
||||
helper.assertTrue(filtered.get(ResourceKey.create(Registries.STRUCTURE_SET,
|
||||
BuiltinStructureSets.PILLAGER_OUTPOSTS.location())).isEmpty(), "Unwritten outposts must stay disabled");
|
||||
String error = AgeStructureSelection.error(id("bastions"),
|
||||
AgeRuntimeProfiles.profiles().get(id("standard")), null, registries);
|
||||
helper.assertTrue(error != null && error.contains("Cave terrain"),
|
||||
"Bastion page must not silently run on Standard terrain");
|
||||
helper.succeed();
|
||||
}
|
||||
|
||||
private static ResourceLocation id(String path) {
|
||||
return ResourceLocation.fromNamespaceAndPath(Rivencraft.MOD_ID, path);
|
||||
}
|
||||
|
||||
private static WritingEntry page(String path) {
|
||||
return WritingEntry.symbol(new SymbolReference(id(path)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
package net.dnorberg.rivencraft.book;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.HolderSet;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.level.levelgen.structure.BuiltinStructureSets;
|
||||
import net.minecraft.world.level.levelgen.structure.StructureSet;
|
||||
|
||||
/** Frozen Age structure-page choices and their vanilla structure-set gate. */
|
||||
public final class AgeStructureSelection {
|
||||
private static final ResourceLocation FORTRESSES = ResourceLocation.fromNamespaceAndPath("rivencraft", "fortresses");
|
||||
private static final ResourceLocation BASTIONS = ResourceLocation.fromNamespaceAndPath("rivencraft", "bastions");
|
||||
private static final List<ResourceLocation> FEATURES = List.of(
|
||||
id("dungeons"), id("mineshafts"), id("nether_fortresses"), id("strongholds"),
|
||||
id("villages"), id("trial_chambers"), id("bastions"), id("buried_treasure"),
|
||||
id("shipwrecks"), id("ocean_ruins"), id("pillager_outposts"), id("ruined_portals"),
|
||||
id("nether_fossils"), id("ancient_cities"), id("trail_ruins"));
|
||||
private static final Map<ResourceLocation, ResourceLocation> STRUCTURE_SETS = Map.ofEntries(
|
||||
Map.entry(id("mineshafts"), BuiltinStructureSets.MINESHAFTS.location()),
|
||||
Map.entry(id("nether_fortresses"), FORTRESSES),
|
||||
Map.entry(id("strongholds"), BuiltinStructureSets.STRONGHOLDS.location()),
|
||||
Map.entry(id("villages"), BuiltinStructureSets.VILLAGES.location()),
|
||||
Map.entry(id("trial_chambers"), BuiltinStructureSets.TRIAL_CHAMBERS.location()),
|
||||
Map.entry(id("bastions"), BASTIONS),
|
||||
Map.entry(id("buried_treasure"), BuiltinStructureSets.BURIED_TREASURES.location()),
|
||||
Map.entry(id("shipwrecks"), BuiltinStructureSets.SHIPWRECKS.location()),
|
||||
Map.entry(id("ocean_ruins"), BuiltinStructureSets.OCEAN_RUINS.location()),
|
||||
Map.entry(id("pillager_outposts"), BuiltinStructureSets.PILLAGER_OUTPOSTS.location()),
|
||||
Map.entry(id("ruined_portals"), BuiltinStructureSets.RUINED_PORTALS.location()),
|
||||
Map.entry(id("nether_fossils"), BuiltinStructureSets.NETHER_FOSSILS.location()),
|
||||
Map.entry(id("ancient_cities"), BuiltinStructureSets.ANCIENT_CITIES.location()),
|
||||
Map.entry(id("trail_ruins"), BuiltinStructureSets.TRAIL_RUINS.location()));
|
||||
private static final Set<ResourceLocation> CONTROLLED_SETS = Set.of(
|
||||
BuiltinStructureSets.MINESHAFTS.location(), BuiltinStructureSets.NETHER_COMPLEXES.location(),
|
||||
BuiltinStructureSets.STRONGHOLDS.location(), BuiltinStructureSets.VILLAGES.location(),
|
||||
BuiltinStructureSets.TRIAL_CHAMBERS.location(), FORTRESSES, BASTIONS,
|
||||
BuiltinStructureSets.BURIED_TREASURES.location(), BuiltinStructureSets.SHIPWRECKS.location(),
|
||||
BuiltinStructureSets.OCEAN_RUINS.location(), BuiltinStructureSets.PILLAGER_OUTPOSTS.location(),
|
||||
BuiltinStructureSets.RUINED_PORTALS.location(), BuiltinStructureSets.NETHER_FOSSILS.location(),
|
||||
BuiltinStructureSets.ANCIENT_CITIES.location(), BuiltinStructureSets.TRAIL_RUINS.location());
|
||||
|
||||
private AgeStructureSelection() {}
|
||||
|
||||
private static ResourceLocation id(String path) {
|
||||
return ResourceLocation.fromNamespaceAndPath("rivencraft", path);
|
||||
}
|
||||
|
||||
public static boolean feature(ResourceLocation id) {
|
||||
return FEATURES.contains(id);
|
||||
}
|
||||
|
||||
public static boolean dungeons(ResourceLocation id) {
|
||||
return id.equals(id("dungeons"));
|
||||
}
|
||||
|
||||
private static ResourceLocation setId(ResourceLocation feature) {
|
||||
return STRUCTURE_SETS.get(feature);
|
||||
}
|
||||
|
||||
public static String error(ResourceLocation feature, AgeRuntimeProfile profile,
|
||||
AgeBiomeSelection biomes, RegistryAccess registries) {
|
||||
if (!feature(feature)) return "Unsupported structure feature " + feature;
|
||||
if (profile.terrain() == AgeRuntimeProfile.Terrain.VOID)
|
||||
return "Feature " + feature + " requires terrain, not Void";
|
||||
if (dungeons(feature)) {
|
||||
if (profile.terrain() != AgeRuntimeProfile.Terrain.NOISE)
|
||||
return "Feature " + feature + " needs enclosed noise terrain, not Flat";
|
||||
return placedExists(registries, id("dungeons")) ? null
|
||||
: "Feature " + feature + " requires missing placed feature rivencraft:dungeons";
|
||||
}
|
||||
if (!feature.equals(id("villages")) && !feature.equals(id("strongholds"))
|
||||
&& profile.terrain() != AgeRuntimeProfile.Terrain.NOISE)
|
||||
return "Feature " + feature + " needs noise terrain, not Flat";
|
||||
if (feature.equals(id("nether_fortresses")) || feature.equals(id("bastions"))
|
||||
|| feature.equals(id("nether_fossils"))) {
|
||||
if (!AgeBiomeSelection.isCave(profile))
|
||||
return "Feature " + feature + " requires Cave terrain with a Nether biome";
|
||||
} else if (feature.equals(id("villages")) || feature.equals(id("strongholds"))
|
||||
|| feature.equals(id("buried_treasure")) || feature.equals(id("shipwrecks"))
|
||||
|| feature.equals(id("ocean_ruins")) || feature.equals(id("pillager_outposts"))
|
||||
|| feature.equals(id("trail_ruins"))) {
|
||||
if (AgeBiomeSelection.isCave(profile))
|
||||
return "Feature " + feature + " requires surface terrain, not Cave";
|
||||
}
|
||||
ResourceLocation setId = setId(feature);
|
||||
var set = registries.lookupOrThrow(Registries.STRUCTURE_SET)
|
||||
.get(ResourceKey.create(Registries.STRUCTURE_SET, setId));
|
||||
if (set.isEmpty()) return "Feature " + feature + " requires missing structure set " + setId;
|
||||
if (biomes == null) return null;
|
||||
Set<ResourceLocation> selected = Set.copyOf(biomes.biomes());
|
||||
boolean compatible = set.orElseThrow().value().structures().stream()
|
||||
.flatMap(entry -> entry.structure().value().biomes().stream())
|
||||
.map(holder -> holder.unwrapKey().map(ResourceKey::location).orElse(null))
|
||||
.anyMatch(selected::contains);
|
||||
return compatible ? null : "Feature " + feature
|
||||
+ " needs at least one biome allowed by structure set " + setId;
|
||||
}
|
||||
|
||||
private static boolean placedExists(RegistryAccess registries, ResourceLocation id) {
|
||||
return registries.lookupOrThrow(Registries.PLACED_FEATURE)
|
||||
.get(ResourceKey.create(Registries.PLACED_FEATURE, id)).isPresent();
|
||||
}
|
||||
|
||||
public static List<AgeFeatureSelection.Choice> randomChoices(long ageSeed, AgeRuntimeProfile profile,
|
||||
AgeBiomeSelection biomes, RegistryAccess registries) {
|
||||
List<ResourceLocation> eligible = new ArrayList<>(FEATURES.stream()
|
||||
.filter(id -> error(id, profile, biomes, registries) == null).toList());
|
||||
Random random = new Random(ageSeed ^ 0x5354525543545552L);
|
||||
Collections.shuffle(eligible, random);
|
||||
int count = random.nextInt(3);
|
||||
return eligible.stream().limit(count)
|
||||
.map(id -> new AgeFeatureSelection.Choice(id, Optional.empty())).toList();
|
||||
}
|
||||
|
||||
private static Set<ResourceLocation> enabledSets(List<AgeFeatureSelection.Choice> choices) {
|
||||
return choices.stream().filter(choice -> feature(choice.id()) && !dungeons(choice.id()))
|
||||
.map(choice -> setId(choice.id())).collect(java.util.stream.Collectors.toUnmodifiableSet());
|
||||
}
|
||||
|
||||
public static Stream<Holder<StructureSet>> allowedSets(Stream<Holder<StructureSet>> sets,
|
||||
List<AgeFeatureSelection.Choice> choices) {
|
||||
Set<ResourceLocation> enabled = enabledSets(choices);
|
||||
return sets.filter(holder -> holder.unwrapKey()
|
||||
.map(key -> allowed(key.location(), enabled)).orElse(false));
|
||||
}
|
||||
|
||||
public static HolderLookup<StructureSet> filteredLookup(HolderLookup<StructureSet> lookup,
|
||||
List<AgeFeatureSelection.Choice> choices) {
|
||||
Set<ResourceLocation> enabled = enabledSets(choices);
|
||||
return new HolderLookup<>() {
|
||||
@Override
|
||||
public Optional<Holder.Reference<StructureSet>> get(ResourceKey<StructureSet> key) {
|
||||
return allowed(key.location(), enabled) ? lookup.get(key) : Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<HolderSet.Named<StructureSet>> get(TagKey<StructureSet> key) {
|
||||
return lookup.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<Holder.Reference<StructureSet>> listElements() {
|
||||
return lookup.listElements().filter(holder -> allowed(holder.key().location(), enabled));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<HolderSet.Named<StructureSet>> listTags() {
|
||||
return lookup.listTags();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static boolean allowed(ResourceLocation set, Set<ResourceLocation> enabled) {
|
||||
return !CONTROLLED_SETS.contains(set) || enabled.contains(set);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import java.util.UUID;
|
||||
import net.dnorberg.rivencraft.Rivencraft;
|
||||
import net.dnorberg.rivencraft.item.PageItem;
|
||||
import net.dnorberg.rivencraft.world.AgeFeatureChunkGenerator;
|
||||
import net.dnorberg.rivencraft.world.AgeDenseOres;
|
||||
import net.dnorberg.rivencraft.writing.OrderedWriting;
|
||||
import net.dnorberg.rivencraft.writing.BlockSymbolPages;
|
||||
import net.dnorberg.rivencraft.writing.SymbolCatalog;
|
||||
@@ -33,7 +34,13 @@ public final class FeatureWritingGameTests {
|
||||
"feature/huge_trees", "feature/rocks", "feature/lava_lakes",
|
||||
"feature/surface_lakes", "feature/deep_lakes", "feature/ravines",
|
||||
"feature/floating_islands", "feature/tendrils", "feature/skylands",
|
||||
"feature/spheres", "feature/spikes");
|
||||
"feature/spheres", "feature/spikes", "feature/dungeons",
|
||||
"feature/mineshafts", "feature/nether_fortresses",
|
||||
"feature/strongholds", "feature/villages", "feature/trial_chambers",
|
||||
"feature/bastions", "feature/buried_treasure", "feature/shipwrecks",
|
||||
"feature/ocean_ruins", "feature/pillager_outposts", "feature/ruined_portals",
|
||||
"feature/nether_fossils", "feature/ancient_cities", "feature/trail_ruins",
|
||||
"feature/dense_ores", "feature/obelisks");
|
||||
helper.assertTrue(PageItem.bundledCreativeSymbols().containsAll(pages),
|
||||
"Supported feature pages must appear in the creative and JEI symbol feed");
|
||||
for (String path : pages) {
|
||||
@@ -64,7 +71,9 @@ public final class FeatureWritingGameTests {
|
||||
|| AgeFeatureSelection.tendrils(choice.id())
|
||||
|| AgeFeatureSelection.skylands(choice.id())
|
||||
|| AgeFeatureSelection.spheres(choice.id())
|
||||
|| AgeFeatureSelection.spikes(choice.id())) continue;
|
||||
|| AgeFeatureSelection.spikes(choice.id())
|
||||
|| AgeFeatureSelection.obelisks(choice.id())
|
||||
|| choice.id().equals(AgeDenseOres.ID)) continue;
|
||||
var placement = AgeFeatureSelection.placedFeature(choice.id());
|
||||
helper.assertTrue(registries.lookupOrThrow(Registries.PLACED_FEATURE)
|
||||
.get(ResourceKey.create(Registries.PLACED_FEATURE, placement)).isPresent(),
|
||||
@@ -176,7 +185,8 @@ public final class FeatureWritingGameTests {
|
||||
List<AgeFeatureSelection.Choice> random = AgeFeatureSelection.randomChoices(seed, caveProfile, registries);
|
||||
helper.assertTrue(random.stream().allMatch(choice -> AgeFeatureSelection.tendrils(choice.id())
|
||||
|| AgeFeatureSelection.spheres(choice.id())
|
||||
|| AgeFeatureSelection.skylands(choice.id())),
|
||||
|| AgeFeatureSelection.skylands(choice.id())
|
||||
|| AgeStructureSelection.feature(choice.id())),
|
||||
"Cave random Ages must not choose incompatible surface features");
|
||||
if (random.stream().anyMatch(choice -> AgeFeatureSelection.tendrils(choice.id()))) found = true;
|
||||
}
|
||||
@@ -410,7 +420,8 @@ public final class FeatureWritingGameTests {
|
||||
|| AgeFeatureSelection.floatingIslands(choices.getFirst().id())
|
||||
|| AgeFeatureSelection.tendrils(choices.getFirst().id())
|
||||
|| AgeFeatureSelection.spheres(choices.getFirst().id())
|
||||
|| AgeFeatureSelection.spikes(choices.getFirst().id()),
|
||||
|| AgeFeatureSelection.spikes(choices.getFirst().id())
|
||||
|| AgeFeatureSelection.obelisks(choices.getFirst().id()),
|
||||
"The inferred feature must accept the material type");
|
||||
helper.assertValueEqual(AgeFeatureSelection.resolved(AgeGenerationPlan.load(plan.save())), choices,
|
||||
"The inferred feature must be deterministic across a plan reload");
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package net.dnorberg.rivencraft.mixin;
|
||||
|
||||
import net.dnorberg.rivencraft.world.AgeFeatureChunkGenerator;
|
||||
import net.dnorberg.rivencraft.world.AgeFlatChunkGenerator;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
/** Suppresses biome-default monster rooms only in new Rivencraft Ages. */
|
||||
@Mixin(ChunkGenerator.class)
|
||||
public abstract class AgeDungeonPlacementMixin {
|
||||
@Redirect(method = "applyBiomeDecoration", at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/level/levelgen/placement/PlacedFeature;placeWithBiomeCheck(Lnet/minecraft/world/level/WorldGenLevel;Lnet/minecraft/world/level/chunk/ChunkGenerator;Lnet/minecraft/util/RandomSource;Lnet/minecraft/core/BlockPos;)Z"))
|
||||
private boolean rivencraft$gateAmbientDungeons(PlacedFeature feature, WorldGenLevel level,
|
||||
ChunkGenerator generator, RandomSource random, BlockPos pos) {
|
||||
if ((Object) this instanceof AgeFeatureChunkGenerator || (Object) this instanceof AgeFlatChunkGenerator) {
|
||||
ResourceLocation id = level.registryAccess().registryOrThrow(Registries.PLACED_FEATURE).getKey(feature);
|
||||
if (ResourceLocation.withDefaultNamespace("monster_room").equals(id)
|
||||
|| ResourceLocation.withDefaultNamespace("monster_room_deep").equals(id)) return false;
|
||||
}
|
||||
return feature.placeWithBiomeCheck(level, generator, random, pos);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package net.dnorberg.rivencraft.world;
|
||||
|
||||
import java.util.List;
|
||||
import net.dnorberg.rivencraft.Rivencraft;
|
||||
import net.dnorberg.rivencraft.book.AgeBiomeSelection;
|
||||
import net.dnorberg.rivencraft.book.AgeFeatureSelection;
|
||||
import net.dnorberg.rivencraft.book.AgeGenerationPlan;
|
||||
import net.dnorberg.rivencraft.book.AgeGenerationProfiles;
|
||||
import net.dnorberg.rivencraft.book.AgeRuntimeProfiles;
|
||||
import net.dnorberg.rivencraft.book.AgeTraits;
|
||||
import net.dnorberg.rivencraft.item.PageItem;
|
||||
import net.dnorberg.rivencraft.writing.OrderedWriting;
|
||||
import net.dnorberg.rivencraft.writing.SymbolReference;
|
||||
import net.dnorberg.rivencraft.writing.WritingEntry;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.gametest.framework.GameTest;
|
||||
import net.minecraft.gametest.framework.GameTestHelper;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.BlockMatchTest;
|
||||
import net.neoforged.neoforge.gametest.GameTestHolder;
|
||||
import net.neoforged.neoforge.gametest.PrefixGameTestTemplate;
|
||||
|
||||
/** Dense Ores remains authored-only and discovers ore configurations without a namespace allow-list. */
|
||||
@GameTestHolder(Rivencraft.MOD_ID)
|
||||
@PrefixGameTestTemplate(false)
|
||||
public final class AgeDenseOreGameTests {
|
||||
private AgeDenseOreGameTests() {}
|
||||
|
||||
@GameTest(template = "empty")
|
||||
public static void denseOresPageCompilesAndPersists(GameTestHelper helper) {
|
||||
var registries = helper.getLevel().registryAccess();
|
||||
helper.assertTrue(PageItem.bundledCreativeSymbols().contains("feature/dense_ores"),
|
||||
"Dense Ores must appear in the Creative and JEI page feed");
|
||||
OrderedWriting writing = new OrderedWriting(List.of(WritingEntry.linkPanel(),
|
||||
page("terrain/standard"), page("biome/plains"), page("biome/single"),
|
||||
page("feature/dense_ores")));
|
||||
AgeGenerationPlan plan = AgeGenerationPlan.compile(writing, 55L, AgeGenerationProfiles.STANDARD,
|
||||
AgeTraits.select(55L), registries);
|
||||
helper.assertValueEqual(AgeFeatureSelection.resolved(plan).stream()
|
||||
.map(AgeFeatureSelection.Choice::id).toList(), List.of(AgeDenseOres.ID),
|
||||
"Dense Ores must be saved as an authored feature");
|
||||
helper.assertValueEqual(AgeFeatureSelection.resolved(AgeGenerationPlan.load(plan.save())),
|
||||
AgeFeatureSelection.resolved(plan), "Dense Ores must survive Age-plan reload");
|
||||
for (long seed = 0; seed < 32; seed++) {
|
||||
helper.assertTrue(AgeFeatureSelection.randomChoices(seed,
|
||||
AgeRuntimeProfiles.resolve(id("standard")), registries).stream()
|
||||
.noneMatch(choice -> choice.id().equals(AgeDenseOres.ID)),
|
||||
"Random Ages must not roll an authored-only Dense Ores page");
|
||||
}
|
||||
helper.succeed();
|
||||
}
|
||||
|
||||
@GameTest(template = "empty")
|
||||
public static void denseOresRejectsUnsuitableTerrainAndBiome(GameTestHelper helper) {
|
||||
var registries = helper.getLevel().registryAccess();
|
||||
helper.assertTrue(AgeDenseOres.error(AgeRuntimeProfiles.resolve(id("flat")), null, registries)
|
||||
.contains("noise terrain"), "Flat terrain must reject Dense Ores");
|
||||
helper.assertTrue(AgeDenseOres.error(AgeRuntimeProfiles.resolve(id("void")), null, registries)
|
||||
.contains("noise terrain"), "Void terrain must reject Dense Ores");
|
||||
helper.assertTrue(AgeDenseOres.error(AgeRuntimeProfiles.resolve(id("standard")),
|
||||
new AgeBiomeSelection(AgeTraits.BiomeDistribution.SINGLE,
|
||||
List.of(ResourceLocation.withDefaultNamespace("the_end"))), registries)
|
||||
.contains("biome with registered ore"),
|
||||
"A biome without ore placements must not accept a no-op Dense Ores page");
|
||||
helper.assertTrue(AgeDenseOres.error(AgeRuntimeProfiles.resolve(id("cave")),
|
||||
new AgeBiomeSelection(AgeTraits.BiomeDistribution.SINGLE,
|
||||
List.of(ResourceLocation.withDefaultNamespace("nether_wastes"))), registries) == null,
|
||||
"Nether ore placements must qualify for a Cave Age");
|
||||
helper.succeed();
|
||||
}
|
||||
|
||||
@GameTest(template = "empty")
|
||||
public static void recognizesOreTargetsButNotStoneBlobs(GameTestHelper helper) {
|
||||
helper.assertTrue(AgeDenseOres.isOre(ore(Blocks.IRON_ORE.defaultBlockState())),
|
||||
"Any namespace's OreConfiguration yielding an ore block must qualify");
|
||||
helper.assertTrue(!AgeDenseOres.isOre(ore(Blocks.STONE.defaultBlockState())),
|
||||
"Ordinary stone replacement must not be doubled as an ore");
|
||||
helper.succeed();
|
||||
}
|
||||
|
||||
private static Holder<PlacedFeature> ore(net.minecraft.world.level.block.state.BlockState output) {
|
||||
var config = new OreConfiguration(new BlockMatchTest(Blocks.STONE), output, 8);
|
||||
var feature = new ConfiguredFeature<>(Feature.ORE, config);
|
||||
return Holder.direct(new PlacedFeature(Holder.direct(feature), List.of()));
|
||||
}
|
||||
|
||||
private static ResourceLocation id(String path) {
|
||||
return ResourceLocation.fromNamespaceAndPath(Rivencraft.MOD_ID, path);
|
||||
}
|
||||
|
||||
private static WritingEntry page(String path) {
|
||||
return WritingEntry.symbol(new SymbolReference(id(path)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package net.dnorberg.rivencraft.world;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import net.dnorberg.rivencraft.Rivencraft;
|
||||
import net.dnorberg.rivencraft.book.AgeBiomeSelection;
|
||||
import net.dnorberg.rivencraft.book.AgeRuntimeProfile;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.neoforged.neoforge.common.Tags;
|
||||
|
||||
/** Replays eligible biome ore placements once per authored Dense Ores page. */
|
||||
public final class AgeDenseOres {
|
||||
public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(Rivencraft.MOD_ID, "dense_ores");
|
||||
public static final TagKey<PlacedFeature> EXTRA_ORES = TagKey.create(Registries.PLACED_FEATURE, ID);
|
||||
|
||||
private AgeDenseOres() {}
|
||||
|
||||
public static String error(AgeRuntimeProfile profile, AgeBiomeSelection biomes, RegistryAccess registries) {
|
||||
if (profile.terrain() != AgeRuntimeProfile.Terrain.NOISE)
|
||||
return "Dense Ores needs noise terrain with replaceable underground stone or netherrack";
|
||||
if (biomes == null) return null;
|
||||
var registry = registries.lookupOrThrow(Registries.BIOME);
|
||||
boolean eligible = biomes.biomes().stream()
|
||||
.map(id -> registry.get(ResourceKey.create(Registries.BIOME, id)))
|
||||
.flatMap(java.util.Optional::stream)
|
||||
.anyMatch(holder -> oreFeatures(holder).stream().anyMatch(AgeDenseOres::isOre));
|
||||
return eligible ? null : "Dense Ores needs at least one biome with registered ore placements";
|
||||
}
|
||||
|
||||
/** Vanilla-style and modded OreConfiguration targets, or an explicit opt-in tag. */
|
||||
public static boolean isOre(Holder<PlacedFeature> holder) {
|
||||
if (holder.is(EXTRA_ORES)) return true;
|
||||
if (!(holder.value().feature().value().config() instanceof OreConfiguration ore)) return false;
|
||||
return ore.targetStates.stream().anyMatch(target -> isOreBlock(target.state));
|
||||
}
|
||||
|
||||
private static boolean isOreBlock(BlockState state) {
|
||||
if (state.is(Tags.Blocks.ORES)) return true;
|
||||
// Some third-party ores omit the common tag; require an ore configuration
|
||||
// as well so similarly named decorative features cannot be selected.
|
||||
String path = BuiltInRegistries.BLOCK.getKey(state.getBlock()).getPath();
|
||||
return path.endsWith("_ore") || path.contains("_ore_");
|
||||
}
|
||||
|
||||
private static java.util.List<Holder<PlacedFeature>> oreFeatures(Holder<Biome> biome) {
|
||||
// A mod may register its ore in a non-vanilla decoration step. Its
|
||||
// configuration and output, not its stage or namespace, decide eligibility.
|
||||
return biome.value().getGenerationSettings().features().stream()
|
||||
.flatMap(net.minecraft.core.HolderSet::stream).toList();
|
||||
}
|
||||
|
||||
public static void place(WorldGenLevel level, ChunkAccess chunk, ChunkGenerator generator,
|
||||
long ageSeed, int occurrence) {
|
||||
Set<Holder<Biome>> biomes = new HashSet<>();
|
||||
ChunkPos.rangeClosed(chunk.getPos(), 1).forEach(pos -> {
|
||||
for (var section : level.getChunk(pos.x, pos.z).getSections())
|
||||
section.getBiomes().getAll(biomes::add);
|
||||
});
|
||||
biomes.retainAll(generator.getBiomeSource().possibleBiomes());
|
||||
Map<ResourceLocation, PlacedFeature> ores = new TreeMap<>();
|
||||
for (Holder<Biome> biome : biomes) {
|
||||
for (Holder<PlacedFeature> feature : oreFeatures(biome)) {
|
||||
if (!isOre(feature)) continue;
|
||||
feature.unwrapKey().ifPresent(key -> ores.putIfAbsent(key.location(), feature.value()));
|
||||
}
|
||||
}
|
||||
BlockPos origin = new BlockPos(chunk.getPos().getMinBlockX(), level.getMinBuildHeight(),
|
||||
chunk.getPos().getMinBlockZ());
|
||||
for (var entry : ores.entrySet()) {
|
||||
long seed = mix(ageSeed ^ (long) origin.getX() * 341873128712L
|
||||
^ (long) origin.getZ() * 132897987541L
|
||||
^ (long) entry.getKey().hashCode() * 0x9E3779B97F4A7C15L
|
||||
^ (long) occurrence * 0xD1B54A32D192ED03L);
|
||||
entry.getValue().placeWithBiomeCheck(level, generator, RandomSource.create(seed), origin);
|
||||
}
|
||||
}
|
||||
|
||||
private static long mix(long value) {
|
||||
value = (value ^ value >>> 30) * 0xBF58476D1CE4E5B9L;
|
||||
value = (value ^ value >>> 27) * 0x94D049BB133111EBL;
|
||||
return value ^ value >>> 31;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import net.dnorberg.rivencraft.book.AgeFeatureSelection;
|
||||
import net.dnorberg.rivencraft.book.AgeStructureSelection;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Holder;
|
||||
@@ -25,6 +27,7 @@ import net.minecraft.world.level.biome.BiomeManager;
|
||||
import net.minecraft.world.level.biome.BiomeSource;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.chunk.ChunkGeneratorStructureState;
|
||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep;
|
||||
import net.minecraft.world.level.levelgen.LegacyRandomSource;
|
||||
@@ -37,6 +40,7 @@ import net.minecraft.world.level.levelgen.carver.CarvingContext;
|
||||
import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver;
|
||||
import net.minecraft.world.level.levelgen.placement.BiomeFilter;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
import net.minecraft.world.level.levelgen.structure.StructureSet;
|
||||
import net.minecraft.world.level.levelgen.placement.RarityFilter;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
@@ -71,6 +75,12 @@ public final class AgeFeatureChunkGenerator extends NoiseBasedChunkGenerator {
|
||||
@Override
|
||||
protected MapCodec<? extends ChunkGenerator> codec() { return CODEC; }
|
||||
|
||||
@Override
|
||||
public ChunkGeneratorStructureState createState(HolderLookup<StructureSet> sets, RandomState random, long seed) {
|
||||
return ChunkGeneratorStructureState.createForNormal(random, seed, getBiomeSource(),
|
||||
AgeStructureSelection.filteredLookup(sets, features));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<ChunkAccess> fillFromNoise(Blender blender, RandomState random,
|
||||
StructureManager structures, ChunkAccess chunk) {
|
||||
@@ -152,6 +162,7 @@ public final class AgeFeatureChunkGenerator extends NoiseBasedChunkGenerator {
|
||||
BlockPos origin = new BlockPos(x, level.getMinBuildHeight(), z);
|
||||
Map<AgeFeatureSelection.Choice, Integer> occurrences = new HashMap<>();
|
||||
Map<ResourceLocation, Integer> spikeOccurrences = new HashMap<>();
|
||||
int obeliskOccurrence = 0;
|
||||
for (int index = 0; index < features.size(); index++) {
|
||||
AgeFeatureSelection.Choice choice = features.get(index);
|
||||
int occurrence = occurrences.merge(choice, 1, Integer::sum) - 1;
|
||||
@@ -160,6 +171,14 @@ public final class AgeFeatureChunkGenerator extends NoiseBasedChunkGenerator {
|
||||
spikeOccurrences.merge(choice.id(), 1, Integer::sum) - 1);
|
||||
continue;
|
||||
}
|
||||
if (AgeFeatureSelection.obelisks(choice.id())) {
|
||||
ObelisksFeature.generate(level, chunk, ageSeed, choice, obeliskOccurrence++);
|
||||
continue;
|
||||
}
|
||||
if (choice.id().equals(AgeDenseOres.ID)) {
|
||||
AgeDenseOres.place(level, chunk, this, ageSeed, occurrence);
|
||||
continue;
|
||||
}
|
||||
if (AgeFeatureSelection.surfaceVegetation(choice.id())) {
|
||||
int surface = chunk.getHeight(Heightmap.Types.WORLD_SURFACE_WG, 8, 8);
|
||||
if (!AgeFeatureSelection.supportsSurfaceVegetation(
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Stream;
|
||||
import net.dnorberg.rivencraft.book.AgeFeatureSelection;
|
||||
import net.dnorberg.rivencraft.book.AgeStructureSelection;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Holder;
|
||||
@@ -71,7 +72,8 @@ public final class AgeFlatChunkGenerator extends ChunkGenerator {
|
||||
Stream<Holder<StructureSet>> entries = settings.structureOverrides()
|
||||
.map(HolderSet::stream)
|
||||
.orElseGet(() -> structures.listElements().map(holder -> (Holder<StructureSet>) holder));
|
||||
return ChunkGeneratorStructureState.createForFlat(random, seed, biomeSource, entries);
|
||||
return ChunkGeneratorStructureState.createForFlat(random, seed, biomeSource,
|
||||
AgeStructureSelection.allowedSets(entries, features));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,10 +124,13 @@ public final class AgeFlatChunkGenerator extends ChunkGenerator {
|
||||
@Override
|
||||
public void applyBiomeDecoration(WorldGenLevel level, ChunkAccess chunk, StructureManager structures) {
|
||||
super.applyBiomeDecoration(level, chunk, structures);
|
||||
int occurrence = 0;
|
||||
int spikeOccurrence = 0;
|
||||
int obeliskOccurrence = 0;
|
||||
for (AgeFeatureSelection.Choice choice : features) {
|
||||
if (AgeFeatureSelection.spikes(choice.id()))
|
||||
SpikesFeature.generate(level, chunk, ageSeed, choice, occurrence++);
|
||||
SpikesFeature.generate(level, chunk, ageSeed, choice, spikeOccurrence++);
|
||||
if (AgeFeatureSelection.obelisks(choice.id()))
|
||||
ObelisksFeature.generate(level, chunk, ageSeed, choice, obeliskOccurrence++);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
package net.dnorberg.rivencraft.world;
|
||||
|
||||
import net.dnorberg.rivencraft.book.AgeFeatureSelection;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
|
||||
/** Rare one-chunk obelisk adapted from Legacy's 4x4 plinth and 2x12x2 shaft. */
|
||||
final class ObelisksFeature {
|
||||
private static final long SALT = 0x4F42454C49534B53L;
|
||||
private static final int CHANCE = 128;
|
||||
private static final int BASE = 4;
|
||||
private static final int HEIGHT = 12;
|
||||
|
||||
private ObelisksFeature() {}
|
||||
|
||||
record Site(int x, int z) {}
|
||||
|
||||
static Site site(long ageSeed, ChunkPos chunk, int occurrence) {
|
||||
RandomSource random = RandomSource.create(mix(ageSeed ^ SALT
|
||||
^ (long) chunk.x * 341873128712L ^ (long) chunk.z * 132897987541L
|
||||
^ (long) occurrence * 0x9E3779B97F4A7C15L));
|
||||
if (random.nextInt(CHANCE) != 0) return null;
|
||||
return new Site(chunk.getMinBlockX() + 4 + random.nextInt(8),
|
||||
chunk.getMinBlockZ() + 4 + random.nextInt(8));
|
||||
}
|
||||
|
||||
static void generate(WorldGenLevel level, ChunkAccess chunk, long ageSeed,
|
||||
AgeFeatureSelection.Choice choice, int occurrence) {
|
||||
Site site = site(ageSeed, chunk.getPos(), occurrence);
|
||||
if (site == null || choice.material().isEmpty()) return;
|
||||
BlockState material = BuiltInRegistries.BLOCK.get(choice.material().orElseThrow()).defaultBlockState();
|
||||
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos();
|
||||
int minSurface = Integer.MAX_VALUE;
|
||||
int maxSurface = Integer.MIN_VALUE;
|
||||
int[][] surface = new int[BASE][BASE];
|
||||
for (int dx = 0; dx < BASE; dx++) {
|
||||
for (int dz = 0; dz < BASE; dz++) {
|
||||
int x = site.x() + dx;
|
||||
int z = site.z() + dz;
|
||||
int y = level.getHeight(Heightmap.Types.WORLD_SURFACE_WG, x, z);
|
||||
if (y <= level.getMinBuildHeight() + 1) return;
|
||||
BlockState ground = level.getBlockState(pos.set(x, y - 1, z));
|
||||
if (!ground.isFaceSturdy(level, pos, Direction.UP)
|
||||
|| !ground.getFluidState().isEmpty() || ground.hasBlockEntity()) return;
|
||||
surface[dx][dz] = y;
|
||||
minSurface = Math.min(minSurface, y);
|
||||
maxSurface = Math.max(maxSurface, y);
|
||||
}
|
||||
}
|
||||
if (maxSurface - minSurface > 2 || maxSurface + HEIGHT >= level.getMaxBuildHeight()) return;
|
||||
for (int dx = 0; dx < BASE; dx++) {
|
||||
for (int dz = 0; dz < BASE; dz++) {
|
||||
for (int y = surface[dx][dz]; y <= maxSurface; y++) {
|
||||
if (!open(level.getBlockState(pos.set(site.x() + dx, y, site.z() + dz)))) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int dx = 1; dx <= 2; dx++) {
|
||||
for (int dz = 1; dz <= 2; dz++) {
|
||||
for (int y = maxSurface + 1; y <= maxSurface + HEIGHT; y++) {
|
||||
if (!open(level.getBlockState(pos.set(site.x() + dx, y, site.z() + dz)))) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int dx = 0; dx < BASE; dx++) {
|
||||
for (int dz = 0; dz < BASE; dz++) {
|
||||
for (int y = surface[dx][dz]; y <= maxSurface; y++)
|
||||
level.setBlock(pos.set(site.x() + dx, y, site.z() + dz), material, 2);
|
||||
}
|
||||
}
|
||||
for (int dx = 1; dx <= 2; dx++) {
|
||||
for (int dz = 1; dz <= 2; dz++) {
|
||||
for (int y = maxSurface + 1; y <= maxSurface + HEIGHT; y++)
|
||||
level.setBlock(pos.set(site.x() + dx, y, site.z() + dz), material, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean open(BlockState state) {
|
||||
return state.getFluidState().isEmpty() && (state.isAir() || state.canBeReplaced());
|
||||
}
|
||||
|
||||
private static long mix(long value) {
|
||||
value = (value ^ value >>> 30) * 0xBF58476D1CE4E5B9L;
|
||||
value = (value ^ value >>> 27) * 0x94D049BB133111EBL;
|
||||
return value ^ value >>> 31;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package net.dnorberg.rivencraft.world;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import net.dnorberg.rivencraft.Rivencraft;
|
||||
import net.dnorberg.rivencraft.book.AgeFeatureSelection;
|
||||
import net.dnorberg.rivencraft.book.AgeGenerationPlan;
|
||||
import net.dnorberg.rivencraft.book.AgeGenerationProfiles;
|
||||
import net.dnorberg.rivencraft.book.AgeRuntimeProfiles;
|
||||
import net.dnorberg.rivencraft.book.AgeTraits;
|
||||
import net.dnorberg.rivencraft.item.PageItem;
|
||||
import net.dnorberg.rivencraft.writing.OrderedWriting;
|
||||
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.ChunkPos;
|
||||
import net.neoforged.neoforge.gametest.GameTestHolder;
|
||||
import net.neoforged.neoforge.gametest.PrefixGameTestTemplate;
|
||||
|
||||
/** Obelisks must retain ordered materials and generate a stable Legacy-sized shape. */
|
||||
@GameTestHolder(Rivencraft.MOD_ID)
|
||||
@PrefixGameTestTemplate(false)
|
||||
public final class ObelisksGameTests {
|
||||
private ObelisksGameTests() {}
|
||||
|
||||
@GameTest(template = "empty")
|
||||
public static void authoredObelisksKeepTheirMaterialAndTerrainRules(GameTestHelper helper) {
|
||||
var registries = helper.getLevel().registryAccess();
|
||||
helper.assertTrue(PageItem.bundledCreativeSymbols().contains("feature/obelisks"),
|
||||
"Obelisks must appear in the Creative and JEI symbol feed");
|
||||
OrderedWriting writing = new OrderedWriting(List.of(WritingEntry.linkPanel(), page("terrain/standard"),
|
||||
block("obsidian"), page("feature/obelisks"), page("feature/obelisks")));
|
||||
AgeGenerationPlan plan = AgeGenerationPlan.compile(writing, 56L, AgeGenerationProfiles.STANDARD,
|
||||
AgeTraits.select(56L), registries);
|
||||
var choices = AgeFeatureSelection.resolved(plan);
|
||||
helper.assertValueEqual(choices.size(), 2, "Repeated Obelisks pages must remain separate");
|
||||
helper.assertValueEqual(choices.getFirst().material(),
|
||||
Optional.of(ResourceLocation.withDefaultNamespace("obsidian")),
|
||||
"A preceding Block page must set the first obelisk material");
|
||||
helper.assertTrue(choices.getLast().material().isPresent()
|
||||
&& AgeFeatureSelection.materialError(choices.getLast()) == null,
|
||||
"An unmodified Obelisks page must choose a valid material");
|
||||
helper.assertValueEqual(AgeFeatureSelection.resolved(AgeGenerationPlan.load(plan.save())), choices,
|
||||
"Obelisk materials and order must survive Age-plan reload");
|
||||
for (String terrain : List.of("standard", "amplified", "island", "flat"))
|
||||
helper.assertTrue(AgeFeatureSelection.error(id("obelisks"),
|
||||
AgeRuntimeProfiles.resolve(id(terrain)), registries) == null,
|
||||
"Obelisks should be valid on exposed " + terrain + " terrain");
|
||||
for (String terrain : List.of("void", "cave"))
|
||||
helper.assertTrue(AgeFeatureSelection.error(id("obelisks"),
|
||||
AgeRuntimeProfiles.resolve(id(terrain)), registries) != null,
|
||||
"Obelisks must reject " + terrain + " terrain without an exposed surface");
|
||||
helper.succeed();
|
||||
}
|
||||
|
||||
@GameTest(template = "empty")
|
||||
public static void randomAgesOnlyChooseObelisksOnSupportedTerrain(GameTestHelper helper) {
|
||||
var registries = helper.getLevel().registryAccess();
|
||||
boolean selected = false;
|
||||
for (long seed = 0; seed < 128; seed++) {
|
||||
selected |= AgeFeatureSelection.randomChoices(seed,
|
||||
AgeRuntimeProfiles.resolve(id("standard")), registries).stream()
|
||||
.anyMatch(choice -> AgeFeatureSelection.obelisks(choice.id()));
|
||||
for (String terrain : List.of("void", "cave"))
|
||||
helper.assertTrue(AgeFeatureSelection.randomChoices(seed,
|
||||
AgeRuntimeProfiles.resolve(id(terrain)), registries).stream()
|
||||
.noneMatch(choice -> AgeFeatureSelection.obelisks(choice.id())),
|
||||
"Random " + terrain + " Ages must not gain Obelisks");
|
||||
}
|
||||
helper.assertTrue(selected, "Random surface Ages should be able to select Obelisks");
|
||||
helper.succeed();
|
||||
}
|
||||
|
||||
@GameTest(template = "empty")
|
||||
public static void obeliskSitesAreSeededAndStayInsideTheirChunk(GameTestHelper helper) {
|
||||
ChunkPos chunk = new ChunkPos(123, -45);
|
||||
int selected = 0;
|
||||
for (long seed = 0; seed < 2048; seed++) {
|
||||
ObelisksFeature.Site site = ObelisksFeature.site(seed, chunk, 0);
|
||||
helper.assertTrue(java.util.Objects.equals(ObelisksFeature.site(seed, chunk, 0), site),
|
||||
"An Age seed must reproduce the same obelisk site");
|
||||
if (site == null) continue;
|
||||
selected++;
|
||||
helper.assertTrue(site.x() >= chunk.getMinBlockX() + 4
|
||||
&& site.x() + 3 < chunk.getMaxBlockX(),
|
||||
"The full 4x4 plinth must remain inside its source chunk");
|
||||
helper.assertTrue(site.z() >= chunk.getMinBlockZ() + 4
|
||||
&& site.z() + 3 < chunk.getMaxBlockZ(),
|
||||
"The full 4x4 plinth must remain inside its source chunk");
|
||||
}
|
||||
helper.assertTrue(selected > 0 && selected < 64,
|
||||
"The 1-in-128 roll should remain rare but reachable");
|
||||
helper.succeed();
|
||||
}
|
||||
|
||||
private static ResourceLocation id(String path) {
|
||||
return ResourceLocation.fromNamespaceAndPath(Rivencraft.MOD_ID, path);
|
||||
}
|
||||
|
||||
private static WritingEntry page(String path) {
|
||||
return WritingEntry.symbol(new SymbolReference(id(path)));
|
||||
}
|
||||
|
||||
private static WritingEntry block(String path) {
|
||||
return WritingEntry.symbol(new SymbolReference(net.dnorberg.rivencraft.writing.BlockSymbolPages.symbolId(
|
||||
ResourceLocation.withDefaultNamespace(path))));
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public final class WritingGrammar {
|
||||
} else if (role == Role.FEATURE && pendingBlock != null) {
|
||||
ResourceLocation feature = ((SymbolSemantics.ResourceValue) parsed.semantics().value()).id();
|
||||
if (!Set.of("rocks", "surface_lakes", "deep_lakes", "lava_lakes",
|
||||
"floating_islands", "tendrils", "spheres", "spikes")
|
||||
"floating_islands", "tendrils", "spheres", "spikes", "obelisks")
|
||||
.contains(feature.getPath()) || !feature.getNamespace().equals("rivencraft")) {
|
||||
diagnostics.add(new Diagnostic(Code.MISPLACED_MODIFIER, pendingBlock.index(),
|
||||
"This feature cannot consume a material page"));
|
||||
|
||||
@@ -253,6 +253,40 @@
|
||||
"symbol.rivencraft.feature.spheres.description": "Add wandering chains of solid spheres through the Age, with a random or selected block material.",
|
||||
"symbol.rivencraft.feature.spikes": "Spikes",
|
||||
"symbol.rivencraft.feature.spikes.description": "Add rare rising spikes on exposed solid ground, with a random or selected block material.",
|
||||
"symbol.rivencraft.feature.dungeons": "Dungeons",
|
||||
"symbol.rivencraft.feature.dungeons.description": "Add monster-room dungeons below ground in this Age.",
|
||||
"symbol.rivencraft.feature.mineshafts": "Mineshafts",
|
||||
"symbol.rivencraft.feature.mineshafts.description": "Allow abandoned mineshafts in compatible terrain and biomes.",
|
||||
"symbol.rivencraft.feature.nether_fortresses": "Nether Fortresses",
|
||||
"symbol.rivencraft.feature.nether_fortresses.description": "Allow Nether fortresses in a Cave Age with a compatible Nether biome.",
|
||||
"symbol.rivencraft.feature.strongholds": "Strongholds",
|
||||
"symbol.rivencraft.feature.strongholds.description": "Allow strongholds with End portal rooms in a compatible Age.",
|
||||
"symbol.rivencraft.feature.villages": "Villages",
|
||||
"symbol.rivencraft.feature.villages.description": "Allow biome-appropriate villages on surface terrain.",
|
||||
"symbol.rivencraft.feature.trial_chambers": "Trial Chambers",
|
||||
"symbol.rivencraft.feature.trial_chambers.description": "Allow underground Trial Chambers in compatible Minecraft 1.21.1 biomes.",
|
||||
"symbol.rivencraft.feature.bastions": "Bastion Remnants",
|
||||
"symbol.rivencraft.feature.bastions.description": "Allow Bastion Remnants in a Cave Age with a compatible Nether biome.",
|
||||
"symbol.rivencraft.feature.buried_treasure": "Buried Treasure",
|
||||
"symbol.rivencraft.feature.buried_treasure.description": "Allow buried treasure beneath compatible beaches.",
|
||||
"symbol.rivencraft.feature.shipwrecks": "Shipwrecks",
|
||||
"symbol.rivencraft.feature.shipwrecks.description": "Allow shipwrecks in compatible ocean and beach biomes.",
|
||||
"symbol.rivencraft.feature.ocean_ruins": "Ocean Ruins",
|
||||
"symbol.rivencraft.feature.ocean_ruins.description": "Allow warm and cold ocean ruins in compatible biomes.",
|
||||
"symbol.rivencraft.feature.pillager_outposts": "Pillager Outposts",
|
||||
"symbol.rivencraft.feature.pillager_outposts.description": "Allow pillager outposts in compatible surface biomes.",
|
||||
"symbol.rivencraft.feature.ruined_portals": "Ruined Portals",
|
||||
"symbol.rivencraft.feature.ruined_portals.description": "Allow ruined portals in compatible surface or Nether biomes.",
|
||||
"symbol.rivencraft.feature.nether_fossils": "Nether Fossils",
|
||||
"symbol.rivencraft.feature.nether_fossils.description": "Allow Nether fossils in a Cave Age with a compatible Nether biome.",
|
||||
"symbol.rivencraft.feature.ancient_cities": "Ancient Cities",
|
||||
"symbol.rivencraft.feature.ancient_cities.description": "Allow ancient cities in compatible Deep Dark biomes.",
|
||||
"symbol.rivencraft.feature.trail_ruins": "Trail Ruins",
|
||||
"symbol.rivencraft.feature.trail_ruins.description": "Allow buried trail ruins in compatible surface biomes.",
|
||||
"symbol.rivencraft.feature.dense_ores": "Dense Ores",
|
||||
"symbol.rivencraft.feature.dense_ores.description": "Repeat compatible vanilla and modded ore placements once per page in this Age.",
|
||||
"symbol.rivencraft.feature.obelisks": "Obelisks",
|
||||
"symbol.rivencraft.feature.obelisks.description": "Add rare tall obelisks on exposed solid ground, with a random or selected block material.",
|
||||
"symbol.rivencraft.feature.lava_lakes": "Small Lakes",
|
||||
"symbol.rivencraft.feature.lava_lakes.description": "Add small surface lakes using a random fluid, or specify one with a fluid page.",
|
||||
"generator.rivencraft.standard": "Standard",
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "symbol.rivencraft.feature.ancient_cities",
|
||||
"description": "symbol.rivencraft.feature.ancient_cities.description",
|
||||
"category": "rivencraft:feature",
|
||||
"semantics": { "role": "feature", "value": "rivencraft:ancient_cities" },
|
||||
"poem": "Civilization Darkness Silence Ancient"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "symbol.rivencraft.feature.bastions",
|
||||
"description": "symbol.rivencraft.feature.bastions.description",
|
||||
"category": "rivencraft:feature",
|
||||
"semantics": { "role": "feature", "value": "rivencraft:bastions" },
|
||||
"poem": "Civilization Ruin Greed Nether"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "symbol.rivencraft.feature.buried_treasure",
|
||||
"description": "symbol.rivencraft.feature.buried_treasure.description",
|
||||
"category": "rivencraft:feature",
|
||||
"semantics": { "role": "feature", "value": "rivencraft:buried_treasure" },
|
||||
"poem": "Treasure Sand Ocean Memory"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "symbol.rivencraft.feature.dense_ores",
|
||||
"description": "symbol.rivencraft.feature.dense_ores.description",
|
||||
"category": "rivencraft:feature",
|
||||
"semantics": { "role": "feature", "value": "rivencraft:dense_ores" },
|
||||
"poem": "Nature Material Treasure Abundance"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "symbol.rivencraft.feature.dungeons",
|
||||
"description": "symbol.rivencraft.feature.dungeons.description",
|
||||
"category": "rivencraft:feature",
|
||||
"semantics": { "role": "feature", "value": "rivencraft:dungeons" },
|
||||
"poem": "Civilization Constraint Chain Resurrect"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "symbol.rivencraft.feature.mineshafts",
|
||||
"description": "symbol.rivencraft.feature.mineshafts.description",
|
||||
"category": "rivencraft:feature",
|
||||
"semantics": { "role": "feature", "value": "rivencraft:mineshafts" },
|
||||
"poem": "Civilization Machine Motion Tradition"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "symbol.rivencraft.feature.nether_fortresses",
|
||||
"description": "symbol.rivencraft.feature.nether_fortresses.description",
|
||||
"category": "rivencraft:feature",
|
||||
"semantics": { "role": "feature", "value": "rivencraft:nether_fortresses" },
|
||||
"poem": "Civilization Machine Power Entropy"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "symbol.rivencraft.feature.nether_fossils",
|
||||
"description": "symbol.rivencraft.feature.nether_fossils.description",
|
||||
"category": "rivencraft:feature",
|
||||
"semantics": { "role": "feature", "value": "rivencraft:nether_fossils" },
|
||||
"poem": "Bone Death Nether Time"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "symbol.rivencraft.feature.obelisks",
|
||||
"description": "symbol.rivencraft.feature.obelisks.description",
|
||||
"category": "rivencraft:feature",
|
||||
"semantics": { "role": "feature", "value": "rivencraft:obelisks" },
|
||||
"poem": "Civilization Structure Power Obelisk"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "symbol.rivencraft.feature.ocean_ruins",
|
||||
"description": "symbol.rivencraft.feature.ocean_ruins.description",
|
||||
"category": "rivencraft:feature",
|
||||
"semantics": { "role": "feature", "value": "rivencraft:ocean_ruins" },
|
||||
"poem": "Ocean Stone Ruin Time"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "symbol.rivencraft.feature.pillager_outposts",
|
||||
"description": "symbol.rivencraft.feature.pillager_outposts.description",
|
||||
"category": "rivencraft:feature",
|
||||
"semantics": { "role": "feature", "value": "rivencraft:pillager_outposts" },
|
||||
"poem": "Civilization Conflict Watchtower Danger"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "symbol.rivencraft.feature.ruined_portals",
|
||||
"description": "symbol.rivencraft.feature.ruined_portals.description",
|
||||
"category": "rivencraft:feature",
|
||||
"semantics": { "role": "feature", "value": "rivencraft:ruined_portals" },
|
||||
"poem": "Portal Ruin Flame Memory"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "symbol.rivencraft.feature.shipwrecks",
|
||||
"description": "symbol.rivencraft.feature.shipwrecks.description",
|
||||
"category": "rivencraft:feature",
|
||||
"semantics": { "role": "feature", "value": "rivencraft:shipwrecks" },
|
||||
"poem": "Ocean Journey Ruin Timber"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "symbol.rivencraft.feature.strongholds",
|
||||
"description": "symbol.rivencraft.feature.strongholds.description",
|
||||
"category": "rivencraft:feature",
|
||||
"semantics": { "role": "feature", "value": "rivencraft:strongholds" },
|
||||
"poem": "Civilization Wisdom Future Honor"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "symbol.rivencraft.feature.trail_ruins",
|
||||
"description": "symbol.rivencraft.feature.trail_ruins.description",
|
||||
"category": "rivencraft:feature",
|
||||
"semantics": { "role": "feature", "value": "rivencraft:trail_ruins" },
|
||||
"poem": "Civilization Buried Path Memory"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "symbol.rivencraft.feature.trial_chambers",
|
||||
"description": "symbol.rivencraft.feature.trial_chambers.description",
|
||||
"category": "rivencraft:feature",
|
||||
"semantics": { "role": "feature", "value": "rivencraft:trial_chambers" },
|
||||
"poem": "Civilization Trial Structure Challenge"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "symbol.rivencraft.feature.villages",
|
||||
"description": "symbol.rivencraft.feature.villages.description",
|
||||
"category": "rivencraft:feature",
|
||||
"semantics": { "role": "feature", "value": "rivencraft:villages" },
|
||||
"poem": "Civilization Society Harmony Nurture"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": []
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"feature": "minecraft:monster_room",
|
||||
"placement": [
|
||||
{ "type": "minecraft:count", "count": 8 },
|
||||
{ "type": "minecraft:in_square" },
|
||||
{
|
||||
"type": "minecraft:height_range",
|
||||
"height": {
|
||||
"type": "minecraft:uniform",
|
||||
"min_inclusive": { "above_bottom": 1 },
|
||||
"max_inclusive": { "below_top": 1 }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"structures": [
|
||||
{ "structure": "minecraft:bastion_remnant", "weight": 1 }
|
||||
],
|
||||
"placement": {
|
||||
"type": "minecraft:random_spread",
|
||||
"spacing": 27,
|
||||
"separation": 4,
|
||||
"salt": 30084233
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"structures": [
|
||||
{ "structure": "minecraft:fortress", "weight": 1 }
|
||||
],
|
||||
"placement": {
|
||||
"type": "minecraft:random_spread",
|
||||
"spacing": 27,
|
||||
"separation": 4,
|
||||
"salt": 30084232
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,9 @@
|
||||
"minVersion": "0.8",
|
||||
"package": "net.dnorberg.rivencraft.mixin",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"mixins": [
|
||||
"AgeDungeonPlacementMixin"
|
||||
],
|
||||
"client": [
|
||||
"client.ClientLevelSoundMixin",
|
||||
"client.ImmersivePortalsGuiRenderingMixin",
|
||||
|
||||
Reference in new issue
Block a user