Public Access
Add native biome families, desert vegetation, static sky controls and Seamless views
Build and smoke / changes (push) Waiting to run
Build and smoke / changes (push) Waiting to run
This commit is contained in:
1 parent
90e4a98a7a
commit
d199ac253e
92 files changed
+2520
-224
No files matched your search
+17
-14
@@ -1,24 +1,27 @@
|
||||
# Minecraft 26.3
|
||||
|
||||
The current **Minecraft 26.3 release is 26.3.0.5**, for NeoForge 26.3.0.99 and
|
||||
The current **Minecraft 26.3 release is 26.3.0.10**, for NeoForge 26.3.0.99 and
|
||||
Java 25. It uses Rivencraft's first-party Age backend, with no Dynamic Dimensions
|
||||
or Bad Packets dependency. The writing loop, authored/seeded Ages, generation
|
||||
features, weather/skies/celestials, libraries, crystal portals, live instability,
|
||||
and Link Modifier controls are ported. JEI, TerraBlender/Biomes O' Plenty, Serene
|
||||
Seasons/GlitchCore and Ruins are optional.
|
||||
|
||||
Immersive Portals Reborn 7.0.12 optionally supplies rotating live book previews
|
||||
and continuous crystal portal views. Built-in animations and normal travel remain
|
||||
available without it. Random-page eligibility and glyph descriptions are included.
|
||||
Use one portal fork per instance. The server controls crystal live views through
|
||||
`book_previews.reborn_crystal_live_views`; clients can disable live book views
|
||||
with `book_previews.reborn_live_views` in `rivencraft-local.toml`.
|
||||
**Known Reborn crashes:** [#118](https://git.paddedcell.org/dnorberg/rivencraft/issues/118)
|
||||
tracks the world-reset acknowledgement problem and an unresolved null-section
|
||||
rebuild crash during exploration. 26.3.0.5 mitigates the acknowledgement gap;
|
||||
it does not fix the section rebuild crash. The earlier Static Sky issue #116
|
||||
was closed after the user reported it resolved. Full Seamless live-view support
|
||||
is tracked in [#117](https://git.paddedcell.org/dnorberg/rivencraft/issues/117).
|
||||
Immersive Portals Reborn 7.0.12 or Seamless Portals 1.0.0 optionally supplies
|
||||
rotating live book previews, look-only exploration and continuous crystal portal
|
||||
views. Install only one fork per instance. Built-in animations and normal travel
|
||||
remain available without either. Independent settings under book_previews control
|
||||
each fork's live book and crystal views.
|
||||
|
||||
**Known portal-mod failures:** [#118](https://git.paddedcell.org/dnorberg/rivencraft/issues/118)
|
||||
tracks Reborn section-rebuild crashes and Reborn/Seamless acknowledgement disconnects
|
||||
during travel. Rejoining recovered the observed Seamless Age-loading disconnect.
|
||||
This release does not fix those failures. See [integration details](../../docs/SEAMLESS_PORTALS.md).
|
||||
|
||||
Native Caves/Nether/End Pages, desert vegetation and Number-controlled Static Sky
|
||||
resolution passed player checks on both supported versions. Native controls select
|
||||
their own seeded biome pool independently of terrain. Write Link Panel → Terrain
|
||||
→ one Native choice. See [family rules](../../docs/NATIVE_BIOME_FAMILIES.md).
|
||||
|
||||
The port feature and acceptance review is recorded in
|
||||
[the parity review](../../docs/MC263_PARITY_REVIEW.md). Book exploration matches
|
||||
@@ -26,7 +29,7 @@ The port feature and acceptance review is recorded in
|
||||
movement is disabled. The final dedicated-server restart/return check passed.
|
||||
Create/Ponder scenes are not ported to this target. Use matching client/server
|
||||
builds, keep saves separate from 1.21.1 and back up before updating.
|
||||
See [release notes](RELEASE_NOTES_26.3.0.5.md).
|
||||
See [release notes](RELEASE_NOTES_26.3.0.10.md).
|
||||
|
||||
Flooded Environment Pages now fill Cave and other terrain to Y=63 by default,
|
||||
or the absolute base-25 Number Pages immediately before Flooded. Both-version
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# Rivencraft 26.3.0.10
|
||||
|
||||
Release for Minecraft 26.3 / NeoForge 26.3.0.99 / Java 25.
|
||||
Uses Rivencraft's first-party Age backend. Use matching client/server builds.
|
||||
|
||||
- Adds Native Caves, Native Nether and Native End Pages, selecting seeded regional biome pools independently of terrain. Includes recognized modded biomes and 26.3 Sulfur Caves.
|
||||
- New ordinary Native Cave Ages exclude Nether tags and TerraBlender Nether regions. Explicit Nether authoring remains supported.
|
||||
- Authored noise terrain can use a vanilla noise baseline when the primary Overworld uses Flat/custom generation.
|
||||
- Trees add cacti in vanilla and tagged modded deserts, Huge Trees add tall cactus columns, and Flowers add dead bushes. Fixes Flat grass-surface placement in BOP Dryland.
|
||||
- Number Pages immediately before Static Sky set resolution in base 25: default 48, clamped to 1–128. Resolution persists and synchronizes; the renderer releases replaced textures.
|
||||
- Enables optional Seamless Portals 1.0.0 live book previews, look-only book exploration and continuous crystal-portal views. Install only one portal fork.
|
||||
- Adds independent seamless_live_views and seamless_crystal_live_views configuration options. Animated previews and ordinary travel remain available without an optional renderer.
|
||||
- New Pages enter the biome generation Creative/JEI feeds. Existing frozen pools and generated chunks are not rewritten.
|
||||
|
||||
Player in-game checks passed. Native-family checks passed: 91 without biome mods, 94 with BOP/TerraBlender. Optional-portal server probes passed sequentially: Seamless 24, Reborn 24, neither 8.
|
||||
|
||||
Known issue: [#118](https://git.paddedcell.org/dnorberg/rivencraft/issues/118) tracks Reborn renderer crashes and Reborn/Seamless acknowledgement disconnects during travel. A Seamless disconnect occurred loading “caves on top”; rejoining loaded the Age successfully. This release does not fix that failure. Disable optional live views or remove the optional renderer if needed.
|
||||
|
||||
Writing examples: Link Panel → Terrain → Native Caves/Nether/End. Native is itself a biome controller; do not add a second distribution controller.
|
||||
@@ -0,0 +1,13 @@
|
||||
# Rivencraft 26.3.0.6
|
||||
|
||||
Local test build for issue #108; pending player validation and explicit publication.
|
||||
|
||||
- Trees add ordinary cacti in vanilla and tagged modded deserts.
|
||||
- Huge Trees add tall 5–9-block cactus columns; Flowers add dead bushes.
|
||||
- Repeated pages add seeded attempts; normal biome decoration remains.
|
||||
- Uses common `c:is_desert` via a data-pack-extensible Rivencraft tag. BOP
|
||||
Dryland/Lush Desert are included; Cold Desert is unchanged.
|
||||
- Candidate biome, air, ground and bounds checks protect existing blocks.
|
||||
- Existing chunks are not rewritten. Creative/JEI tooltips describe the behavior.
|
||||
|
||||
Shared placement checks passed. See [desert vegetation rules](../../docs/DESERT_VEGETATION.md).
|
||||
@@ -0,0 +1,14 @@
|
||||
# Rivencraft 26.3.0.7
|
||||
|
||||
Local test build for issue #108; pending player retest and explicit publication.
|
||||
|
||||
- Includes the desert Trees, Huge Trees and Flowers page behavior from 26.3.0.6.
|
||||
- Fixes cactus placement on Flat grass surfaces in BOP Dryland and other tagged
|
||||
deserts: Minecraft 26.3 splits dirt and grass-like soils into separate tags.
|
||||
- Keeps existing plants/blocks and normal biome decoration; old generated
|
||||
chunks are not rewritten.
|
||||
- The isolated BOP/TerraBlender server probe reproduced the failure, then
|
||||
confirmed cactus and dead-bush placement with the corrected ground rule.
|
||||
- Minecraft 1.21.1.0.4 passed player validation and is unchanged by this fix.
|
||||
|
||||
See [desert vegetation rules](../../docs/DESERT_VEGETATION.md).
|
||||
@@ -0,0 +1,16 @@
|
||||
# Rivencraft 26.3.0.8
|
||||
|
||||
Local test build for Minecraft 26.3; pending player validation and explicit publication.
|
||||
|
||||
- Number Pages immediately before Static Sky set its cells per face in base 25.
|
||||
Default 48; supported range 1–128, with zero and oversized inputs clamped.
|
||||
- Resolution persists across travel/save/reload and synchronizes with clients.
|
||||
Matching updated server/client builds are required.
|
||||
- Static animation timing and tint remain independent; other skies are unchanged.
|
||||
- Existing Static Sky/Number Pages and Creative/JEI descriptions are updated.
|
||||
- Includes the previously validated desert vegetation changes from issue #108.
|
||||
|
||||
The 26.3 renderer reuses its cube, resizes only the current noise texture,
|
||||
and releases the previous texture on resolution changes.
|
||||
|
||||
Focused checks passed; GPU appearance awaits player validation. See [rules and tests](../../docs/STATIC_SKY_RESOLUTION.md).
|
||||
@@ -0,0 +1,23 @@
|
||||
# Rivencraft 26.3.0.9
|
||||
|
||||
Local candidate for Minecraft 26.3 / NeoForge 26.3.0.99 / Java 25.
|
||||
Pending player validation and explicit publication.
|
||||
|
||||
- Enables optional Seamless Portals 1.0.0 live rotating Linking/Descriptive Book
|
||||
panels and handheld look-only exploration, reusing the established renderer.
|
||||
- Enables continuous masked crystal portal views through the same adapter,
|
||||
with Rivencraft retaining teleportation and link-property handling.
|
||||
- Adds independent `seamless_live_views` and `seamless_crystal_live_views`
|
||||
options under `book_previews`. Existing Reborn options remain unchanged.
|
||||
- Shares preview leases, camera/audio restoration and portal maintenance across
|
||||
the two optional forks. Install only one fork per instance.
|
||||
- Retains animations/ordinary travel without a renderer or when disabled.
|
||||
- Keeps the Reborn acknowledgement workaround Reborn-only. Known Reborn
|
||||
renderer crashes in issue #118 are not fixed by this release.
|
||||
- Includes the validated desert vegetation and Static Sky resolution changes
|
||||
from issues #108 and #109.
|
||||
|
||||
Sequential focused server checks pass: Seamless 24, Reborn 24, no portal mod 8.
|
||||
Actual client rendering and multiplayer/restart behavior await player validation.
|
||||
|
||||
See [Seamless integration and manual checks](../../docs/SEAMLESS_PORTALS.md).
|
||||
@@ -249,6 +249,7 @@ tasks.named('processResources', ProcessResources).configure {
|
||||
include 'assets/rivencraft/models/block/decay_*.json'
|
||||
include 'assets/rivencraft/textures/block/decay_*.png'
|
||||
include 'data/rivencraft/tags/block/decay_protected.json'
|
||||
include 'data/rivencraft/tags/worldgen/biome/desert_vegetation.json'
|
||||
include 'assets/rivencraft/sounds.json'
|
||||
include 'assets/rivencraft/sounds/**/*.ogg'
|
||||
include 'assets/rivencraft/textures/item/crystal_shard.png'
|
||||
|
||||
@@ -7,7 +7,7 @@ neo_version=26.3.0.99
|
||||
mod_id=rivencraft
|
||||
mod_name=Rivencraft
|
||||
mod_license=LGPL-3.0-or-later
|
||||
mod_version=26.3.0.5
|
||||
mod_version=26.3.0.10
|
||||
|
||||
jei_version=31.17.0.109
|
||||
|
||||
|
||||
@@ -11,10 +11,8 @@
|
||||
"symbol.rivencraft.sky.overworld.description": "Use the native Overworld sky. Terrain and lighting remain independently authored.",
|
||||
"symbol.rivencraft.sky.nether.description": "Use a Nether-style reddish fog backdrop. Authored celestials render over it; terrain and gameplay rules remain independent.",
|
||||
"symbol.rivencraft.sky.end.description": "Use the native End sky backdrop with authored celestials over it, without End terrain or a dragon fight.",
|
||||
"symbol.rivencraft.sky.static.description": "Animated static surrounds the Age, behind authored celestials. Preceding colors tint it; otherwise it is gray.",
|
||||
"symbol.rivencraft.lighting.ambient_color": "Ambient Light Color",
|
||||
"symbol.rivencraft.lighting.ambient_color.description": "Apply preceding shared colors to ambient light. Use Bright separately for full effective ambient lighting.",
|
||||
"symbol.rivencraft.number.description": "Before Color: value × 10 per channel. Before Length: value × 0.08 days. Before Phase/Angle: value × 15 degrees. Before Size: 0.25× to 3× (0-24).",
|
||||
"symbol.rivencraft.size.small.description": "Before Sun/Moon: 0.5× body size. Before Normal Time: size the sun only. A preceding Number overrides the size.",
|
||||
"symbol.rivencraft.size.normal.description": "Before Sun/Moon: 1× body size. Before Normal Time: size the sun only. A preceding Number selects 0.25× through 3× (0-24).",
|
||||
"symbol.rivencraft.size.large.description": "Before Sun/Moon: 2× body size. Before Normal Time: size the sun only. A preceding Number selects 0.25× through 3× (0-24).",
|
||||
@@ -85,7 +83,6 @@
|
||||
"symbol.rivencraft.feature.abandoned_camps": "Abandoned Camps",
|
||||
"symbol.rivencraft.feature.abandoned_camps.description": "Allow abandoned camps on surface noise terrain, including outside their usual biomes.",
|
||||
"symbol.rivencraft.block.generated.description": "Modify the next compatible feature. Without a following feature, choose a compatible feature from the Age seed.",
|
||||
"symbol.rivencraft.biome.native.description": "Use the terrain's default biome source. Cave uses Tiny regions from recognized Cave/Nether biomes. Do not include Biome pages.",
|
||||
"symbol.rivencraft.feature.dungeons.description": "Add monster-room dungeon attempts throughout surface noise or Cave terrain, including Nether cave biomes. Not Flat or Void.",
|
||||
"symbol.rivencraft.biome.single.description": "Use one biome across the Age. If omitted, choose an eligible biome from the Age seed.",
|
||||
"symbol.rivencraft.terrain.flat.description": "A level, biome-decorated landscape with its foundation at Y=0.",
|
||||
|
||||
@@ -11,6 +11,8 @@ public final class PortConfig {
|
||||
public static final ModConfigSpec.ConfigValue<java.util.List<? extends String>> RANDOM_PAGE_BLOCKLIST;
|
||||
public static final ModConfigSpec.BooleanValue LIVE_BOOK_PREVIEWS;
|
||||
public static final ModConfigSpec.BooleanValue CRYSTAL_LIVE_VIEWS;
|
||||
public static final ModConfigSpec.BooleanValue SEAMLESS_BOOK_PREVIEWS;
|
||||
public static final ModConfigSpec.BooleanValue SEAMLESS_CRYSTAL_VIEWS;
|
||||
public static final ModConfigSpec SPEC;
|
||||
public static final ModConfigSpec.BooleanValue AUTO_WHITELIST_SERENE_AGES;
|
||||
public static final ModConfigSpec.IntValue SYMBOL_INK_COST;
|
||||
@@ -28,6 +30,14 @@ public final class PortConfig {
|
||||
CRYSTAL_LIVE_VIEWS = builder.comment("Server option: create native live crystal portal surfaces when Reborn is installed.",
|
||||
"Disabling keeps crystal portal travel with the animated surface.")
|
||||
.define("reborn_crystal_live_views", true);
|
||||
SEAMLESS_BOOK_PREVIEWS = builder.comment(
|
||||
"Show rotating live book views and handheld look-only exploration with Seamless on client and server.",
|
||||
"Disable locally to retain animated Legacy link panels; existing Reborn switches remain independent.")
|
||||
.define("seamless_live_views", true);
|
||||
SEAMLESS_CRYSTAL_VIEWS = builder.comment(
|
||||
"Server option: create native live crystal portal surfaces when Seamless is installed.",
|
||||
"Disabling retains normal portal travel and the animated surface.")
|
||||
.define("seamless_crystal_live_views", true);
|
||||
builder.pop();
|
||||
builder.push("random_pages");
|
||||
RANDOM_PAGE_ALLOWLIST = builder.comment(
|
||||
|
||||
@@ -249,7 +249,7 @@ public final class Rivencraft {
|
||||
COMPONENTS.register(modEventBus);
|
||||
RECIPE_SERIALIZERS.register(modEventBus);
|
||||
net.dnorberg.rivencraft.compat.RuinsCompatibility.register();
|
||||
net.dnorberg.rivencraft.compat.RebornBookPreviews.register();
|
||||
net.dnorberg.rivencraft.compat.ImmersiveBookPreviews.register();
|
||||
ModCreativeTabs.register(modEventBus);
|
||||
PortBiomeSources.register(modEventBus);
|
||||
PortChunkGenerators.register(modEventBus);
|
||||
|
||||
@@ -21,7 +21,7 @@ public final class AgeCatalogSync {
|
||||
}
|
||||
|
||||
public static void registerPayloads(RegisterPayloadHandlersEvent event) {
|
||||
var registrar = event.registrar("11");
|
||||
var registrar = event.registrar("12");
|
||||
registrar.playToClient(AgeCatalogPayload.TYPE, AgeCatalogPayload.STREAM_CODEC);
|
||||
registrar.playToServer(AgeCatalogAckPayload.TYPE, AgeCatalogAckPayload.STREAM_CODEC,
|
||||
(payload, context) -> {
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.dnorberg.rivencraft.age;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import java.util.List;
|
||||
import net.dnorberg.rivencraft.shared.StaticSkyResolution;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
@@ -14,26 +15,33 @@ import org.joml.Vector3f;
|
||||
import org.joml.Vector3fc;
|
||||
|
||||
/** Frozen shared-color writing, adapted from 1.21.1 AgeSkyProfile. -1 means native. */
|
||||
public record PortAgeColors(int sky, int ambient, int celestial) {
|
||||
public record PortAgeColors(int sky, int ambient, int celestial, int staticResolution) {
|
||||
public static final PortAgeColors NATIVE = new PortAgeColors(-1, -1);
|
||||
public static final Codec<PortAgeColors> CODEC = RecordCodecBuilder.create(instance -> instance.group(
|
||||
Codec.intRange(-1, 0xffffff).fieldOf("sky").forGetter(PortAgeColors::sky),
|
||||
Codec.intRange(-1, 0xffffff).fieldOf("ambient").forGetter(PortAgeColors::ambient),
|
||||
Codec.intRange(-1, 0xffffff).optionalFieldOf("celestial", -1).forGetter(PortAgeColors::celestial)
|
||||
Codec.intRange(-1, 0xffffff).optionalFieldOf("celestial", -1).forGetter(PortAgeColors::celestial),
|
||||
Codec.intRange(StaticSkyResolution.MIN, StaticSkyResolution.MAX)
|
||||
.optionalFieldOf("static_resolution", StaticSkyResolution.DEFAULT).forGetter(PortAgeColors::staticResolution)
|
||||
).apply(instance, PortAgeColors::new));
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, PortAgeColors> STREAM_CODEC = StreamCodec.composite(
|
||||
ByteBufCodecs.INT, PortAgeColors::sky, ByteBufCodecs.INT, PortAgeColors::ambient,
|
||||
ByteBufCodecs.INT, PortAgeColors::celestial, PortAgeColors::new);
|
||||
ByteBufCodecs.INT, PortAgeColors::celestial,
|
||||
ByteBufCodecs.VAR_INT, PortAgeColors::staticResolution, PortAgeColors::new);
|
||||
public static final Identifier AMBIENT = Identifier.fromNamespaceAndPath("rivencraft", "lighting/ambient_color");
|
||||
private static volatile Map<Identifier, PortAgeColors> clientColors = Map.of();
|
||||
|
||||
public PortAgeColors {
|
||||
staticResolution = StaticSkyResolution.clamp(staticResolution);
|
||||
if (sky < -1 || sky > 0xffffff || ambient < -1 || ambient > 0xffffff
|
||||
|| celestial < -1 || celestial > 0xffffff)
|
||||
throw new IllegalArgumentException("Invalid Age color");
|
||||
}
|
||||
|
||||
public PortAgeColors(int sky, int ambient) { this(sky, ambient, -1); }
|
||||
public PortAgeColors(int sky, int ambient, int celestial) {
|
||||
this(sky, ambient, celestial, StaticSkyResolution.DEFAULT);
|
||||
}
|
||||
|
||||
public static void updateClient(Map<Identifier, PortAgeColors> colors) { clientColors = Map.copyOf(colors); }
|
||||
|
||||
@@ -60,11 +68,17 @@ public record PortAgeColors(int sky, int ambient, int celestial) {
|
||||
public static boolean isModifier(Identifier page) { return isColor(page) || number(page) >= 0 || page.equals(AMBIENT); }
|
||||
|
||||
public static boolean validNumbers(List<Identifier> pages) {
|
||||
for (int i = 0; i < pages.size(); i++)
|
||||
if (number(pages.get(i)) >= 0 && (i + 1 == pages.size()
|
||||
|| !isColor(pages.get(i + 1)) && !PortDayCycle.isPeriod(pages.get(i + 1))
|
||||
&& !PortDayCycle.isPhase(pages.get(i + 1)) && !PortDayCycle.isAngle(pages.get(i + 1))
|
||||
&& !PortDayCycle.isSize(pages.get(i + 1)))) return false;
|
||||
for (int i = 0; i < pages.size(); i++) {
|
||||
if (number(pages.get(i)) < 0) continue;
|
||||
int next = i + 1;
|
||||
while (next < pages.size() && number(pages.get(next)) >= 0) next++;
|
||||
if (next < pages.size() && (pages.get(next).equals(PortStaticSkyResolution.PAGE)
|
||||
|| pages.get(next).equals(PortFlooding.PAGE))) continue;
|
||||
if (i + 1 >= pages.size()) return false;
|
||||
Identifier target = pages.get(i + 1);
|
||||
if (!isColor(target) && !PortDayCycle.isPeriod(target) && !PortDayCycle.isPhase(target)
|
||||
&& !PortDayCycle.isAngle(target) && !PortDayCycle.isSize(target)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -101,7 +115,7 @@ public record PortAgeColors(int sky, int ambient, int celestial) {
|
||||
}
|
||||
}
|
||||
if (written) sky = clamp(red) << 16 | clamp(green) << 8 | clamp(blue);
|
||||
return new PortAgeColors(sky, ambient, celestial);
|
||||
return new PortAgeColors(sky, ambient, celestial, PortStaticSkyResolution.compile(pages));
|
||||
}
|
||||
|
||||
/** Only pageless random Ages receive a random sky tint, as in 1.21.1. */
|
||||
|
||||
@@ -3,19 +3,29 @@ package net.dnorberg.rivencraft.age;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import java.util.List;
|
||||
import net.dnorberg.rivencraft.shared.NativeBiomeKind;
|
||||
import net.minecraft.resources.Identifier;
|
||||
|
||||
/** Frozen biome choice; Native may carry an explicit Cave pool. Repeats retain weight. */
|
||||
public record PortBiomePlan(Distribution distribution, List<Identifier> biomes) {
|
||||
public record PortBiomePlan(Distribution distribution, List<Identifier> biomes, NativeBiomeKind nativeKind) {
|
||||
public enum Distribution { NATIVE, SINGLE, TILED, GRID, TINY, SMALL, MEDIUM, LARGE, HUGE }
|
||||
|
||||
public static final Codec<PortBiomePlan> CODEC = RecordCodecBuilder.create(instance -> instance.group(
|
||||
Codec.STRING.xmap(Distribution::valueOf, Distribution::name).fieldOf("distribution")
|
||||
.forGetter(PortBiomePlan::distribution),
|
||||
Identifier.CODEC.listOf().fieldOf("biomes").forGetter(PortBiomePlan::biomes)
|
||||
Identifier.CODEC.listOf().fieldOf("biomes").forGetter(PortBiomePlan::biomes),
|
||||
Codec.STRING.xmap(NativeBiomeKind::valueOf, NativeBiomeKind::name)
|
||||
.optionalFieldOf("native_kind", NativeBiomeKind.TERRAIN).forGetter(PortBiomePlan::nativeKind)
|
||||
).apply(instance, PortBiomePlan::new));
|
||||
|
||||
public PortBiomePlan(Distribution distribution, List<Identifier> biomes) {
|
||||
this(distribution, biomes, NativeBiomeKind.TERRAIN);
|
||||
}
|
||||
|
||||
public PortBiomePlan {
|
||||
java.util.Objects.requireNonNull(nativeKind, "nativeKind");
|
||||
if (nativeKind != NativeBiomeKind.TERRAIN && (distribution != Distribution.NATIVE || biomes.isEmpty()))
|
||||
throw new IllegalArgumentException("A native family requires a nonempty Native pool");
|
||||
biomes = List.copyOf(biomes);
|
||||
if (distribution == null || distribution == Distribution.SINGLE && biomes.size() != 1
|
||||
|| distribution != Distribution.NATIVE && distribution != Distribution.SINGLE && biomes.size() < 2)
|
||||
|
||||
@@ -292,6 +292,14 @@ public final class PortFeatureChunkGenerator extends ChunkGenerator {
|
||||
PortShelfMushrooms.decorate(level, chunk, mushroomHosts, random);
|
||||
continue;
|
||||
}
|
||||
if (page.equals(PortVegetationPlan.FLOWERS) || page.equals(PortVegetationPlan.TREES)
|
||||
|| page.equals(PortVegetationPlan.HUGE_TREES)) {
|
||||
PortSurfaceVegetation.place(level, this, chunk,
|
||||
page.getPath().substring("feature/".length()),
|
||||
PortVegetationPlan.placedFeature(page), random);
|
||||
if (PortVegetationPlan.addsLogs(page)) mushroomHosts = null;
|
||||
continue;
|
||||
}
|
||||
if (!surfaceBiome) continue;
|
||||
Identifier placedId = PortVegetationPlan.placedFeature(page);
|
||||
PlacedFeature vanilla = registry.getOrThrow(
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package net.dnorberg.rivencraft.age;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
import net.dnorberg.rivencraft.shared.NativeBiomeKind;
|
||||
import net.dnorberg.rivencraft.compat.TerraBlenderBiomes;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.tags.BiomeTags;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
|
||||
/** Family pools are resolved only when binding new writing, never re-filtered on load. */
|
||||
public final class PortNativeBiomePools {
|
||||
private PortNativeBiomePools() {}
|
||||
public static final TagKey<Biome> CAVES = TagKey.create(Registries.BIOME,
|
||||
Identifier.fromNamespaceAndPath("rivencraft", "cave_biomes"));
|
||||
|
||||
public static List<Identifier> pool(HolderLookup.Provider registries, NativeBiomeKind kind) {
|
||||
var biomes = registries.lookupOrThrow(Registries.BIOME);
|
||||
var nether = java.util.Set.copyOf(TerraBlenderBiomes.nether(registries));
|
||||
java.util.function.Predicate<Holder.Reference<Biome>> isNether =
|
||||
biome -> biome.is(BiomeTags.IS_NETHER) || nether.contains(biome.key().identifier());
|
||||
var selected = biomes.listElements()
|
||||
.filter(biome -> !biome.key().identifier().equals(Identifier.parse("terrablender:deferred_placeholder")))
|
||||
.filter(biome -> switch (kind) {
|
||||
case CAVES -> biome.is(CAVES) && !isNether.test(biome);
|
||||
case NETHER -> isNether.test(biome);
|
||||
case END -> biome.is(BiomeTags.IS_END);
|
||||
case TERRAIN -> throw new IllegalArgumentException("Terrain Native uses its own preset");
|
||||
}).map(biome -> biome.key().identifier()).toList();
|
||||
// Built-in family members remain recognizable if a data pack replaces the broad tags.
|
||||
List<String> vanilla = switch (kind) {
|
||||
case CAVES -> List.of("lush_caves", "dripstone_caves", "deep_dark", "sulfur_caves");
|
||||
case NETHER -> List.of("nether_wastes", "soul_sand_valley", "crimson_forest", "warped_forest", "basalt_deltas");
|
||||
case END -> List.of("the_end", "end_highlands", "end_midlands", "small_end_islands", "end_barrens");
|
||||
default -> List.of();
|
||||
};
|
||||
var fallback = vanilla.stream().map(Identifier::withDefaultNamespace)
|
||||
.filter(id -> biomes.get(ResourceKey.create(Registries.BIOME, id))
|
||||
.filter(biome -> kind != NativeBiomeKind.CAVES || !isNether.test(biome)).isPresent());
|
||||
var result = Stream.concat(selected.stream(), fallback).distinct().sorted().toList();
|
||||
if (!result.isEmpty()) return result; // A one-biome family becomes a safe FixedBiomeSource.
|
||||
var safe = kind == NativeBiomeKind.CAVES ? biomes.listElements().filter(biome -> !isNether.test(biome)
|
||||
&& !biome.key().identifier().equals(Identifier.parse("terrablender:deferred_placeholder")))
|
||||
.map(biome -> biome.key().identifier()).sorted().findFirst()
|
||||
: java.util.Optional.<Identifier>empty();
|
||||
return safe.map(List::of).orElseThrow(() -> new IllegalArgumentException("No usable " + kind + " biomes"));
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,11 @@ public final class PortRandomAgeSelection {
|
||||
}
|
||||
if (distribution == PortBiomePlan.Distribution.NATIVE)
|
||||
return new Selection(terrain, new PortBiomePlan(distribution,
|
||||
terrain == PortAgeTerrain.CAVE ? eligible : List.of()));
|
||||
terrain == PortAgeTerrain.CAVE
|
||||
? PortNativeBiomePools.pool(server.registryAccess(), net.dnorberg.rivencraft.shared.NativeBiomeKind.CAVES)
|
||||
: List.of(), terrain == PortAgeTerrain.CAVE
|
||||
? net.dnorberg.rivencraft.shared.NativeBiomeKind.CAVES
|
||||
: net.dnorberg.rivencraft.shared.NativeBiomeKind.TERRAIN));
|
||||
|
||||
int count = distribution == PortBiomePlan.Distribution.SINGLE ? 1 : 2;
|
||||
if (count > 1) {
|
||||
|
||||
@@ -53,7 +53,7 @@ public record PortRandomPagePolicy(Set<Identifier> allowlist, Set<Identifier> bl
|
||||
|
||||
private static String category(Identifier id) {
|
||||
String path = id.getPath();
|
||||
if (path.startsWith("biome/") && java.util.Set.of("native", "single", "tiled", "grid",
|
||||
if (path.startsWith("biome/") && java.util.Set.of("native", "native_caves", "native_nether", "native_end", "single", "tiled", "grid",
|
||||
"tiny", "small", "medium", "large", "huge").contains(path.substring("biome/".length())))
|
||||
return "biome_distribution";
|
||||
return path.substring(0, path.indexOf('/') < 0 ? path.length() : path.indexOf('/'));
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package net.dnorberg.rivencraft.age;
|
||||
|
||||
import java.util.List;
|
||||
import net.dnorberg.rivencraft.shared.StaticSkyResolution;
|
||||
import net.minecraft.resources.Identifier;
|
||||
|
||||
public final class PortStaticSkyResolution {
|
||||
public static final Identifier PAGE = Identifier.fromNamespaceAndPath("rivencraft", "sky/static");
|
||||
private PortStaticSkyResolution() {}
|
||||
|
||||
public static int compile(List<Identifier> pages) {
|
||||
return StaticSkyResolution.requested(pages.stream().map(page -> {
|
||||
int number = PortAgeColors.number(page);
|
||||
if (number >= 0) return number;
|
||||
if (page.equals(PAGE)) return StaticSkyResolution.STATIC;
|
||||
return PortSkyStyle.forPage(page) != null
|
||||
? StaticSkyResolution.OTHER_SKY : StaticSkyResolution.OTHER;
|
||||
}).toList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package net.dnorberg.rivencraft.age;
|
||||
|
||||
import java.util.Optional;
|
||||
import net.dnorberg.rivencraft.writing.PortRegistryPages;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
import net.dnorberg.rivencraft.shared.DesertVegetation;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
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.Blocks;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.placement.BiomeFilter;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementContext;
|
||||
|
||||
/** Routes only the three generic plant pages by the actual candidate biome. */
|
||||
public final class PortSurfaceVegetation {
|
||||
public static final TagKey<Biome> DESERTS = TagKey.create(Registries.BIOME,
|
||||
Identifier.fromNamespaceAndPath("rivencraft", "desert_vegetation"));
|
||||
|
||||
private PortSurfaceVegetation() {}
|
||||
|
||||
public static boolean isDesert(Holder<Biome> biome) {
|
||||
return biome.is(DESERTS) && (!biome.is(net.minecraft.tags.BiomeTags.IS_END) && !PortRegistryPages.isCaveBiome(biome));
|
||||
}
|
||||
|
||||
public static void place(WorldGenLevel level, ChunkGenerator generator, ChunkAccess chunk,
|
||||
String page, Identifier placedId, RandomSource random) {
|
||||
DesertVegetation.Kind kind = switch (page) {
|
||||
case "flowers" -> DesertVegetation.Kind.FLOWERS;
|
||||
case "trees" -> DesertVegetation.Kind.TREES;
|
||||
case "huge_trees" -> DesertVegetation.Kind.HUGE_TREES;
|
||||
default -> throw new IllegalArgumentException("Not a generic vegetation page: " + page);
|
||||
};
|
||||
int x = chunk.getPos().getMinBlockX();
|
||||
int z = chunk.getPos().getMinBlockZ();
|
||||
// Separate streams keep ordinary non-desert placement independent of desert attempts.
|
||||
RandomSource desertRandom = RandomSource.create(random.nextLong());
|
||||
DesertVegetation.place(new DesertVegetation.World() {
|
||||
public int surfaceY(int px, int pz) {
|
||||
return level.getHeight(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, px, pz);
|
||||
}
|
||||
public int maxY() { return level.getMaxY(); }
|
||||
public boolean desert(int px, int py, int pz) {
|
||||
return isDesert(level.getBiome(new BlockPos(px, py, pz)));
|
||||
}
|
||||
public DesertVegetation.Ground ground(int px, int py, int pz) {
|
||||
var state = level.getBlockState(new BlockPos(px, py, pz));
|
||||
if (state.is(Blocks.SAND) || state.is(Blocks.RED_SAND)) return DesertVegetation.Ground.SAND;
|
||||
// Modern dirt and grass-like soils are separate tags.
|
||||
return (state.is(BlockTags.DIRT) || state.is(BlockTags.GRASS_BLOCKS))
|
||||
&& level.getBlockState(new BlockPos(px, py - 1, pz)).isFaceSturdy(
|
||||
level, new BlockPos(px, py - 1, pz), net.minecraft.core.Direction.UP)
|
||||
? DesertVegetation.Ground.SOIL : DesertVegetation.Ground.OTHER;
|
||||
}
|
||||
public boolean air(int px, int py, int pz) {
|
||||
return level.getBlockState(new BlockPos(px, py, pz)).isAir();
|
||||
}
|
||||
public void set(int px, int py, int pz, DesertVegetation.Plant plant) {
|
||||
var block = switch (plant) {
|
||||
case SAND -> Blocks.SAND;
|
||||
case CACTUS -> Blocks.CACTUS;
|
||||
case DEAD_BUSH -> Blocks.DEAD_BUSH;
|
||||
};
|
||||
level.setBlock(new BlockPos(px, py, pz), block.defaultBlockState(), 2);
|
||||
}
|
||||
}, kind, x, z, desertRandom::nextInt);
|
||||
|
||||
var vanilla = level.registryAccess().lookupOrThrow(Registries.PLACED_FEATURE)
|
||||
.getOrThrow(ResourceKey.create(Registries.PLACED_FEATURE, placedId)).value();
|
||||
var context = new PlacementContext(level, generator, Optional.empty());
|
||||
placeOrdinary(vanilla, context, random, 0, new BlockPos(x, level.getMinY(), z));
|
||||
}
|
||||
|
||||
private static void placeOrdinary(PlacedFeature feature, PlacementContext context,
|
||||
RandomSource random, int index, BlockPos position) {
|
||||
if (index == feature.placement().size()) {
|
||||
Holder<Biome> biome = context.getLevel().getBiome(position);
|
||||
if (!biome.is(net.minecraft.tags.BiomeTags.IS_END)
|
||||
&& !PortRegistryPages.isCaveBiome(biome) && !isDesert(biome))
|
||||
feature.feature().value().place(context.getLevel(), context.generator(), random, position);
|
||||
return;
|
||||
}
|
||||
var modifier = feature.placement().get(index);
|
||||
if (modifier instanceof BiomeFilter) {
|
||||
placeOrdinary(feature, context, random, index + 1, position);
|
||||
} else {
|
||||
modifier.modify(context, random, position,
|
||||
candidate -> placeOrdinary(feature, context, random, index + 1, candidate));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -538,7 +538,8 @@ public final class RuntimeAgeBackend {
|
||||
ResourceKey<Level> key = ResourceKey.create(Registries.DIMENSION, id);
|
||||
if (server.getLevel(key) != null) throw new IllegalArgumentException("Level already loaded: " + id);
|
||||
if (biomePlan != null && biomePlan.distribution() == PortBiomePlan.Distribution.NATIVE
|
||||
&& !biomePlan.biomes().isEmpty() && terrain != PortAgeTerrain.CAVE)
|
||||
&& !biomePlan.biomes().isEmpty() && terrain != PortAgeTerrain.CAVE
|
||||
&& biomePlan.nativeKind() == net.dnorberg.rivencraft.shared.NativeBiomeKind.TERRAIN)
|
||||
throw new IllegalArgumentException("Only Native Cave terrain may carry an explicit native biome pool");
|
||||
|
||||
// Noise terrains reuse the Overworld biome source unless a
|
||||
@@ -577,15 +578,24 @@ public final class RuntimeAgeBackend {
|
||||
generator = biomePlan != null && biomePlan.biomes().size() > 1
|
||||
? new PortFlatChunkGenerator(authoredBiomeSource(server, biomePlan, seed), settings)
|
||||
: new FlatLevelSource(settings);
|
||||
} else if ((biomePlan != null && biomePlan.distribution() != PortBiomePlan.Distribution.NATIVE)
|
||||
} else if ((biomePlan != null && (biomePlan.distribution() != PortBiomePlan.Distribution.NATIVE
|
||||
|| biomePlan.nativeKind() != net.dnorberg.rivencraft.shared.NativeBiomeKind.TERRAIN))
|
||||
|| terrain != PortAgeTerrain.STANDARD) {
|
||||
if (!(generator instanceof NoiseBasedChunkGenerator noise))
|
||||
throw new IllegalStateException("Overworld generator cannot accept authored noise settings");
|
||||
// A Flat/skyblock Overworld has no noise generator to adapt. Native
|
||||
// family pages must still work with an independently authored noise terrain.
|
||||
NoiseBasedChunkGenerator noise = generator instanceof NoiseBasedChunkGenerator existingNoise ? existingNoise
|
||||
: new NoiseBasedChunkGenerator(
|
||||
net.minecraft.world.level.biome.MultiNoiseBiomeSource.createFromPreset(
|
||||
server.registryAccess().lookupOrThrow(Registries.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST)
|
||||
.getOrThrow(ResourceKey.create(Registries.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST,
|
||||
Identifier.withDefaultNamespace("overworld")))),
|
||||
server.registryAccess().lookupOrThrow(Registries.NOISE_SETTINGS).getOrThrow(NoiseGeneratorSettings.OVERWORLD));
|
||||
var source = terrain == PortAgeTerrain.CAVE
|
||||
? new FixedBiomeSource(server.registryAccess().lookupOrThrow(Registries.BIOME)
|
||||
.getOrThrow(Biomes.LUSH_CAVES))
|
||||
: generator.getBiomeSource();
|
||||
if (terrain == PortAgeTerrain.CAVE && biomePlan != null) {
|
||||
: noise.getBiomeSource();
|
||||
if (terrain == PortAgeTerrain.CAVE && biomePlan != null
|
||||
&& biomePlan.nativeKind() == net.dnorberg.rivencraft.shared.NativeBiomeKind.TERRAIN) {
|
||||
var biomes = server.registryAccess().lookupOrThrow(Registries.BIOME);
|
||||
for (Identifier biomeId : biomePlan.biomes()) {
|
||||
var holder = biomes.get(ResourceKey.create(Registries.BIOME, biomeId))
|
||||
@@ -595,6 +605,7 @@ public final class RuntimeAgeBackend {
|
||||
}
|
||||
}
|
||||
if (biomePlan != null && (biomePlan.distribution() != PortBiomePlan.Distribution.NATIVE
|
||||
|| biomePlan.nativeKind() != net.dnorberg.rivencraft.shared.NativeBiomeKind.TERRAIN
|
||||
|| terrain == PortAgeTerrain.CAVE && !biomePlan.biomes().isEmpty())) {
|
||||
source = authoredBiomeSource(server, biomePlan, seed);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public final class CrystalPortalBlock extends BaseEntityBlock {
|
||||
@Override protected RenderShape getRenderShape(BlockState state) {
|
||||
// Keep the animated fallback until the optional destination view has
|
||||
// actually been established, including after a world restart.
|
||||
return net.dnorberg.rivencraft.compat.RebornBookPreviews.available() && state.getValue(LIVE_VIEW)
|
||||
return net.dnorberg.rivencraft.compat.ImmersiveBookPreviews.available() && state.getValue(LIVE_VIEW)
|
||||
? RenderShape.INVISIBLE : RenderShape.MODEL;
|
||||
}
|
||||
@Override public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ public final class BookReceptacleBlockEntity extends BlockEntity {
|
||||
public int skyColor() { return skyColor; }
|
||||
public void setBook(ItemStack value) {
|
||||
if (level instanceof ServerLevel server)
|
||||
net.dnorberg.rivencraft.compat.RebornCrystalPortals.remove(server, worldPosition);
|
||||
net.dnorberg.rivencraft.compat.ImmersiveCrystalPortals.remove(server, worldPosition);
|
||||
book = value.copyWithCount(1);
|
||||
restore = true;
|
||||
skyColor = 0xffffff;
|
||||
@@ -58,7 +58,7 @@ public final class BookReceptacleBlockEntity extends BlockEntity {
|
||||
}
|
||||
public ItemStack takeBook() {
|
||||
if (level instanceof ServerLevel server)
|
||||
net.dnorberg.rivencraft.compat.RebornCrystalPortals.remove(server, worldPosition);
|
||||
net.dnorberg.rivencraft.compat.ImmersiveCrystalPortals.remove(server, worldPosition);
|
||||
ItemStack result = book; book = ItemStack.EMPTY; skyColor = 0xffffff; sync(); return result;
|
||||
}
|
||||
private void sync() {
|
||||
|
||||
+5
-5
@@ -18,12 +18,12 @@ import qouteall.imm_ptl.core.ClientWorldLoader;
|
||||
import qouteall.imm_ptl.core.render.GuiPortalRendering;
|
||||
import qouteall.imm_ptl.core.render.context_management.WorldRenderInfo;
|
||||
|
||||
/** Reborn renders before GUI drawing; the deferred GUI samples its target normally. */
|
||||
public final class RebornLiveBookPanel implements PortBookPreview.LivePanel {
|
||||
/** The portal engine renders before GUI drawing; the deferred GUI samples its target normally. */
|
||||
public final class ImmersiveLiveBookPanel implements PortBookPreview.LivePanel {
|
||||
// The engine retains queued tasks. Keep one reusable target alive across screen
|
||||
// removal instead of deleting textures still referenced by a queued GUI frame.
|
||||
private static RenderTarget target;
|
||||
private static RebornLiveBookPanel queued;
|
||||
private static ImmersiveLiveBookPanel queued;
|
||||
private LinkBookTarget destination;
|
||||
private boolean closed;
|
||||
private boolean exploring;
|
||||
@@ -71,11 +71,11 @@ public final class RebornLiveBookPanel implements PortBookPreview.LivePanel {
|
||||
.setCameraTransformation(transform).setOverwriteCameraTransformation(true)
|
||||
.setRenderDistance(Math.min(8, minecraft.options.getEffectiveRenderDistance()))
|
||||
.setDoRenderHand(false).setEnableViewBobbing(false).setDoRenderSky(true).setHasFog(true).build();
|
||||
// Overlay-to-screen transitions can extract this panel twice before Reborn
|
||||
// Overlay-to-screen transitions can extract this panel twice before the portal engine
|
||||
// drains its queue. Its API accepts only one task per target until then.
|
||||
// Reuse that pending view for subsequent draws instead of submitting twice.
|
||||
if (queued == null) {
|
||||
// Submit first: Reborn may resize the target and invalidate its texture view.
|
||||
// Submit first: The portal engine may resize the target and invalidate its texture view.
|
||||
// GPU clearing happens in beginRender(), before remote rendering.
|
||||
GuiPortalRendering.submitNextFrameRendering(info, target);
|
||||
queued = this;
|
||||
@@ -1,8 +1,7 @@
|
||||
package net.dnorberg.rivencraft.client;
|
||||
|
||||
import java.util.UUID;
|
||||
import net.dnorberg.rivencraft.PortConfig;
|
||||
import net.dnorberg.rivencraft.compat.RebornBookPreviews;
|
||||
import net.dnorberg.rivencraft.compat.ImmersiveBookPreviews;
|
||||
import net.dnorberg.rivencraft.network.*;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||
@@ -35,8 +34,8 @@ public final class PortBookPreview {
|
||||
request = minecraft.level == null ? null : new RequestBookPreviewPayload(session,
|
||||
hand == InteractionHand.OFF_HAND, stand != null, minecraft.level.dimension().identifier(),
|
||||
stand == null ? BlockPos.ZERO : stand.pos(), book.copy());
|
||||
boolean enabled = RebornBookPreviews.available() && PortConfig.LIVE_BOOK_PREVIEWS.get();
|
||||
live = enabled ? new RebornLiveBookPanel() : null;
|
||||
boolean enabled = ImmersiveBookPreviews.bookViewsEnabled();
|
||||
live = enabled ? new ImmersiveLiveBookPanel() : null;
|
||||
if (active != null) active.close();
|
||||
active = this;
|
||||
sendRequest();
|
||||
|
||||
@@ -10,33 +10,43 @@ import com.mojang.renderpearl.api.buffers.GpuBuffer;
|
||||
import com.mojang.renderpearl.api.buffers.GpuBufferSlice;
|
||||
import com.mojang.renderpearl.api.pipeline.PrimitiveTopology;
|
||||
import java.util.Optional;
|
||||
import net.dnorberg.rivencraft.shared.StaticSkyResolution;
|
||||
import java.util.OptionalDouble;
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.joml.Matrix4f;
|
||||
|
||||
/** Legacy's six 48x48 noise faces, uploaded once per animation frame rather than per cell. */
|
||||
/** Six bounded authored-resolution noise faces, uploaded once per animation frame rather than per cell. */
|
||||
public final class PortStaticSky implements AutoCloseable {
|
||||
private static final int GRID = 48;
|
||||
private final DynamicTexture texture = new DynamicTexture("Rivencraft static sky", GRID * 6, GRID, false);
|
||||
private int grid;
|
||||
private DynamicTexture texture;
|
||||
private final GpuBuffer cube = buildCube();
|
||||
private long uploadedFrame = Long.MIN_VALUE;
|
||||
private int uploadedTint = -1;
|
||||
|
||||
public void render(RenderTarget target, GpuBufferSlice fog, long frame, int tint) {
|
||||
public void render(RenderTarget target, GpuBufferSlice fog, long frame, int tint, int resolution) {
|
||||
int requested = StaticSkyResolution.clamp(resolution);
|
||||
if (texture == null || grid != requested) {
|
||||
var replacement = new DynamicTexture("Rivencraft static sky", requested * 6, requested, false);
|
||||
if (texture != null) texture.close();
|
||||
texture = replacement;
|
||||
grid = requested;
|
||||
uploadedFrame = Long.MIN_VALUE;
|
||||
uploadedTint = -1;
|
||||
}
|
||||
if (tint < 0) tint = 0x929292;
|
||||
if (uploadedFrame != frame || uploadedTint != tint) {
|
||||
RandomSource random = RandomSource.create(frame);
|
||||
var image = texture.getPixels();
|
||||
for (int face = 0; face < 6; face++) {
|
||||
for (int y = 0; y < GRID; y++) {
|
||||
for (int x = 0; x < GRID; x++) {
|
||||
for (int y = 0; y < grid; y++) {
|
||||
for (int x = 0; x < grid; x++) {
|
||||
int noise = 65 + random.nextInt(160);
|
||||
int red = (tint >> 16 & 255) * noise / 255;
|
||||
int green = (tint >> 8 & 255) * noise / 255;
|
||||
int blue = (tint & 255) * noise / 255;
|
||||
image.setPixel(face * GRID + x, y, 0xff000000 | red << 16 | green << 8 | blue);
|
||||
image.setPixel(face * grid + x, y, 0xff000000 | red << 16 | green << 8 | blue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,6 +98,6 @@ public final class PortStaticSky implements AutoCloseable {
|
||||
|
||||
@Override public void close() {
|
||||
cube.close();
|
||||
texture.close();
|
||||
if (texture != null) texture.close();
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ public interface StaticSkyState {
|
||||
void rivencraft$bodies(java.util.List<Body> bodies);
|
||||
long rivencraft$staticFrame();
|
||||
void rivencraft$staticFrame(long frame);
|
||||
int rivencraft$staticResolution();
|
||||
void rivencraft$staticResolution(int resolution);
|
||||
int rivencraft$skyTint();
|
||||
void rivencraft$skyTint(int color);
|
||||
int rivencraft$orbitBearing();
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package net.dnorberg.rivencraft.compat;
|
||||
|
||||
import net.dnorberg.rivencraft.Rivencraft;
|
||||
import net.dnorberg.rivencraft.PortConfig;
|
||||
import net.dnorberg.rivencraft.network.RequestBookPreviewPayload;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.neoforged.fml.ModList;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
|
||||
/** No optional API appears in common class signatures. */
|
||||
public final class ImmersiveBookPreviews {
|
||||
public static boolean reborn() { return ModList.get().isLoaded("immersive_portals_reborn"); }
|
||||
public static boolean seamless() { return ModList.get().isLoaded("seamlessportals"); }
|
||||
public static boolean available() { return reborn() || seamless(); }
|
||||
public static String engineName() { return seamless() ? "Seamless" : "Reborn"; }
|
||||
public static boolean bookViewsEnabled() {
|
||||
return seamless() ? PortConfig.SEAMLESS_BOOK_PREVIEWS.get()
|
||||
: reborn() && PortConfig.LIVE_BOOK_PREVIEWS.get();
|
||||
}
|
||||
public static boolean crystalViewsEnabled() {
|
||||
return seamless() ? PortConfig.SEAMLESS_CRYSTAL_VIEWS.get()
|
||||
: reborn() && PortConfig.CRYSTAL_LIVE_VIEWS.get();
|
||||
}
|
||||
public static void open(ServerPlayer player, RequestBookPreviewPayload payload) {
|
||||
if (!available()) return;
|
||||
try { ImmersivePreviewChunks.open(player, payload); }
|
||||
catch (RuntimeException | LinkageError error) {
|
||||
Rivencraft.LOGGER.warn("{} book preview unavailable; retaining animated panel", engineName(), error);
|
||||
ImmersivePreviewChunks.close(player);
|
||||
}
|
||||
}
|
||||
public static void release(ServerPlayer player, java.util.UUID session) {
|
||||
if (available()) ImmersivePreviewChunks.release(player, session);
|
||||
}
|
||||
public static void register() {
|
||||
if (!available()) return;
|
||||
NeoForge.EVENT_BUS.addListener((net.neoforged.neoforge.event.tick.ServerTickEvent.Post event) -> ImmersivePreviewChunks.tick(event.getServer()));
|
||||
NeoForge.EVENT_BUS.addListener((net.neoforged.neoforge.event.entity.player.PlayerEvent.PlayerLoggedOutEvent event) -> {
|
||||
if (event.getEntity() instanceof ServerPlayer player) ImmersivePreviewChunks.logout(player);
|
||||
});
|
||||
NeoForge.EVENT_BUS.addListener((net.neoforged.neoforge.event.entity.player.PlayerEvent.PlayerChangedDimensionEvent event) -> {
|
||||
if (event.getEntity() instanceof ServerPlayer player) ImmersivePreviewChunks.close(player);
|
||||
});
|
||||
NeoForge.EVENT_BUS.addListener((net.neoforged.neoforge.event.server.ServerStoppingEvent event) -> ImmersivePreviewChunks.stop());
|
||||
}
|
||||
private ImmersiveBookPreviews() {}
|
||||
}
|
||||
+9
-10
@@ -1,6 +1,5 @@
|
||||
package net.dnorberg.rivencraft.compat;
|
||||
|
||||
import net.dnorberg.rivencraft.PortConfig;
|
||||
import net.dnorberg.rivencraft.Rivencraft;
|
||||
import net.dnorberg.rivencraft.portal.CrystalPortalNetwork;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -8,23 +7,23 @@ import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
/** Render-only optional integration. Crystal portal blocks retain all travel rules. */
|
||||
public final class RebornCrystalPortals {
|
||||
public final class ImmersiveCrystalPortals {
|
||||
public static void refresh(ServerLevel source, BlockPos owner, CrystalPortalNetwork.Plan plan, ItemStack book) {
|
||||
boolean live = false;
|
||||
if (RebornBookPreviews.available()) {
|
||||
if (ImmersiveBookPreviews.available()) {
|
||||
try {
|
||||
if (!book.isEmpty() && PortConfig.CRYSTAL_LIVE_VIEWS.get())
|
||||
live = RebornCrystalView.refresh(source, owner, plan, book);
|
||||
else RebornCrystalView.remove(source, owner);
|
||||
if (!book.isEmpty() && ImmersiveBookPreviews.crystalViewsEnabled())
|
||||
live = ImmersiveCrystalView.refresh(source, owner, plan, book);
|
||||
else ImmersiveCrystalView.remove(source, owner);
|
||||
} catch (RuntimeException | LinkageError failure) {
|
||||
Rivencraft.LOGGER.warn("Could not establish Reborn crystal view at {}; retaining portal travel and fallback", owner, failure);
|
||||
RebornCrystalView.remove(source, owner);
|
||||
Rivencraft.LOGGER.warn("Could not establish immersive crystal view at {}; retaining portal travel and fallback", owner, failure);
|
||||
ImmersiveCrystalView.remove(source, owner);
|
||||
}
|
||||
}
|
||||
CrystalPortalNetwork.setLiveView(source, plan, live);
|
||||
}
|
||||
public static void remove(ServerLevel source, BlockPos owner) {
|
||||
if (RebornBookPreviews.available()) RebornCrystalView.remove(source, owner);
|
||||
if (ImmersiveBookPreviews.available()) ImmersiveCrystalView.remove(source, owner);
|
||||
}
|
||||
private RebornCrystalPortals() {}
|
||||
private ImmersiveCrystalPortals() {}
|
||||
}
|
||||
+2
-2
@@ -23,7 +23,7 @@ import qouteall.q_misc_util.my_util.DQuaternion;
|
||||
import qouteall.q_misc_util.my_util.Mesh2D;
|
||||
|
||||
/** One native mesh per coplanar opening/side, not one repeated image per block. */
|
||||
final class RebornCrystalView {
|
||||
final class ImmersiveCrystalView {
|
||||
private static final String PREFIX = "rivencraft:crystal:mc263:v1:";
|
||||
private record View(CrystalPortalSurfaces.Surface surface, Direction normal,
|
||||
LinkBookTarget target, boolean preserveFacing, boolean relative, String tag) {}
|
||||
@@ -127,5 +127,5 @@ final class RebornCrystalView {
|
||||
return to.hamiltonProduct(from.getConjugated()).getNormalized();
|
||||
}
|
||||
private static String ownerTag(BlockPos owner) { return PREFIX + owner.asLong() + ":"; }
|
||||
private RebornCrystalView() {}
|
||||
private ImmersiveCrystalView() {}
|
||||
}
|
||||
+3
-3
@@ -23,7 +23,7 @@ import qouteall.imm_ptl.core.chunk_loading.ChunkLoader;
|
||||
import qouteall.imm_ptl.core.chunk_loading.ImmPtlChunkTracking;
|
||||
|
||||
/** Optional API class: one expiring stream per player, validated before any chunk load. */
|
||||
final class RebornPreviewChunks {
|
||||
final class ImmersivePreviewChunks {
|
||||
private static final Map<ServerPlayer, Lease> LEASES = new IdentityHashMap<>();
|
||||
private static final Map<ServerPlayer, Long> REQUESTS = new IdentityHashMap<>();
|
||||
private static final int LIFETIME = 600;
|
||||
@@ -69,7 +69,7 @@ final class RebornPreviewChunks {
|
||||
var center = BlockPos.containing(target.x(), target.y(), target.z());
|
||||
if (level == null || !level.isInWorldBounds(center) || !level.getWorldBorder().isWithinBounds(center)) return;
|
||||
close(player);
|
||||
// Match the root live renderer's eight-chunk orbit view. Reborn schedules
|
||||
// Match the root live renderer's eight-chunk orbit view. The portal engine schedules
|
||||
// generation/streaming; no synchronous square of getChunk() calls here.
|
||||
var loader = new ChunkLoader(level.dimension(), center.getX() >> 4, center.getZ() >> 4, 8);
|
||||
PortalAPI.addChunkLoaderForPlayer(player, loader);
|
||||
@@ -108,5 +108,5 @@ final class RebornPreviewChunks {
|
||||
for (ServerPlayer player : java.util.List.copyOf(LEASES.keySet())) close(player);
|
||||
REQUESTS.clear();
|
||||
}
|
||||
private RebornPreviewChunks() {}
|
||||
private ImmersivePreviewChunks() {}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package net.dnorberg.rivencraft.compat;
|
||||
|
||||
import net.dnorberg.rivencraft.Rivencraft;
|
||||
import net.dnorberg.rivencraft.network.RequestBookPreviewPayload;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.neoforged.fml.ModList;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
|
||||
/** No optional API appears in common class signatures. */
|
||||
public final class RebornBookPreviews {
|
||||
public static boolean available() { return ModList.get().isLoaded("immersive_portals_reborn"); }
|
||||
public static void open(ServerPlayer player, RequestBookPreviewPayload payload) {
|
||||
if (!available()) return;
|
||||
try { RebornPreviewChunks.open(player, payload); }
|
||||
catch (RuntimeException | LinkageError error) {
|
||||
Rivencraft.LOGGER.warn("Reborn book preview unavailable; retaining animated panel", error);
|
||||
RebornPreviewChunks.close(player);
|
||||
}
|
||||
}
|
||||
public static void release(ServerPlayer player, java.util.UUID session) {
|
||||
if (available()) RebornPreviewChunks.release(player, session);
|
||||
}
|
||||
public static void register() {
|
||||
if (!available()) return;
|
||||
NeoForge.EVENT_BUS.addListener((net.neoforged.neoforge.event.tick.ServerTickEvent.Post event) -> RebornPreviewChunks.tick(event.getServer()));
|
||||
NeoForge.EVENT_BUS.addListener((net.neoforged.neoforge.event.entity.player.PlayerEvent.PlayerLoggedOutEvent event) -> {
|
||||
if (event.getEntity() instanceof ServerPlayer player) RebornPreviewChunks.logout(player);
|
||||
});
|
||||
NeoForge.EVENT_BUS.addListener((net.neoforged.neoforge.event.entity.player.PlayerEvent.PlayerChangedDimensionEvent event) -> {
|
||||
if (event.getEntity() instanceof ServerPlayer player) RebornPreviewChunks.close(player);
|
||||
});
|
||||
NeoForge.EVENT_BUS.addListener((net.neoforged.neoforge.event.server.ServerStoppingEvent event) -> RebornPreviewChunks.stop());
|
||||
}
|
||||
private RebornBookPreviews() {}
|
||||
}
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
package net.dnorberg.rivencraft.mixin;
|
||||
|
||||
import net.dnorberg.rivencraft.client.RebornLiveBookPanel;
|
||||
import net.dnorberg.rivencraft.compat.RebornBookPreviews;
|
||||
import net.dnorberg.rivencraft.client.ImmersiveLiveBookPanel;
|
||||
import net.dnorberg.rivencraft.compat.ImmersiveBookPreviews;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Pseudo;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -10,13 +10,13 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Pseudo
|
||||
@Mixin(targets = "qouteall.imm_ptl.core.render.GuiPortalRendering", remap = false)
|
||||
public abstract class RebornGuiRenderingMixin {
|
||||
public abstract class ImmersiveGuiRenderingMixin {
|
||||
@Inject(method = "_onGameRenderEnd", at = @At("HEAD"), remap = false)
|
||||
private static void rivencraft$clearLiveTarget(CallbackInfo ci) {
|
||||
if (RebornBookPreviews.available()) RebornLiveBookPanel.beginRender();
|
||||
if (ImmersiveBookPreviews.available()) ImmersiveLiveBookPanel.beginRender();
|
||||
}
|
||||
@Inject(method = "_onGameRenderEnd", at = @At("RETURN"), remap = false)
|
||||
private static void rivencraft$restoreCamera(CallbackInfo ci) {
|
||||
if (RebornBookPreviews.available()) RebornLiveBookPanel.endRender();
|
||||
if (ImmersiveBookPreviews.available()) ImmersiveLiveBookPanel.endRender();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.dnorberg.rivencraft.mixin;
|
||||
|
||||
import net.dnorberg.rivencraft.client.RebornPredictionAcks;
|
||||
import net.dnorberg.rivencraft.compat.RebornBookPreviews;
|
||||
import net.dnorberg.rivencraft.compat.ImmersiveBookPreviews;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.multiplayer.ClientPacketListener;
|
||||
@@ -20,7 +20,7 @@ public abstract class RebornBlockAckMixin {
|
||||
@Inject(method = "handleBlockChangedAck", at = @At("HEAD"), cancellable = true)
|
||||
private void rivencraft$ackDuringWorldReset(ClientboundBlockChangedAckPacket packet, CallbackInfo callback) {
|
||||
// Off-thread packets must reach vanilla's normal scheduling path first.
|
||||
if (Minecraft.getInstance().isSameThread() && RebornBookPreviews.available()
|
||||
if (Minecraft.getInstance().isSameThread() && ImmersiveBookPreviews.reborn()
|
||||
&& RebornPredictionAcks.handleDuringWorldReset(level, packet.sequence())) callback.cancel();
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,9 @@ public class StaticSkyRendererMixin {
|
||||
key.identifier().getNamespace().equals("rivencraft")
|
||||
&& key.identifier().getPath().endsWith("_sky_static")).orElse(false);
|
||||
((StaticSkyState) state).rivencraft$staticFrame(enabled ? level.getGameTime() / 2 : Long.MIN_VALUE);
|
||||
((StaticSkyState) state).rivencraft$skyTint(net.dnorberg.rivencraft.age.PortAgeColors.forLevel(level).sky());
|
||||
var colors = net.dnorberg.rivencraft.age.PortAgeColors.forLevel(level);
|
||||
((StaticSkyState) state).rivencraft$skyTint(colors.sky());
|
||||
((StaticSkyState) state).rivencraft$staticResolution(colors.staticResolution());
|
||||
var cycle = net.dnorberg.rivencraft.age.PortDayCycle.forLevel(level);
|
||||
// 0=native Overworld/no authored overlay, 1=fog-only backdrop,
|
||||
// 2=native End backdrop, 3=custom Static backdrop.
|
||||
@@ -132,7 +134,8 @@ public class StaticSkyRendererMixin {
|
||||
}
|
||||
if (frame == Long.MIN_VALUE) return;
|
||||
if (rivencraft$staticSky == null) rivencraft$staticSky = new PortStaticSky();
|
||||
rivencraft$staticSky.render(renderTarget, fog, frame, rivencraft$endTint);
|
||||
rivencraft$staticSky.render(renderTarget, fog, frame, rivencraft$endTint,
|
||||
((StaticSkyState) state).rivencraft$staticResolution());
|
||||
if (((StaticSkyState) state).rivencraft$bodyOverlay() == 3) rivencraft$overlay(fog, state);
|
||||
ci.cancel();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
public class StaticSkyStateMixin implements StaticSkyState {
|
||||
@Unique private long rivencraft$frame = Long.MIN_VALUE;
|
||||
@Unique private int rivencraft$tint = -1;
|
||||
@Unique private int rivencraft$resolution = net.dnorberg.rivencraft.shared.StaticSkyResolution.DEFAULT;
|
||||
public int rivencraft$staticResolution() { return rivencraft$resolution; }
|
||||
public void rivencraft$staticResolution(int resolution) { rivencraft$resolution = resolution; }
|
||||
@Unique private int rivencraft$bearing = -1;
|
||||
@Unique private float rivencraft$sunSize = 1F;
|
||||
@Unique private int rivencraft$celestialTint = -1;
|
||||
@@ -39,6 +42,7 @@ public class StaticSkyStateMixin implements StaticSkyState {
|
||||
private void rivencraft$reset(CallbackInfo ci) {
|
||||
rivencraft$frame = Long.MIN_VALUE;
|
||||
rivencraft$tint = -1;
|
||||
rivencraft$resolution = net.dnorberg.rivencraft.shared.StaticSkyResolution.DEFAULT;
|
||||
rivencraft$bearing = -1;
|
||||
rivencraft$sunSize = 1F;
|
||||
rivencraft$celestialTint = -1;
|
||||
|
||||
@@ -37,12 +37,12 @@ public final class PortBookNetworking {
|
||||
registrar.playToServer(RequestBookPreviewPayload.TYPE, RequestBookPreviewPayload.STREAM_CODEC,
|
||||
(payload, context) -> {
|
||||
if (context.player() instanceof ServerPlayer player)
|
||||
net.dnorberg.rivencraft.compat.RebornBookPreviews.open(player, payload);
|
||||
net.dnorberg.rivencraft.compat.ImmersiveBookPreviews.open(player, payload);
|
||||
});
|
||||
registrar.playToServer(ReleaseBookPreviewPayload.TYPE, ReleaseBookPreviewPayload.STREAM_CODEC,
|
||||
(payload, context) -> {
|
||||
if (context.player() instanceof ServerPlayer player)
|
||||
net.dnorberg.rivencraft.compat.RebornBookPreviews.release(player, payload.session());
|
||||
net.dnorberg.rivencraft.compat.ImmersiveBookPreviews.release(player, payload.session());
|
||||
});
|
||||
registrar.playToServer(SetLinkModifierSeedPayload.TYPE, SetLinkModifierSeedPayload.STREAM_CODEC,
|
||||
(payload, context) -> {
|
||||
|
||||
@@ -176,12 +176,12 @@ public final class CrystalPortalNetwork {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
net.dnorberg.rivencraft.compat.RebornCrystalPortals.refresh(level, receptacle, plan, holder.getBook());
|
||||
net.dnorberg.rivencraft.compat.ImmersiveCrystalPortals.refresh(level, receptacle, plan, holder.getBook());
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void shutdown(ServerLevel level, BlockPos receptacle) {
|
||||
net.dnorberg.rivencraft.compat.RebornCrystalPortals.remove(level, receptacle);
|
||||
net.dnorberg.rivencraft.compat.ImmersiveCrystalPortals.remove(level, receptacle);
|
||||
// A broken support can disconnect the graph. Scan a bounded volume rather
|
||||
// than trusting a path through blocks that no longer exist.
|
||||
for (BlockPos pos : BlockPos.betweenClosed(receptacle.offset(-CLEANUP_RADIUS, -CLEANUP_RADIUS, -CLEANUP_RADIUS),
|
||||
@@ -224,7 +224,7 @@ public final class CrystalPortalNetwork {
|
||||
}
|
||||
orientSurfaces(level, plan);
|
||||
var holder = (BookReceptacleBlockEntity) level.getBlockEntity(receptacle);
|
||||
net.dnorberg.rivencraft.compat.RebornCrystalPortals.refresh(level, receptacle, plan, holder.getBook());
|
||||
net.dnorberg.rivencraft.compat.ImmersiveCrystalPortals.refresh(level, receptacle, plan, holder.getBook());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ public final class PortAuthoredWriting {
|
||||
private static PortBiomePlan.Distribution controller(Identifier page) {
|
||||
if (!page.getNamespace().equals(Rivencraft.MOD_ID)) return null;
|
||||
return switch (page.getPath()) {
|
||||
case "biome/native" -> PortBiomePlan.Distribution.NATIVE;
|
||||
case "biome/native", "biome/native_caves", "biome/native_nether", "biome/native_end" -> PortBiomePlan.Distribution.NATIVE;
|
||||
case "biome/single" -> PortBiomePlan.Distribution.SINGLE;
|
||||
case "biome/tiled" -> PortBiomePlan.Distribution.TILED;
|
||||
case "biome/grid" -> PortBiomePlan.Distribution.GRID;
|
||||
@@ -423,10 +423,15 @@ public final class PortAuthoredWriting {
|
||||
? PortBiomePlan.Distribution.TILED : PortBiomePlan.Distribution.MEDIUM;
|
||||
}
|
||||
if (distribution == PortBiomePlan.Distribution.NATIVE) {
|
||||
var nativePool = caveTerrain
|
||||
? (available != null ? available : net.dnorberg.rivencraft.age.PortRandomAgeSelection.caveBiomes(registries))
|
||||
: List.<Identifier>of();
|
||||
return new PortBiomePlan(distribution, nativePool);
|
||||
var kind = pages.stream().filter(page -> controller(page) == PortBiomePlan.Distribution.NATIVE)
|
||||
.map(page -> net.dnorberg.rivencraft.shared.NativeBiomeKind.controller(
|
||||
page.getPath().substring("biome/".length())))
|
||||
.reduce((prior, current) -> current).orElse(net.dnorberg.rivencraft.shared.NativeBiomeKind.TERRAIN);
|
||||
if (kind == net.dnorberg.rivencraft.shared.NativeBiomeKind.TERRAIN && caveTerrain)
|
||||
kind = net.dnorberg.rivencraft.shared.NativeBiomeKind.CAVES;
|
||||
return new PortBiomePlan(distribution,
|
||||
kind == net.dnorberg.rivencraft.shared.NativeBiomeKind.TERRAIN ? List.of()
|
||||
: net.dnorberg.rivencraft.age.PortNativeBiomePools.pool(registries, kind), kind);
|
||||
}
|
||||
if (distribution != null && available != null) {
|
||||
int minimum = distribution == PortBiomePlan.Distribution.SINGLE ? 1 : 2;
|
||||
|
||||
@@ -29,13 +29,13 @@ public final class PortWritingRecovery {
|
||||
var entry = PortSymbolPages.find(page);
|
||||
if (entry == null || !PortAuthoredWriting.isPageImplemented(page)) { implemented = false; continue; }
|
||||
String role = entry.role();
|
||||
if (pendingNumber != null && !numberTarget(role)
|
||||
&& !(role.equals("color_number") && numberRunTargetsFlooded(pages, index))) {
|
||||
if (pendingNumber != null && !numberTarget(role, page)
|
||||
&& !(role.equals("color_number") && numberRunTargetsInteger(pages, index))) {
|
||||
diagnostics.add(new Diagnostic("misplaced_modifier", pendingNumber, 100));
|
||||
pendingNumber = null;
|
||||
}
|
||||
if (role.equals("color_number")) pendingNumber = index;
|
||||
else if (numberTarget(role)) pendingNumber = null;
|
||||
else if (numberTarget(role, page)) pendingNumber = null;
|
||||
if (MODIFIERS.contains(role)) pendingModifiers.put(role, index);
|
||||
else if (role.equals("celestial")) pendingModifiers.clear();
|
||||
if (SINGULAR.contains(role)) {
|
||||
@@ -56,7 +56,7 @@ public final class PortWritingRecovery {
|
||||
for (int index : pendingModifiers.values())
|
||||
diagnostics.add(new Diagnostic("dangling_modifier", index, 100));
|
||||
Integer controller = last.get("biome_controller");
|
||||
boolean nativeBiomes = controller != null && pages.get(controller).getPath().equals("biome/native");
|
||||
boolean nativeBiomes = controller != null && net.dnorberg.rivencraft.shared.NativeBiomeKind.isController(pages.get(controller).getPath().substring("biome/".length()));
|
||||
boolean single = controller != null && pages.get(controller).getPath().equals("biome/single");
|
||||
if (nativeBiomes && biomes > 0 || single && biomes > 1)
|
||||
diagnostics.add(new Diagnostic("conflict", controller, 500));
|
||||
@@ -79,18 +79,20 @@ public final class PortWritingRecovery {
|
||||
// The port's category compilers select by role, so no physical resort is necessary.
|
||||
return new Result(active, diagnostics, implemented);
|
||||
}
|
||||
private static boolean numberRunTargetsFlooded(List<Identifier> pages, int index) {
|
||||
private static boolean numberRunTargetsInteger(List<Identifier> pages, int index) {
|
||||
for (int next = index + 1; next < pages.size(); next++) {
|
||||
var entry = PortSymbolPages.find(pages.get(next));
|
||||
if (entry == null) return false;
|
||||
if (!entry.role().equals("color_number")) return entry.role().equals("flooding");
|
||||
if (!entry.role().equals("color_number")) return entry.role().equals("flooding")
|
||||
|| pages.get(next).equals(net.dnorberg.rivencraft.age.PortStaticSkyResolution.PAGE);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean numberTarget(String role) {
|
||||
private static boolean numberTarget(String role, Identifier page) {
|
||||
return role.equals("color") || role.equals("period_modifier") || role.equals("angle_modifier")
|
||||
|| role.equals("phase_modifier") || role.equals("size_modifier") || role.equals("flooding");
|
||||
|| role.equals("phase_modifier") || role.equals("size_modifier") || role.equals("flooding")
|
||||
|| page.equals(net.dnorberg.rivencraft.age.PortStaticSkyResolution.PAGE);
|
||||
}
|
||||
private static int stage(String role) {
|
||||
return switch (role) {
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
"values": [
|
||||
"minecraft:lush_caves",
|
||||
"minecraft:dripstone_caves",
|
||||
"minecraft:deep_dark"
|
||||
"minecraft:deep_dark",
|
||||
"minecraft:sulfur_caves",
|
||||
{
|
||||
"id": "#c:is_cave",
|
||||
"required": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
"client": [
|
||||
"StaticSkyStateMixin",
|
||||
"StaticSkyRendererMixin",
|
||||
"RebornGuiRenderingMixin",
|
||||
"ImmersiveGuiRenderingMixin",
|
||||
"ClientLevelSoundMixin",
|
||||
"RebornBlockAckMixin"
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user