mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 16:25:36 +00:00
Keep child biomes when a biome is focused; goto honours focus region
Ported from v3e (af1fe9808,05eed1f6a,eb1a24411). A focused biome now implodes into its children instead of painting the parent everywhere, and region goto checks what the engine actually generates, so a focused region is reachable and the others are not. Locating already covered child biomes and focus.
This commit is contained in:
1 parent
eb7a6e1044
commit
6522174c83
4 files changed
+15
-7
No files matched your search
+1
-1
@@ -107,7 +107,7 @@ final class ModdedLocateCommands {
|
||||
IrisModdedCommands.fail(source, IrisLanguage.plain(ModdedCommandMessages.IRIS_MODDED_COMMANDS_UNKNOWN_REGION_2, MessageArgument.untrusted("key", key)));
|
||||
return 0;
|
||||
}
|
||||
if (!engine.getDimension().getRegions().contains(region.getLoadKey())) {
|
||||
if (!engine.generatesRegion(region)) {
|
||||
IrisModdedCommands.fail(source, IrisLanguage.plain(ModdedCommandMessages.IRIS_MODDED_COMMANDS_IS_NOT_DEFINED_DIMENSION, MessageArgument.untrusted("value", region.getLoadKey())));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -236,8 +236,9 @@ public class IrisComplex implements DataProvider {
|
||||
.bake().scale(1D / engine.getDimension().getContinentZoom()).bake().stream()
|
||||
.convert((v) -> v >= engine.getDimension().getLandChance() ? InferredType.SEA : InferredType.LAND)
|
||||
.cache2D("bridgeStream", engine, cacheSize);
|
||||
ProceduralStream<IrisBiome> proceduralBaseBiomeStream = focusBiome != null ? ProceduralStream.of((x, z) -> focusBiome,
|
||||
Interpolated.of(a -> 0D, a -> focusBiome)) :
|
||||
ProceduralStream<IrisBiome> proceduralBaseBiomeStream = focusBiome != null ? ProceduralStream.of((x, z) -> implode(focusBiome, x, z),
|
||||
Interpolated.of(a -> 0D, a -> focusBiome))
|
||||
.cache2D("baseBiomeStream-focus", engine, cacheSize) :
|
||||
bridgeStream.convertAware2D((t, x, z) -> inferredStreams.get(t).get(x, z))
|
||||
.convertAware2D(this::implode)
|
||||
.cache2D("baseBiomeStream", engine, cacheSize);
|
||||
@@ -253,9 +254,7 @@ public class IrisComplex implements DataProvider {
|
||||
}, Interpolated.DOUBLE).cache2DDouble("heightStream", engine, cacheSize);
|
||||
slopeStream = heightStream.slope(3)
|
||||
.cache2DDouble("slopeStream", engine, cacheSize);
|
||||
trueBiomeStream = focusBiome != null ? ProceduralStream.of((x, y) -> focusBiome, Interpolated.of(a -> 0D,
|
||||
b -> focusBiome))
|
||||
.cache2D("trueBiomeStream-focus", engine, cacheSize) : heightStream
|
||||
trueBiomeStream = focusBiome != null ? baseBiomeStream : heightStream
|
||||
.convertAware2D((h, x, z) -> {
|
||||
IrisBiome mapped = imageMapRuntime.sampleBiome(x, z);
|
||||
return mapped == null
|
||||
|
||||
@@ -339,6 +339,15 @@ public interface Engine extends DataProvider, Fallible, BlockUpdater, Renderer,
|
||||
|
||||
IrisRegion getFocusRegion();
|
||||
|
||||
/** Whether the world generates {@code region}: a world locked to a focus region generates only that one, which the dimension's region list need not name. */
|
||||
default boolean generatesRegion(IrisRegion region) {
|
||||
IrisRegion focusRegion = getFocusRegion();
|
||||
if (focusRegion != null) {
|
||||
return focusRegion.getLoadKey().equals(region.getLoadKey());
|
||||
}
|
||||
return getDimension().getRegions().contains(region.getLoadKey());
|
||||
}
|
||||
|
||||
|
||||
IrisEngineData getEngineData();
|
||||
|
||||
|
||||
@@ -546,7 +546,7 @@ public final class EngineBukkitOps {
|
||||
}
|
||||
|
||||
public static void gotoRegion(Engine engine, IrisRegion r, Player player, boolean teleport) {
|
||||
if (!engine.getDimension().getRegions().contains(r.getLoadKey())) {
|
||||
if (!engine.generatesRegion(r)) {
|
||||
ComponentMessenger.sendSection(player, IrisLanguage.text(BukkitRuntimeMessages.ENGINE_BUKKIT_OPS_IS_NOT_DEFINED_DIMENSION, MessageArgument.untrusted("name", String.valueOf(r.getName()))));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user