mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 00:04:42 +00:00
Merge branch 'wave3/t' into feat/irisapi-host
This commit is contained in:
commit
52f85d7ae2
28 files changed
+1270
-184
No files matched your search
+4
-4
@@ -38,7 +38,7 @@ import art.arcane.iris.core.tools.IrisToolbelt;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.object.loot.InventorySlotType;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.engine.object.terrain.IrisBiomePaletteLayer;
|
||||
import art.arcane.iris.engine.terrain.BiomeLayers;
|
||||
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
||||
import art.arcane.iris.engine.object.entity.IrisEntity;
|
||||
import art.arcane.iris.engine.platform.BukkitEntitySpawner;
|
||||
@@ -556,10 +556,10 @@ public class CommandStudio implements DirectorExecutor {
|
||||
double score = 0;
|
||||
|
||||
int m = 0;
|
||||
for (IrisBiomePaletteLayer j : b.getLayers()) {
|
||||
for (NoiseStyle layerStyle : BiomeLayers.layerStyles(b)) {
|
||||
m++;
|
||||
score += styleTimings.get(j.getStyle().getStyle());
|
||||
vv.add("Palette Layer " + m + ": " + styleTimings.get(j.getStyle().getStyle()));
|
||||
score += styleTimings.get(layerStyle);
|
||||
vv.add("Palette Layer " + m + ": " + styleTimings.get(layerStyle));
|
||||
}
|
||||
|
||||
score += styleTimings.get(b.getBiomeStyle().getStyle());
|
||||
|
||||
@@ -58,6 +58,6 @@ record EngineRuntime(
|
||||
nextBiomeMaxes);
|
||||
}
|
||||
|
||||
record BiomeMaxes(double objectDensity, double layerDensity) {
|
||||
record BiomeMaxes(double objectDensity) {
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,6 @@ import art.arcane.iris.engine.framework.EngineTarget;
|
||||
import art.arcane.iris.engine.framework.EngineWorldManager;
|
||||
import art.arcane.iris.engine.framework.EngineWorldManagerProvider;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.engine.object.terrain.IrisBiomePaletteLayer;
|
||||
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.spi.IrisServices;
|
||||
@@ -197,7 +196,6 @@ final class EngineRuntimeBuilder {
|
||||
|
||||
BiomeMaxes computeBiomeMaxes() {
|
||||
double objectDensity = 0D;
|
||||
double layerDensity = 0D;
|
||||
for (IrisBiome i : engine.getDimension().getReachableBiomes(engine)) {
|
||||
double density = 0;
|
||||
|
||||
@@ -206,15 +204,8 @@ final class EngineRuntimeBuilder {
|
||||
}
|
||||
|
||||
objectDensity = Math.max(objectDensity, density);
|
||||
density = 0;
|
||||
|
||||
for (IrisBiomePaletteLayer j : i.getLayers()) {
|
||||
density++;
|
||||
}
|
||||
|
||||
layerDensity = Math.max(layerDensity, density);
|
||||
}
|
||||
return new BiomeMaxes(objectDensity, layerDensity);
|
||||
return new BiomeMaxes(objectDensity);
|
||||
}
|
||||
|
||||
void restoreRuntimeAfterFailedTransition(EngineRuntime previous) {
|
||||
|
||||
@@ -32,7 +32,6 @@ import art.arcane.iris.engine.object.noise.IrisShapedGeneratorStyle;
|
||||
import art.arcane.iris.spi.IrisPlatforms;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.spi.PlatformBiome;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.iris.util.common.data.DataProvider;
|
||||
import art.arcane.volmlib.util.math.M;
|
||||
@@ -116,8 +115,6 @@ public class IrisComplex implements DataProvider {
|
||||
private ProceduralStream<Double> heightFluidStream;
|
||||
private ProceduralStream<Double> slopeStream;
|
||||
private ProceduralStream<Integer> topSurfaceStream;
|
||||
private ProceduralStream<PlatformBlockState> rockStream;
|
||||
private ProceduralStream<PlatformBlockState> fluidStream;
|
||||
private IrisBiome focusBiome;
|
||||
private IrisRegion focusRegion;
|
||||
private Map<IrisInterpolator, IdentityHashMap<IrisBiome, GeneratorBounds>> generatorBounds;
|
||||
@@ -198,10 +195,6 @@ public class IrisComplex implements DataProvider {
|
||||
|
||||
return value;
|
||||
});
|
||||
rockStream = engine.getDimension().getRockPalette().getLayerGenerator(rng.nextParallelRNG(45), data).stream()
|
||||
.select(engine.getDimension().getRockPalette().getBlockData(data));
|
||||
fluidStream = engine.getDimension().getFluidPalette().getLayerGenerator(rng.nextParallelRNG(78), data).stream()
|
||||
.select(engine.getDimension().getFluidPalette().getBlockData(data));
|
||||
regionStyleStream = engine.getDimension().getRegionStyle().create(rng.nextParallelRNG(883), getData()).stream()
|
||||
.zoom(engine.getDimension().getRegionZoom());
|
||||
regionIdentityStream = regionStyleStream.fit(Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
|
||||
@@ -595,12 +595,6 @@ public class IrisEngine implements Engine {
|
||||
return current == null ? 0D : current.biomeMaxes().objectDensity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxBiomeLayerDensity() {
|
||||
EngineRuntime current = runtime;
|
||||
return current == null ? 0D : current.biomeMaxes().layerDensity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClosed() {
|
||||
return closed;
|
||||
|
||||
@@ -35,7 +35,6 @@ public class UpperDimensionContext implements DataProvider {
|
||||
private final ProceduralStream<Double> heightStream;
|
||||
private final ProceduralStream<IrisBiome> biomeStream;
|
||||
private final ProceduralStream<IrisRegion> regionStream;
|
||||
private final ProceduralStream<PlatformBlockState> rockStream;
|
||||
private final IrisImageMapRuntime imageMapRuntime;
|
||||
private final boolean selfReferencing;
|
||||
|
||||
@@ -46,7 +45,6 @@ public class UpperDimensionContext implements DataProvider {
|
||||
this.heightStream = state.heightStream();
|
||||
this.biomeStream = state.biomeStream();
|
||||
this.regionStream = state.regionStream();
|
||||
this.rockStream = state.rockStream();
|
||||
this.imageMapRuntime = state.imageMapRuntime();
|
||||
this.selfReferencing = state.selfReferencing();
|
||||
}
|
||||
@@ -69,7 +67,6 @@ public class UpperDimensionContext implements DataProvider {
|
||||
complex.getHeightStream(),
|
||||
complex.getTrueBiomeStream(),
|
||||
complex.getRegionStream(),
|
||||
complex.getRockStream(),
|
||||
complex.getImageMapRuntime(),
|
||||
true
|
||||
));
|
||||
@@ -276,10 +273,6 @@ public class UpperDimensionContext implements DataProvider {
|
||||
: implode(resolved, x, z, rng, dataProvider, childSelectionPlans, 3);
|
||||
}).cache2D("upperImageMappedFinalBiomeStream", engine, cacheSize);
|
||||
|
||||
ProceduralStream<PlatformBlockState> rockStream = upperDim.getRockPalette()
|
||||
.getLayerGenerator(rng.nextParallelRNG(45), upperData).stream()
|
||||
.select(upperDim.getRockPalette().getBlockData(upperData));
|
||||
|
||||
return new UpperDimensionContext(new ContextState(
|
||||
upperDim,
|
||||
upperData,
|
||||
@@ -287,7 +280,6 @@ public class UpperDimensionContext implements DataProvider {
|
||||
heightStream,
|
||||
finalBiomeStream,
|
||||
regionStream,
|
||||
rockStream,
|
||||
imageMapRuntime,
|
||||
false
|
||||
));
|
||||
@@ -414,10 +406,6 @@ public class UpperDimensionContext implements DataProvider {
|
||||
return regionStream == null ? null : regionStream.get((double) x, (double) z);
|
||||
}
|
||||
|
||||
public PlatformBlockState getRockBlock(int x, int z) {
|
||||
return rockStream.get((double) x, (double) z);
|
||||
}
|
||||
|
||||
public PlatformBlockState getSurfaceBlock(int x, int z) {
|
||||
return imageMapRuntime.sampleSurfaceBlock(x, z);
|
||||
}
|
||||
@@ -442,7 +430,6 @@ public class UpperDimensionContext implements DataProvider {
|
||||
ProceduralStream<Double> heightStream,
|
||||
ProceduralStream<IrisBiome> biomeStream,
|
||||
ProceduralStream<IrisRegion> regionStream,
|
||||
ProceduralStream<PlatformBlockState> rockStream,
|
||||
IrisImageMapRuntime imageMapRuntime,
|
||||
boolean selfReferencing
|
||||
) {
|
||||
|
||||
@@ -129,8 +129,6 @@ public interface Engine extends DataProvider, Fallible, BlockUpdater, Renderer,
|
||||
|
||||
double getMaxBiomeObjectDensity();
|
||||
|
||||
double getMaxBiomeLayerDensity();
|
||||
|
||||
boolean isClosed();
|
||||
|
||||
default GenerationSessionManager getGenerationSessions() {
|
||||
|
||||
@@ -6,7 +6,6 @@ import art.arcane.iris.engine.framework.EngineMetrics;
|
||||
import art.arcane.iris.engine.object.terrain.floating.FloatingIslandBoundarySampler;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.engine.object.world.region.IrisRegion;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.iris.util.common.parallel.MultiBurst;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -22,8 +21,6 @@ public class ChunkContext {
|
||||
private final int[] roundedHeight;
|
||||
private final ChunkedDataCache<IrisBiome> biome;
|
||||
private final ChunkedDataCache<IrisBiome> cave;
|
||||
private final ChunkedDataCache<PlatformBlockState> rock;
|
||||
private final ChunkedDataCache<PlatformBlockState> fluid;
|
||||
private final ChunkedDataCache<IrisRegion> region;
|
||||
private final FloatingIslandBoundarySampler floatingIslandBoundarySampler;
|
||||
|
||||
@@ -52,8 +49,6 @@ public class ChunkContext {
|
||||
this.roundedHeight = new int[cache ? 256 : 0];
|
||||
this.biome = new ChunkedDataCache<>(complex.getTrueBiomeStream(), x, z, cache);
|
||||
this.cave = new ChunkedDataCache<>(complex.getCaveBiomeStream(), x, z, cache);
|
||||
this.rock = new ChunkedDataCache<>(complex.getRockStream(), x, z, cache);
|
||||
this.fluid = new ChunkedDataCache<>(complex.getFluidStream(), x, z, cache);
|
||||
this.region = new ChunkedDataCache<>(complex.getRegionStream(), x, z, cache);
|
||||
this.floatingIslandBoundarySampler = new FloatingIslandBoundarySampler((wx, wz) -> complex.getTrueBiomeStream().get(wx, wz));
|
||||
|
||||
@@ -61,19 +56,13 @@ public class ChunkContext {
|
||||
PrefillPlan resolvedPlan = prefillPlan == null ? PrefillPlan.NO_CAVE : prefillPlan;
|
||||
boolean capturePrefillMetric = metrics != null;
|
||||
long totalStartNanos = capturePrefillMetric ? System.nanoTime() : 0L;
|
||||
List<Runnable> fillTasks = new ArrayList<>(6);
|
||||
List<Runnable> fillTasks = new ArrayList<>(4);
|
||||
if (resolvedPlan.height) {
|
||||
fillTasks.add(() -> height.fillRounded(roundedHeight));
|
||||
}
|
||||
if (resolvedPlan.biome) {
|
||||
fillTasks.add(new PrefillFillTask(biome));
|
||||
}
|
||||
if (resolvedPlan.rock) {
|
||||
fillTasks.add(new PrefillFillTask(rock));
|
||||
}
|
||||
if (resolvedPlan.fluid) {
|
||||
fillTasks.add(new PrefillFillTask(fluid));
|
||||
}
|
||||
if (resolvedPlan.region) {
|
||||
fillTasks.add(new PrefillFillTask(region));
|
||||
}
|
||||
@@ -148,36 +137,24 @@ public class ChunkContext {
|
||||
return cave;
|
||||
}
|
||||
|
||||
public ChunkedDataCache<PlatformBlockState> getRock() {
|
||||
return rock;
|
||||
}
|
||||
|
||||
public ChunkedDataCache<PlatformBlockState> getFluid() {
|
||||
return fluid;
|
||||
}
|
||||
|
||||
public ChunkedDataCache<IrisRegion> getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public enum PrefillPlan {
|
||||
ALL(true, true, true, true, true, true),
|
||||
NO_CAVE(true, true, false, true, true, true),
|
||||
NONE(false, false, false, false, false, false);
|
||||
ALL(true, true, true, true),
|
||||
NO_CAVE(true, true, false, true),
|
||||
NONE(false, false, false, false);
|
||||
|
||||
private final boolean height;
|
||||
private final boolean biome;
|
||||
private final boolean cave;
|
||||
private final boolean rock;
|
||||
private final boolean fluid;
|
||||
private final boolean region;
|
||||
|
||||
PrefillPlan(boolean height, boolean biome, boolean cave, boolean rock, boolean fluid, boolean region) {
|
||||
PrefillPlan(boolean height, boolean biome, boolean cave, boolean region) {
|
||||
this.height = height;
|
||||
this.biome = biome;
|
||||
this.cave = cave;
|
||||
this.rock = rock;
|
||||
this.fluid = fluid;
|
||||
this.region = region;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ public class DecorantSettingsDecodingTest {
|
||||
JSONObject byId = new JSONObject("{\"iris:decorant\": [{\"chance\": 1}]}");
|
||||
|
||||
assertSame(ModuleSettings.NONE, decoder.decode(Target.BIOME, byId, "biome meadow"));
|
||||
assertEquals(Set.of("decorators", "deposits"), decoder.keys(Target.BIOME));
|
||||
assertTrue(decoder.keys(Target.BIOME).containsAll(Set.of("decorators", "deposits")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -0,0 +1,278 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.core.modules;
|
||||
|
||||
import art.arcane.iris.builtin.post.PostProcessingSettings;
|
||||
import art.arcane.iris.builtin.post.PostProcessingSlabsSettings;
|
||||
import art.arcane.iris.builtin.post.PostProcessingWallsSettings;
|
||||
import art.arcane.iris.builtin.terrain.CaveCeilingLayersSettings;
|
||||
import art.arcane.iris.builtin.terrain.FluidPaletteSettings;
|
||||
import art.arcane.iris.builtin.terrain.LayersSettings;
|
||||
import art.arcane.iris.builtin.terrain.LockLayersMaxSettings;
|
||||
import art.arcane.iris.builtin.terrain.LockLayersSettings;
|
||||
import art.arcane.iris.builtin.terrain.PaletteLayer;
|
||||
import art.arcane.iris.builtin.terrain.RockPaletteSettings;
|
||||
import art.arcane.iris.builtin.terrain.SeaLayersSettings;
|
||||
import art.arcane.iris.builtin.terrain.SlabSettings;
|
||||
import art.arcane.iris.builtin.terrain.WallSettings;
|
||||
import art.arcane.volmlib.util.json.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.host.LoadedPack;
|
||||
import com.volmit.host.ModuleHost;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* The layers, slab, wall, sea layers, cave ceiling layers and locked layers of a biome, the rock and fluid palettes of a
|
||||
* dimension and its post processing switches, as packs have always written them (files of the overworld pack as it was
|
||||
* before the port, copied from the pack backup), read into the settings of the terrain and post modules. The dimension
|
||||
* keys and {@code lockLayersMax} are in no file of that pack, so they are written here.
|
||||
*/
|
||||
public class TerrainSettingsDecodingTest {
|
||||
private static final String PACK = "/art/arcane/iris/core/modules/pack-terrain";
|
||||
|
||||
@Rule
|
||||
public TemporaryFolder folder = new TemporaryFolder();
|
||||
|
||||
private Path packFolder;
|
||||
private LoadedPack pack;
|
||||
private ModuleSettingsDecoder decoder;
|
||||
|
||||
@Before
|
||||
public void loadBuiltIns() throws IOException, URISyntaxException {
|
||||
packFolder = Path.of(TerrainSettingsDecodingTest.class.getResource(PACK).toURI());
|
||||
pack = LoadedPack.load(packFolder, ModuleHost.of(IrisModuleHost.builtInModules())
|
||||
.reservingFields(ModuleTargets.reservedFields())
|
||||
.describingHostTypesIn(IrisModuleHost.HOST_TYPE_PACKAGE).copyingJarsTo(folder.newFolder("copies").toPath()));
|
||||
decoder = new ModuleSettingsDecoder(pack.catalog(), packFolder, Gson::new);
|
||||
}
|
||||
|
||||
@After
|
||||
public void closePack() {
|
||||
pack.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aLockedBiomeReadsItsLayersAndWall() throws IOException {
|
||||
JSONObject biome = file("biomes/mesa/yellow.json");
|
||||
|
||||
ModuleSettings settings = decoder.decode(Target.BIOME, biome, "biome mesa/yellow");
|
||||
|
||||
List<PaletteLayer> layers = settings.find(LayersSettings.class).orElseThrow().layers();
|
||||
assertEquals(biome.getJSONArray("layers").length(), layers.size());
|
||||
PaletteLayer first = layers.getFirst();
|
||||
assertEquals(2, first.minHeight());
|
||||
assertEquals(3, first.maxHeight());
|
||||
assertEquals("STATIC", first.style().style());
|
||||
assertEquals(List.of(BlockSpec.of("minecraft:terracotta")), first.palette());
|
||||
assertEquals(5, first.zoom(), 0);
|
||||
assertTrue(first.slopeCondition().isDefault());
|
||||
assertTrue(settings.find(LockLayersSettings.class).orElseThrow().locked());
|
||||
assertTrue("lockLayersMax is not written in this file", settings.find(LockLayersMaxSettings.class).isEmpty());
|
||||
|
||||
PaletteLayer wall = settings.find(WallSettings.class).orElseThrow().layer();
|
||||
assertEquals("NOWHERE", wall.style().style());
|
||||
assertEquals(List.of(BlockSpec.of("minecraft:red_terracotta"), BlockSpec.of("minecraft:gray_terracotta"), BlockSpec.of("minecraft:yellow_terracotta")),
|
||||
wall.palette());
|
||||
assertTrue(settings.find(SlabSettings.class).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aSlabIsOneLayerWithIrisDefaults() throws IOException {
|
||||
ModuleSettings settings = decoder.decode(Target.BIOME, file("biomes/mountain/shore/beach.json"), "biome mountain/shore/beach");
|
||||
|
||||
PaletteLayer slab = settings.find(SlabSettings.class).orElseThrow().layer();
|
||||
|
||||
assertEquals("STATIC", slab.style().style());
|
||||
assertEquals(List.of(BlockSpec.of("minecraft:stone_slab"), BlockSpec.of("minecraft:air")), slab.palette());
|
||||
assertEquals(1, slab.minHeight());
|
||||
assertEquals(1, slab.maxHeight());
|
||||
assertEquals(5, slab.zoom(), 0);
|
||||
assertEquals(2, settings.find(LayersSettings.class).orElseThrow().layers().size());
|
||||
assertEquals(List.of(BlockSpec.of("minecraft:stone"), BlockSpec.of("minecraft:andesite")), settings.find(LayersSettings.class).orElseThrow().layers().getFirst().palette());
|
||||
assertTrue(settings.find(WallSettings.class).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void seaLayersKeepTheirNoiseAndWeights() throws IOException {
|
||||
JSONObject biome = file("biomes/frozen/sea/river.json");
|
||||
|
||||
List<PaletteLayer> seaLayers = decoder.decode(Target.BIOME, biome, "biome frozen/sea/river").find(SeaLayersSettings.class).orElseThrow().layers();
|
||||
|
||||
assertEquals(biome.getJSONArray("seaLayers").length(), seaLayers.size());
|
||||
PaletteLayer first = seaLayers.getFirst();
|
||||
assertEquals(3, first.minHeight());
|
||||
assertEquals(6, first.maxHeight());
|
||||
assertEquals("NOWHERE", first.style().style());
|
||||
assertEquals(1.16, first.zoom(), 0);
|
||||
assertEquals(5, first.palette().size());
|
||||
assertEquals(2, first.palette().getFirst().weight());
|
||||
assertEquals("minecraft:ice", first.palette().getFirst().block());
|
||||
assertEquals(1, first.palette().get(2).weight());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void caveCeilingLayersAreAListOfLayers() throws IOException {
|
||||
JSONObject biome = file("biomes/carving/polarity-grotto.json");
|
||||
|
||||
List<PaletteLayer> ceiling = decoder.decode(Target.BIOME, biome, "biome carving/polarity-grotto")
|
||||
.find(CaveCeilingLayersSettings.class).orElseThrow().layers();
|
||||
|
||||
assertEquals(1, ceiling.size());
|
||||
assertEquals(1, ceiling.getFirst().minHeight());
|
||||
assertEquals(2, ceiling.getFirst().maxHeight());
|
||||
assertEquals(List.of(BlockSpec.of("minecraft:tuff").withWeight(4), BlockSpec.of("minecraft:moss_block").withWeight(3),
|
||||
BlockSpec.of("minecraft:andesite").withWeight(3)), ceiling.getFirst().palette());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lockLayersMaxIsANumberAndLockLayersABoolean() {
|
||||
ModuleSettings settings = decoder.decode(Target.BIOME, new JSONObject("{\"lockLayers\": false, \"lockLayersMax\": 4}"), "biome mesa");
|
||||
|
||||
assertFalse(settings.find(LockLayersSettings.class).orElseThrow().locked());
|
||||
assertEquals(4, settings.find(LockLayersMaxSettings.class).orElseThrow().layers());
|
||||
assertEquals(7, new LockLayersMaxSettings().layers());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aLayerWrittenWithoutOptionsHasIrisDefaults() {
|
||||
ModuleSettings settings = decoder.decode(Target.BIOME, new JSONObject("{\"layers\": [{}], \"slab\": {}}"), "biome plain");
|
||||
|
||||
PaletteLayer layer = settings.find(LayersSettings.class).orElseThrow().layers().getFirst();
|
||||
assertEquals(List.of(BlockSpec.of("grass_block")), layer.palette());
|
||||
assertEquals(1, layer.minHeight());
|
||||
assertEquals(1, layer.maxHeight());
|
||||
assertEquals(5, layer.zoom(), 0);
|
||||
assertEquals("a slab written as {} is a layer like any other", List.of(BlockSpec.of("grass_block")),
|
||||
settings.find(SlabSettings.class).orElseThrow().layer().palette());
|
||||
assertTrue("a biome that writes nothing has the one grass layer", new LayersSettings().layers().size() == 1);
|
||||
assertTrue(new SlabSettings().layer().palette().isEmpty());
|
||||
assertTrue(new WallSettings().layer().palette().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aLayerMayBeASnippet() throws IOException {
|
||||
Path snippets = Files.createDirectories(folder.newFolder("snippet-pack").toPath().resolve("snippet/biome-palette"));
|
||||
Files.writeString(snippets.resolve("sandy.json"), "{\"minHeight\": 2, \"maxHeight\": 4, \"palette\": [{\"block\": \"sand\"}]}");
|
||||
ModuleSettingsDecoder snippetDecoder = new ModuleSettingsDecoder(pack.catalog(), snippets.getParent().getParent(), Gson::new);
|
||||
|
||||
PaletteLayer layer = snippetDecoder.decode(Target.BIOME, new JSONObject("{\"layers\": [\"snippet/biome-palette/sandy\", \"snippet/sandy\"]}"), "biome dunes")
|
||||
.find(LayersSettings.class).orElseThrow().layers().getFirst();
|
||||
|
||||
assertEquals(4, layer.maxHeight());
|
||||
assertEquals(List.of(BlockSpec.of("sand")), layer.palette());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void theDimensionReadsItsPalettesAndPostProcessingSwitches() {
|
||||
ModuleSettings settings = decoder.decode(Target.DIMENSION, new JSONObject("""
|
||||
{"rockPalette": {"style": {"style": "SIMPLEX", "zoom": 2}, "zoom": 9,
|
||||
"palette": [{"block": "minecraft:stone", "weight": 3}, {"block": "minecraft:granite"}]},
|
||||
"fluidPalette": {"palette": [{"block": "minecraft:lava"}]},
|
||||
"postProcessing": false, "postProcessingSlabs": false, "postProcessingWalls": true}
|
||||
"""), "dimension nether");
|
||||
|
||||
var rock = settings.find(RockPaletteSettings.class).orElseThrow().palette();
|
||||
assertEquals("SIMPLEX", rock.style().style());
|
||||
assertEquals(2, rock.style().zoom(), 0);
|
||||
assertEquals(9, rock.zoom(), 0);
|
||||
assertEquals(List.of(BlockSpec.of("minecraft:stone").withWeight(3), BlockSpec.of("minecraft:granite")), rock.palette());
|
||||
assertEquals(List.of(BlockSpec.of("minecraft:lava")), settings.find(FluidPaletteSettings.class).orElseThrow().palette().palette());
|
||||
assertFalse(settings.find(PostProcessingSettings.class).orElseThrow().enabled());
|
||||
assertFalse(settings.find(PostProcessingSlabsSettings.class).orElseThrow().enabled());
|
||||
assertTrue(settings.find(PostProcessingWallsSettings.class).orElseThrow().enabled());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aDimensionThatWritesNothingIsStoneAndWaterWithPostProcessingOn() {
|
||||
ModuleSettings settings = decoder.decode(Target.DIMENSION, new JSONObject("{}"), "dimension overworld");
|
||||
|
||||
assertTrue(settings.find(RockPaletteSettings.class).isEmpty());
|
||||
assertEquals(List.of(BlockSpec.of("stone")), new RockPaletteSettings().palette().palette());
|
||||
assertEquals(List.of(BlockSpec.of("water")), new FluidPaletteSettings().palette().palette());
|
||||
assertTrue(new PostProcessingSettings().enabled());
|
||||
assertTrue(new PostProcessingSlabsSettings().enabled());
|
||||
assertTrue(new PostProcessingWallsSettings().enabled());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aBooleanWrittenAsAnObjectIsRefused() {
|
||||
IllegalArgumentException refused = assertThrows(IllegalArgumentException.class,
|
||||
() -> decoder.decode(Target.BIOME, new JSONObject("{\"lockLayers\": {\"locked\": true}}"), "biome mesa"));
|
||||
|
||||
assertTrue(refused.getMessage(), refused.getMessage().startsWith("Cannot read settings iris:terrain/lock-layers under \"lockLayers\" in biome mesa:"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void layersWrittenAsAnObjectOfOptionsAreRefused() {
|
||||
IllegalArgumentException refused = assertThrows(IllegalArgumentException.class,
|
||||
() -> decoder.decode(Target.BIOME, new JSONObject("{\"layers\": {\"layers\": []}}"), "biome mesa"));
|
||||
|
||||
assertEquals("Cannot read settings iris:terrain/layers under \"layers\" in biome mesa: write a list, [...], of the layers, not an object of options",
|
||||
refused.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void theTerrainAndPostKeysAreModuleKeysAndNoLongerFieldsOfIris() {
|
||||
assertTrue(decoder.keys(Target.BIOME).containsAll(Set.of("layers", "seaLayers", "caveCeilingLayers", "slab", "wall", "lockLayers", "lockLayersMax")));
|
||||
assertTrue(decoder.keys(Target.DIMENSION).containsAll(Set.of("rockPalette", "fluidPalette", "postProcessing", "postProcessingSlabs", "postProcessingWalls")));
|
||||
for (String key : Set.of("layers", "seaLayers", "caveCeilingLayers", "slab", "wall", "lockLayers", "lockLayersMax")) {
|
||||
assertFalse(key, ModuleTargets.reservedFields().get(Target.BIOME).contains(key));
|
||||
}
|
||||
for (String key : Set.of("rockPalette", "fluidPalette", "postProcessing", "postProcessingSlabs", "postProcessingWalls")) {
|
||||
assertFalse(key, ModuleTargets.reservedFields().get(Target.DIMENSION).contains(key));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void everyTopLevelKeyOfTheseFilesIsAFieldOfIrisOrAKeyOfAModule() throws IOException {
|
||||
Map<String, Target> files = Map.of("biomes/mesa/yellow.json", Target.BIOME, "biomes/mountain/shore/beach.json", Target.BIOME,
|
||||
"biomes/frozen/sea/river.json", Target.BIOME, "biomes/carving/polarity-grotto.json", Target.BIOME);
|
||||
|
||||
for (Map.Entry<String, Target> file : files.entrySet()) {
|
||||
Set<String> unknown = new TreeSet<>(file(file.getKey()).keySet());
|
||||
unknown.removeAll(ModuleTargets.reservedFields().get(file.getValue()));
|
||||
unknown.removeAll(decoder.keys(file.getValue()));
|
||||
assertEquals(file.getKey(), Set.of(), unknown);
|
||||
}
|
||||
}
|
||||
|
||||
private JSONObject file(String name) throws IOException {
|
||||
return new JSONObject(Files.readString(packFolder.resolve(name)));
|
||||
}
|
||||
}
|
||||
@@ -232,6 +232,30 @@ public class SchemaBuilderParityTest {
|
||||
assertFalse("the feature ids are not keys", properties.has("iris:decorant"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void terrainSettingsRenderTheirOneValueUnderTheOldKeys() throws IOException {
|
||||
JSONObject biome = rootProperties(new SchemaBuilder(IrisBiome.class, structureSchemaData()).construct());
|
||||
JSONObject dimension = rootProperties(new SchemaBuilder(IrisDimension.class, structureSchemaData()).construct());
|
||||
|
||||
JSONObject layers = biome.getJSONObject("layers");
|
||||
assertEquals("array", layers.getString("type"));
|
||||
assertEquals("module-art-arcane-iris-builtin-terrain-palettelayer", definitionKey(layers.getJSONObject("items")));
|
||||
assertEquals("a slab is one layer", "module-art-arcane-iris-builtin-terrain-palettelayer", definitionKey(biome.getJSONObject("slab")));
|
||||
assertEquals("module-art-arcane-iris-builtin-terrain-palettelayer", definitionKey(biome.getJSONObject("wall")));
|
||||
assertEquals("array", biome.getJSONObject("seaLayers").getString("type"));
|
||||
assertEquals("array", biome.getJSONObject("caveCeilingLayers").getString("type"));
|
||||
assertEquals("boolean", biome.getJSONObject("lockLayers").getString("type"));
|
||||
assertEquals("integer", biome.getJSONObject("lockLayersMax").getString("type"));
|
||||
assertEquals("module-com-volmit-block-palettespec", definitionKey(dimension.getJSONObject("rockPalette")));
|
||||
assertEquals("module-com-volmit-block-palettespec", definitionKey(dimension.getJSONObject("fluidPalette")));
|
||||
for (String key : List.of("postProcessing", "postProcessingSlabs", "postProcessingWalls")) {
|
||||
assertEquals(key, "boolean", dimension.getJSONObject(key).getString("type"));
|
||||
}
|
||||
for (String id : List.of("iris:terrain/layers", "iris:terrain/slab", "iris:terrain/lock-layers")) {
|
||||
assertFalse("the feature ids are not keys", biome.has(id));
|
||||
}
|
||||
}
|
||||
|
||||
/** A native structure's jigsaw start pool names one of the platform's template pools, and studio lists them. */
|
||||
@Test
|
||||
public void jigsawStartPoolsCompleteThePlatformsTemplatePools() {
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
package art.arcane.iris.engine.actuator;
|
||||
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.iris.core.loader.ResourceLoader;
|
||||
import art.arcane.iris.core.modules.IrisPackResources;
|
||||
import art.arcane.iris.engine.IrisComplex;
|
||||
import art.arcane.iris.engine.UsableBlockPlatform;
|
||||
import art.arcane.iris.engine.object.material.IrisBlockData;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
||||
import art.arcane.iris.engine.terrain.BiomeLayers;
|
||||
import art.arcane.iris.engine.terrain.ResolvedLayer;
|
||||
import art.arcane.iris.engine.terrain.TerrainTestSettings;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.iris.util.project.stream.ProceduralStream;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* Pins what biome layers, sea layers, cave ceiling layers, locked layers, slabs and walls pick for a spread of columns
|
||||
* with a fixed terrain RNG, so they can move out of {@code IrisBiome} and into the terrain module without changing what
|
||||
* a world generates. The transcript hash was taken from {@code IrisBiome.generateLayers} and friends and from
|
||||
* {@code IrisBiomePaletteLayer.get} before they moved; block keys list their properties in name order, because
|
||||
* the old classes listed them in the order of a hash map and the platform does not tell the two apart.
|
||||
*/
|
||||
public class TerrainLayersPinTest {
|
||||
private static final long TERRAIN_SEED = 1337L;
|
||||
private static final int TRANSCRIPT_LENGTH = 143080;
|
||||
private static final int TRANSCRIPT_HASH = 1726319394;
|
||||
private static final int COLUMN_STEP_X = 61;
|
||||
private static final int COLUMN_STEP_Z = 67;
|
||||
private static final int COLUMN_RANGE = 400;
|
||||
|
||||
private static final String MESA = """
|
||||
{"name": "Mesa", "lockLayers": true, "lockLayersMax": 9,
|
||||
"layers": [
|
||||
{"minHeight": 1, "maxHeight": 3, "zoom": 0.3, "style": {"style": "SIMPLEX", "zoom": 1},
|
||||
"palette": [{"block": "red_sand"}, {"block": "terracotta", "weight": 2}, {"block": "orange_terracotta"}, {"block": "yellow_terracotta"}]},
|
||||
{"minHeight": 2, "maxHeight": 5, "palette": [{"block": "white_terracotta"}, {"block": "brown_terracotta", "weight": 3}, {"block": "light_gray_terracotta"}],
|
||||
"style": {"style": "PERLIN", "zoom": 1}, "zoom": 0.2},
|
||||
{"minHeight": 1, "maxHeight": 2, "slopeCondition": {"minimumSlope": 2, "maximumSlope": 8}, "palette": [{"block": "gravel"}]}
|
||||
],
|
||||
"slab": {"style": {"style": "SIMPLEX"}, "zoom": 0.5, "palette": [{"weight": 2, "block": "air"},
|
||||
{"block": "cobblestone_slab", "data": {"waterlogged": false, "type": "bottom"}}, {"block": "stone_slab"}],
|
||||
"slopeCondition": {"maximumSlope": 6}},
|
||||
"wall": {"style": {"style": "SIMPLEX"}, "zoom": 0.4, "palette": [{"block": "stone"}, {"block": "andesite", "weight": 2}, {"block": "diorite"}, {"block": "granite"}]}}
|
||||
""";
|
||||
private static final String MEADOW = """
|
||||
{"name": "Meadow",
|
||||
"layers": [
|
||||
{"minHeight": 1, "maxHeight": 1, "palette": [{"block": "grass_block"}]},
|
||||
{"minHeight": 2, "maxHeight": 4, "zoom": 0.25, "style": {"style": "CELLULAR"}, "palette": [{"block": "dirt"}, {"block": "coarse_dirt"}, {"block": "rooted_dirt"}]},
|
||||
{"minHeight": 8, "maxHeight": 20, "palette": [{"block": "stone"}]}
|
||||
],
|
||||
"caveCeilingLayers": [
|
||||
{"minHeight": 1, "maxHeight": 2, "zoom": 0.3, "style": {"style": "SIMPLEX", "zoom": 1}, "palette": [{"block": "moss_block"}, {"block": "dripstone_block"}, {"block": "clay"}, {"block": "glow_lichen"}]},
|
||||
{"minHeight": 1, "maxHeight": 3, "palette": [{"block": "deepslate"}, {"block": "tuff", "weight": 2}]},
|
||||
{"minHeight": 1, "maxHeight": 1, "palette": [{"block": "calcite"}]},
|
||||
{"minHeight": 1, "maxHeight": 1, "palette": [{"block": "basalt"}]}
|
||||
]}
|
||||
""";
|
||||
private static final String OCEAN = """
|
||||
{"name": "Ocean",
|
||||
"layers": [{"minHeight": 1, "maxHeight": 4, "zoom": 0.3, "style": {"style": "SIMPLEX", "zoom": 1}, "palette": [{"block": "sand"}, {"block": "gravel", "weight": 2}, {"block": "clay"}, {"block": "suspicious_sand"}]}],
|
||||
"seaLayers": [
|
||||
{"minHeight": 1, "maxHeight": 3, "zoom": 0.3, "style": {"style": "PERLIN", "zoom": 1}, "palette": [{"block": "kelp_plant"}, {"block": "water"}, {"block": "seagrass"}, {"block": "sea_pickle"}]},
|
||||
{"minHeight": 0, "maxHeight": 2, "palette": [{"block": "prismarine"}, {"block": "dark_prismarine"}], "zoom": 2}
|
||||
]}
|
||||
""";
|
||||
private static final String DEFAULTS = "{\"name\": \"Plain\"}";
|
||||
private static final String[] BIOMES = {MESA, MEADOW, OCEAN, DEFAULTS};
|
||||
|
||||
private IrisData data;
|
||||
private IrisComplex complex;
|
||||
|
||||
@Before
|
||||
public void bindPlatform() {
|
||||
UsableBlockPlatform.bind();
|
||||
data = mock(IrisData.class);
|
||||
@SuppressWarnings("unchecked")
|
||||
ResourceLoader<IrisBlockData> blocks = mock(ResourceLoader.class);
|
||||
when(data.getBlockLoader()).thenReturn(blocks);
|
||||
when(data.getDataFolder()).thenReturn(new File("pack"));
|
||||
IrisPackResources resources = new IrisPackResources(data);
|
||||
when(data.getPackResources()).thenReturn(resources);
|
||||
complex = mock(IrisComplex.class);
|
||||
when(complex.getSlopeStream()).thenReturn(ProceduralStream.ofDouble((x, z) -> Math.abs((x * 3 + z * 5) % 11)));
|
||||
}
|
||||
|
||||
@After
|
||||
public void unbindPlatform() {
|
||||
UsableBlockPlatform.unbind();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void layersPickAsTheyDidInTheBiome() {
|
||||
StringBuilder transcript = new StringBuilder();
|
||||
for (String json : BIOMES) {
|
||||
for (boolean exploded : new boolean[]{false, true}) {
|
||||
record(transcript, json, exploded);
|
||||
}
|
||||
}
|
||||
|
||||
for (String picked : List.of("terracotta", "prismarine", "moss_block", "cobblestone_slab", "andesite", "barrier")) {
|
||||
assertTrue(picked + " is picked: " + transcript.length(), transcript.indexOf(picked) >= 0);
|
||||
}
|
||||
assertEquals("transcript " + transcript.length() + " / " + transcript.toString().hashCode(), TRANSCRIPT_LENGTH, transcript.length());
|
||||
assertEquals(TRANSCRIPT_HASH, transcript.toString().hashCode());
|
||||
}
|
||||
|
||||
private void record(StringBuilder transcript, String biomeJson, boolean exploded) {
|
||||
IrisDimension dimension = new IrisDimension();
|
||||
dimension.setExplodeBiomePalettes(exploded);
|
||||
dimension.setExplodeBiomePaletteSize(2);
|
||||
RNG rng = new RNG(TERRAIN_SEED);
|
||||
IrisBiome biome = new IrisBiome();
|
||||
biome.setModuleSettings(TerrainTestSettings.of(biomeJson));
|
||||
BiomeLayers layers = new BiomeLayers();
|
||||
for (int x = -COLUMN_RANGE; x < COLUMN_RANGE; x += COLUMN_STEP_X) {
|
||||
for (int z = -COLUMN_RANGE; z < COLUMN_RANGE; z += COLUMN_STEP_Z) {
|
||||
transcript.append('|').append(keys(layers.generateLayers(biome, dimension, x, z, rng, 14, 70 + Math.floorMod(x + z, 9), data, complex)));
|
||||
transcript.append('|').append(keys(layers.generateCeilingLayers(biome, dimension, x, z, rng, 12, 40, data, complex)));
|
||||
transcript.append('|').append(keys(layers.generateSeaLayers(biome, x, z, rng, 7, data)));
|
||||
transcript.append('|').append(smoothing(layers, biome, rng, x, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** The block a slab and a wall place in post processing at the column, as the smoothing stage asks the biome. */
|
||||
private String smoothing(BiomeLayers layers, IrisBiome biome, RNG rng, int x, int z) {
|
||||
int height = 60 + Math.floorMod(x - z, 7);
|
||||
double slope = complex.getSlopeStream().get(x, z);
|
||||
ResolvedLayer slabLayer = layers.slab(biome, data);
|
||||
ResolvedLayer wallLayer = layers.wall(biome, data);
|
||||
String slab = slabLayer.slopeCondition().isValid(slope) ? key(slabLayer.get(rng, x, height, z)) : "-";
|
||||
String wall = !wallLayer.hasPalette() ? "-" : key(wallLayer.get(rng, x + height, height + height, z + height));
|
||||
return slab + "," + wall;
|
||||
}
|
||||
|
||||
private static String keys(KList<PlatformBlockState> states) {
|
||||
StringBuilder keys = new StringBuilder();
|
||||
for (PlatformBlockState state : states) {
|
||||
keys.append(key(state)).append(' ');
|
||||
}
|
||||
return keys.toString();
|
||||
}
|
||||
|
||||
/** The block's key without its namespace and with its properties in name order, which is how the platform identifies a state whatever order a pack lists them in. */
|
||||
private static String key(PlatformBlockState state) {
|
||||
if (state == null) {
|
||||
return "null";
|
||||
}
|
||||
String key = state.key().replace("minecraft:", "");
|
||||
int properties = key.indexOf('[');
|
||||
if (properties < 0) {
|
||||
return key;
|
||||
}
|
||||
String[] sorted = key.substring(properties + 1, key.length() - 1).split(",");
|
||||
java.util.Arrays.sort(sorted);
|
||||
return key.substring(0, properties) + "[" + String.join(",", sorted) + "]";
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import art.arcane.iris.engine.image.IrisImageMapRuntime;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
||||
import art.arcane.iris.engine.object.world.region.IrisRegion;
|
||||
import art.arcane.iris.engine.terrain.BiomeLayers;
|
||||
import art.arcane.iris.engine.terrain.TerrainPalettes;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.iris.util.project.context.ChunkContext;
|
||||
import art.arcane.iris.util.project.context.ChunkedDataCache;
|
||||
@@ -26,6 +28,7 @@ import static org.junit.Assert.assertSame;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyDouble;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@@ -48,13 +51,9 @@ public class TerrainModuleTest {
|
||||
@SuppressWarnings("unchecked")
|
||||
public void aColumnIsBedrockThenRockThenLayersThenFluid() {
|
||||
UsableBlockPlatform.bind();
|
||||
TerrainModule.TerrainShaper shaper = new TerrainModule.TerrainShaper(engine());
|
||||
Hunk<PlatformBlockState> blocks = Hunk.newArrayHunk(16, 64, 16);
|
||||
IrisBiome biome = mock(IrisBiome.class);
|
||||
KList<PlatformBlockState> layers = new KList<>();
|
||||
layers.add(grass, dirt);
|
||||
when(biome.generateLayers(any(), anyDouble(), anyDouble(), any(RNG.class), anyInt(), anyInt(), any(), any())).thenReturn(layers);
|
||||
when(biome.generateSeaLayers(anyDouble(), anyDouble(), any(RNG.class), anyInt(), any())).thenReturn(new KList<>());
|
||||
TerrainModule.TerrainShaper shaper = new TerrainModule.TerrainShaper(engine(), palettes(), layersOf(biome));
|
||||
Hunk<PlatformBlockState> blocks = Hunk.newArrayHunk(16, 64, 16);
|
||||
|
||||
shaper.shape(0, 0, blocks, context(biome));
|
||||
|
||||
@@ -75,19 +74,29 @@ public class TerrainModuleTest {
|
||||
when(biomes.get(anyInt(), anyInt())).thenReturn(biome);
|
||||
ChunkedDataCache<IrisRegion> regions = mock(ChunkedDataCache.class);
|
||||
when(regions.get(anyInt(), anyInt())).thenReturn(mock(IrisRegion.class));
|
||||
ChunkedDataCache<PlatformBlockState> fluids = mock(ChunkedDataCache.class);
|
||||
when(fluids.get(anyInt(), anyInt())).thenReturn(water);
|
||||
ChunkedDataCache<PlatformBlockState> rocks = mock(ChunkedDataCache.class);
|
||||
when(rocks.get(anyInt(), anyInt())).thenReturn(rock);
|
||||
ChunkContext context = mock(ChunkContext.class);
|
||||
when(context.getBiome()).thenReturn(biomes);
|
||||
when(context.getRegion()).thenReturn(regions);
|
||||
when(context.getFluid()).thenReturn(fluids);
|
||||
when(context.getRock()).thenReturn(rocks);
|
||||
when(context.getRoundedHeight(anyInt(), anyInt())).thenReturn(HEIGHT);
|
||||
return context;
|
||||
}
|
||||
|
||||
private TerrainPalettes palettes() {
|
||||
TerrainPalettes palettes = mock(TerrainPalettes.class);
|
||||
when(palettes.rockAt(anyDouble(), anyDouble())).thenReturn(rock);
|
||||
when(palettes.fluidAt(anyDouble(), anyDouble())).thenReturn(water);
|
||||
return palettes;
|
||||
}
|
||||
|
||||
private BiomeLayers layersOf(IrisBiome biome) {
|
||||
KList<PlatformBlockState> layers = new KList<>();
|
||||
layers.add(grass, dirt);
|
||||
BiomeLayers biomeLayers = mock(BiomeLayers.class);
|
||||
when(biomeLayers.generateLayers(eq(biome), any(), anyDouble(), anyDouble(), any(RNG.class), anyInt(), anyInt(), any(), any())).thenReturn(layers);
|
||||
when(biomeLayers.generateSeaLayers(eq(biome), anyDouble(), anyDouble(), any(RNG.class), anyInt(), any())).thenReturn(new KList<>());
|
||||
return biomeLayers;
|
||||
}
|
||||
|
||||
private Engine engine() {
|
||||
IrisDimension dimension = mock(IrisDimension.class);
|
||||
when(dimension.getFluidHeight()).thenReturn(FLUID_HEIGHT);
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
package art.arcane.iris.engine.actuator;
|
||||
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.iris.core.loader.ResourceLoader;
|
||||
import art.arcane.iris.core.modules.IrisPackResources;
|
||||
import art.arcane.iris.engine.UpperDimensionContext;
|
||||
import art.arcane.iris.engine.UsableBlockPlatform;
|
||||
import art.arcane.iris.engine.decorator.DecoratorTestEngines;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.framework.SeedManager;
|
||||
import art.arcane.iris.engine.object.material.IrisBlockData;
|
||||
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
||||
import art.arcane.iris.engine.terrain.TerrainPalettes;
|
||||
import art.arcane.iris.engine.terrain.TerrainTestSettings;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* Pins the blocks the dimension's rock and fluid palettes pick for a spread of columns, so they could move out of
|
||||
* {@code IrisComplex} into the terrain module without changing what a world generates. The hash was taken from the streams
|
||||
* {@code IrisComplex} built from {@code IrisDimension.getRockPalette()} and {@code getFluidPalette()} before they moved,
|
||||
* for the world's complex seed and for the seed an upper dimension derives from it.
|
||||
*/
|
||||
public class TerrainPalettesPinTest {
|
||||
private static final long COMPLEX_SEED = 424242L;
|
||||
private static final String UPPER_DIMENSION_KEY = "upper";
|
||||
private static final long UPPER_DIMENSION_SEED = COMPLEX_SEED ^ UPPER_DIMENSION_KEY.hashCode();
|
||||
private static final int TRANSCRIPT_LENGTH = 154196;
|
||||
private static final int TRANSCRIPT_HASH = 1568450945;
|
||||
private static final int COLUMN_RANGE = 1200;
|
||||
private static final int COLUMN_STEP_X = 53;
|
||||
private static final int COLUMN_STEP_Z = 59;
|
||||
|
||||
private static final String STYLED = """
|
||||
{"rockPalette": {"style": {"style": "SIMPLEX", "zoom": 0.5}, "zoom": 9,
|
||||
"palette": [{"block": "stone", "weight": 3}, {"block": "granite"}, {"block": "andesite", "weight": 2}, {"block": "diorite"}, {"block": "tuff"}]},
|
||||
"fluidPalette": {"style": {"style": "PERLIN", "zoom": 0.3},
|
||||
"palette": [{"block": "water"}, {"block": "lava", "weight": 2}, {"block": "packed_ice"}]}}
|
||||
""";
|
||||
private static final String DEFAULTS = "{}";
|
||||
private static final String SINGLE = "{\"rockPalette\": {\"palette\": [{\"block\": \"netherrack\"}]}, \"fluidPalette\": {\"palette\": [{\"block\": \"lava\"}]}}";
|
||||
|
||||
private IrisData data;
|
||||
|
||||
@Before
|
||||
public void bindPlatform() {
|
||||
UsableBlockPlatform.bind();
|
||||
data = mock(IrisData.class);
|
||||
@SuppressWarnings("unchecked")
|
||||
ResourceLoader<IrisBlockData> blocks = mock(ResourceLoader.class);
|
||||
when(data.getBlockLoader()).thenReturn(blocks);
|
||||
when(data.getDataFolder()).thenReturn(new File("pack"));
|
||||
IrisPackResources resources = new IrisPackResources(data);
|
||||
when(data.getPackResources()).thenReturn(resources);
|
||||
}
|
||||
|
||||
@After
|
||||
public void unbindPlatform() {
|
||||
UsableBlockPlatform.unbind();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rockAndFluidPickAsTheyDidInTheComplex() {
|
||||
StringBuilder transcript = new StringBuilder();
|
||||
for (String json : List.of(STYLED, DEFAULTS, SINGLE)) {
|
||||
IrisDimension dimension = dimension(json);
|
||||
record(transcript, TerrainPalettes.of(engine(dimension, COMPLEX_SEED)));
|
||||
record(transcript, TerrainPalettes.of(engine(dimension, UPPER_DIMENSION_SEED)));
|
||||
}
|
||||
|
||||
for (String picked : List.of("granite", "andesite", "diorite", "tuff", "lava", "packed_ice", "netherrack")) {
|
||||
assertTrue(picked + " is picked", transcript.indexOf(picked) >= 0);
|
||||
}
|
||||
assertEquals("transcript " + transcript.length() + " / " + transcript.toString().hashCode(), TRANSCRIPT_LENGTH, transcript.length());
|
||||
assertEquals(TRANSCRIPT_HASH, transcript.toString().hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void anUpperDimensionPicksItsRockFromTheSeedItDerivesFromTheWorldsAndItsOwnKey() {
|
||||
IrisDimension upperDimension = dimension(STYLED);
|
||||
upperDimension.setLoadKey(UPPER_DIMENSION_KEY);
|
||||
UpperDimensionContext upper = mock(UpperDimensionContext.class);
|
||||
when(upper.isSelfReferencing()).thenReturn(false);
|
||||
when(upper.getDimension()).thenReturn(upperDimension);
|
||||
when(upper.getData()).thenReturn(data);
|
||||
TerrainPalettes world = TerrainPalettes.of(engine(dimension(DEFAULTS), COMPLEX_SEED));
|
||||
TerrainPalettes derived = TerrainPalettes.of(engine(upperDimension, UPPER_DIMENSION_SEED));
|
||||
|
||||
for (int x = -COLUMN_RANGE; x < COLUMN_RANGE; x += COLUMN_STEP_X) {
|
||||
for (int z = -COLUMN_RANGE; z < COLUMN_RANGE; z += COLUMN_STEP_Z) {
|
||||
assertEquals(derived.rockAt(x, z).key(), world.upperRockAt(upper, x, z).key());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aDimensionThatIsItsOwnUpperDimensionSharesItsRock() {
|
||||
TerrainPalettes world = TerrainPalettes.of(engine(dimension(STYLED), COMPLEX_SEED));
|
||||
UpperDimensionContext upper = mock(UpperDimensionContext.class);
|
||||
when(upper.isSelfReferencing()).thenReturn(true);
|
||||
|
||||
assertEquals(world.rockAt(17, -90).key(), world.upperRockAt(upper, 17, -90).key());
|
||||
}
|
||||
|
||||
private IrisDimension dimension(String json) {
|
||||
IrisDimension dimension = new IrisDimension();
|
||||
dimension.setModuleSettings(TerrainTestSettings.of(json));
|
||||
return dimension;
|
||||
}
|
||||
|
||||
private Engine engine(IrisDimension dimension, long complexSeed) {
|
||||
SeedManager seeds = mock(SeedManager.class);
|
||||
when(seeds.getComplex()).thenReturn(complexSeed);
|
||||
Engine engine = mock(Engine.class);
|
||||
when(engine.getDimension()).thenReturn(dimension);
|
||||
when(engine.getData()).thenReturn(data);
|
||||
when(engine.getSeedManager()).thenReturn(seeds);
|
||||
DecoratorTestEngines.withGeneration(engine);
|
||||
return engine;
|
||||
}
|
||||
|
||||
private static void record(StringBuilder transcript, TerrainPalettes palettes) {
|
||||
for (int x = -COLUMN_RANGE; x < COLUMN_RANGE; x += COLUMN_STEP_X) {
|
||||
for (int z = -COLUMN_RANGE; z < COLUMN_RANGE; z += COLUMN_STEP_Z) {
|
||||
transcript.append(palettes.rockAt(x, z).key().replace("minecraft:", "")).append(',')
|
||||
.append(palettes.fluidAt(x, z).key().replace("minecraft:", "")).append(' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -5,6 +5,7 @@ import art.arcane.iris.builtin.carve.CaveProfile;
|
||||
import art.arcane.iris.engine.object.TestSettings;
|
||||
import art.arcane.iris.engine.object.noise.IrisGeneratorStyle;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.iris.builtin.terrain.FluidPaletteSettings;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.framework.EngineMetrics;
|
||||
import art.arcane.iris.engine.framework.SeedManager;
|
||||
@@ -91,12 +92,10 @@ public class IrisCaveCarver3DNearParityTest {
|
||||
@Test
|
||||
public void genericFluidContractKeepsOverworldDefaults() {
|
||||
CaveProfile profile = new CaveProfile();
|
||||
IrisDimension dimension = new IrisDimension();
|
||||
|
||||
assertTrue(profile.allowFluid());
|
||||
assertEquals(12, profile.fluidMinDepthBelowSurface());
|
||||
assertTrue(profile.fluidRequiresFloor());
|
||||
assertEquals("water", dimension.getFluidPalette().getPalette().get(0).getBlock());
|
||||
assertEquals("water", new FluidPaletteSettings().palette().palette().get(0).block());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+4
-2
@@ -1,6 +1,8 @@
|
||||
package art.arcane.iris.engine.modifier;
|
||||
|
||||
import art.arcane.iris.builtin.terrain.LayersSettings;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.iris.core.modules.BuiltInPack;
|
||||
import art.arcane.iris.engine.IrisComplex;
|
||||
import art.arcane.iris.engine.decorator.DecoratorTestEngines;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
@@ -18,6 +20,7 @@ import art.arcane.iris.spi.PlatformRegistries;
|
||||
import art.arcane.iris.util.project.hunk.Hunk;
|
||||
import art.arcane.iris.util.project.stream.ProceduralStream;
|
||||
import art.arcane.volmlib.util.matter.MatterCavern;
|
||||
import com.google.gson.Gson;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
@@ -57,8 +60,7 @@ public class CaveApplyingInferenceIsolationTest {
|
||||
@SuppressWarnings("unchecked")
|
||||
public void cavePaintingDoesNotMutateSharedBiomeInference() throws Exception {
|
||||
IrisBiome biome = new IrisBiome().setInferredType(InferredType.LAND);
|
||||
biome.getLayers().clear();
|
||||
biome.getCaveCeilingLayers().clear();
|
||||
biome.setModuleSettings(BuiltInPack.settings(new Gson().fromJson("{\"layers\": []}", LayersSettings.class)));
|
||||
|
||||
Engine engine = mock(Engine.class);
|
||||
doReturn(mock(IrisData.class)).when(engine).getData();
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
package art.arcane.iris.engine.modifier;
|
||||
|
||||
import art.arcane.iris.builtin.post.PostProcessingSlabsSettings;
|
||||
import art.arcane.iris.builtin.post.PostProcessingWallsSettings;
|
||||
import art.arcane.iris.core.modules.BuiltInPack;
|
||||
import art.arcane.iris.engine.UsableBlockPlatform;
|
||||
import art.arcane.iris.engine.decorator.DecoratorTestEngines;
|
||||
import art.arcane.iris.engine.object.TestSettings;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.framework.EngineMetrics;
|
||||
import art.arcane.iris.engine.framework.SeedManager;
|
||||
@@ -21,7 +26,7 @@ import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/** Smoothing the surface removes a nib that floats above columns two blocks lower and leaves a flat surface alone. */
|
||||
/** Smoothing the surface (here without slabs and walls, which post processing switches off per dimension) removes a nib that floats above columns two blocks lower and leaves a flat surface alone. */
|
||||
public class SurfaceSmoothingTest {
|
||||
private static final int NIB_X = 5;
|
||||
private static final int NIB_Z = 5;
|
||||
@@ -68,12 +73,16 @@ public class SurfaceSmoothingTest {
|
||||
when(mantle.trueHeight(anyInt(), anyInt())).thenAnswer(invocation ->
|
||||
(int) invocation.getArgument(0) == nibX && (int) invocation.getArgument(1) == nibZ ? nibHeight : NEIGHBOUR_HEIGHT);
|
||||
IrisDimension dimension = mock(IrisDimension.class);
|
||||
when(dimension.getModuleSettings()).thenReturn(BuiltInPack.settings(
|
||||
TestSettings.of(PostProcessingWallsSettings.class, "{\"enabled\": false}"),
|
||||
TestSettings.of(PostProcessingSlabsSettings.class, "{\"enabled\": false}")));
|
||||
SeedManager seeds = mock(SeedManager.class);
|
||||
Engine engine = mock(Engine.class);
|
||||
when(engine.getMantle()).thenReturn(mantle);
|
||||
when(engine.getDimension()).thenReturn(dimension);
|
||||
when(engine.getSeedManager()).thenReturn(seeds);
|
||||
when(engine.getMetrics()).thenReturn(new EngineMetrics(16));
|
||||
DecoratorTestEngines.withGeneration(engine);
|
||||
return engine;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ public class FloatingChildBiomeDecodingTest {
|
||||
assertEquals(4, child.edgeTaperVariationAmplitude(), 0);
|
||||
assertEquals(FloatingBottomPaletteMode.CUSTOM, child.bottomPaletteMode());
|
||||
assertEquals(1, child.bottomPalette().size());
|
||||
assertEquals(5, child.bottomPalette().get(0).getMaxHeight());
|
||||
assertEquals(5, child.bottomPalette().get(0).maxHeight());
|
||||
assertEquals("SIMPLEX", child.wallWarpStyle().orElseThrow().style());
|
||||
assertEquals(5, child.wallWarpAmplitude(), 0);
|
||||
assertEquals("carving/sand-hollows-child", child.carving());
|
||||
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
package art.arcane.iris.engine.object.world.biome;
|
||||
|
||||
import art.arcane.iris.engine.object.terrain.IrisBiomePaletteLayer;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
public class IrisBiomeCeilingLayerGuardTest {
|
||||
private static IrisBiome biome(int layers, int ceilingLayers) {
|
||||
IrisBiome biome = new IrisBiome();
|
||||
KList<IrisBiomePaletteLayer> surface = new KList<>();
|
||||
for (int i = 0; i < layers; i++) {
|
||||
surface.add(new IrisBiomePaletteLayer().zero());
|
||||
}
|
||||
KList<IrisBiomePaletteLayer> ceiling = new KList<>();
|
||||
for (int i = 0; i < ceilingLayers; i++) {
|
||||
IrisBiomePaletteLayer layer = new IrisBiomePaletteLayer().zero();
|
||||
layer.setMinHeight(0);
|
||||
layer.setMaxHeight(0);
|
||||
ceiling.add(layer);
|
||||
}
|
||||
biome.setLayers(surface);
|
||||
biome.setCaveCeilingLayers(ceiling);
|
||||
return biome;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void moreCeilingLayersThanLayersMustNotThrow() {
|
||||
IrisBiome biome = biome(1, 3);
|
||||
|
||||
KList<PlatformBlockState> result = biome.generateCeilingLayers(
|
||||
new IrisDimension(), 0, 0, new RNG(1), 8, 64, mock(IrisData.class), null);
|
||||
|
||||
assertTrue("extra ceiling layers are skipped, not crashed on", result.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void inRangeCeilingLayersKeepWorking() {
|
||||
IrisBiome biome = biome(3, 2);
|
||||
|
||||
KList<PlatformBlockState> result = biome.generateCeilingLayers(
|
||||
new IrisDimension(), 0, 0, new RNG(1), 8, 64, mock(IrisData.class), null);
|
||||
|
||||
assertTrue("zeroed palettes with zero heights produce no blocks", result.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void omittedCeilingLayersLeaveCavesUnchanged() {
|
||||
assertTrue(new IrisBiome().getCaveCeilingLayers().isEmpty());
|
||||
}
|
||||
}
|
||||
+21
@@ -2,13 +2,17 @@ package art.arcane.iris.engine.object.world.biome;
|
||||
|
||||
import art.arcane.iris.engine.object.world.biome.InferredType;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.builtin.terrain.LayersSettings;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.iris.core.modules.BuiltInPack;
|
||||
import art.arcane.iris.engine.object.TestSettings;
|
||||
import com.google.gson.Gson;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@@ -31,4 +35,21 @@ public class IrisBiomeInferenceIsolationTest {
|
||||
assertEquals(InferredType.LAND, land.getInferredType());
|
||||
assertEquals(InferredType.SEA, sea.getInferredType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aVariantKeepsTheModuleSettingsOfItsBiome() {
|
||||
Gson gson = new Gson();
|
||||
IrisData data = mock(IrisData.class);
|
||||
when(data.getGson()).thenReturn(gson);
|
||||
IrisBiome biome = gson.fromJson("{\"name\":\"Shared\"}", IrisBiome.class);
|
||||
biome.setLoader(data);
|
||||
biome.setLoadKey("shared");
|
||||
biome.setModuleSettings(BuiltInPack.settings(TestSettings.of(LayersSettings.class, "{\"layers\": []}")));
|
||||
|
||||
biome.withInferredType(InferredType.LAND);
|
||||
IrisBiome sea = biome.withInferredType(InferredType.SEA);
|
||||
|
||||
assertSame(biome.getModuleSettings(), sea.getModuleSettings());
|
||||
assertTrue(sea.getModuleSettings().find(LayersSettings.class).orElseThrow().layers().isEmpty());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package art.arcane.iris.engine.terrain;
|
||||
|
||||
import art.arcane.iris.builtin.terrain.CaveCeilingLayersSettings;
|
||||
import art.arcane.iris.builtin.terrain.LayersSettings;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.iris.core.modules.BuiltInPack;
|
||||
import art.arcane.iris.core.modules.IrisPackResources;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import com.google.gson.Gson;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class BiomeLayersCeilingGuardTest {
|
||||
private static final String EMPTY_LAYER = "{\"palette\": []}";
|
||||
private static final String EMPTY_CEILING_LAYER = "{\"palette\": [], \"minHeight\": 0, \"maxHeight\": 0}";
|
||||
|
||||
private static IrisBiome biome(int layers, int ceilingLayers) {
|
||||
Gson gson = new Gson();
|
||||
IrisBiome biome = new IrisBiome();
|
||||
biome.setModuleSettings(BuiltInPack.settings(
|
||||
gson.fromJson("{\"layers\": " + layerList(EMPTY_LAYER, layers) + "}", LayersSettings.class),
|
||||
gson.fromJson("{\"layers\": " + layerList(EMPTY_CEILING_LAYER, ceilingLayers) + "}", CaveCeilingLayersSettings.class)));
|
||||
return biome;
|
||||
}
|
||||
|
||||
private static String layerList(String layer, int count) {
|
||||
return "[" + String.join(",", java.util.Collections.nCopies(count, layer)) + "]";
|
||||
}
|
||||
|
||||
private static IrisData data() {
|
||||
IrisData data = mock(IrisData.class);
|
||||
when(data.getDataFolder()).thenReturn(new File("pack"));
|
||||
IrisPackResources resources = new IrisPackResources(data);
|
||||
when(data.getPackResources()).thenReturn(resources);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void moreCeilingLayersThanLayersMustNotThrow() {
|
||||
IrisBiome biome = biome(1, 3);
|
||||
|
||||
KList<PlatformBlockState> result = new BiomeLayers().generateCeilingLayers(
|
||||
biome, new IrisDimension(), 0, 0, new RNG(1), 8, 64, data(), null);
|
||||
|
||||
assertTrue("extra ceiling layers are skipped, not crashed on", result.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void inRangeCeilingLayersKeepWorking() {
|
||||
IrisBiome biome = biome(3, 2);
|
||||
|
||||
KList<PlatformBlockState> result = new BiomeLayers().generateCeilingLayers(
|
||||
biome, new IrisDimension(), 0, 0, new RNG(1), 8, 64, data(), null);
|
||||
|
||||
assertTrue("zeroed palettes with zero heights produce no blocks", result.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void omittedCeilingLayersLeaveCavesUnchanged() {
|
||||
KList<PlatformBlockState> result = new BiomeLayers().generateCeilingLayers(
|
||||
new IrisBiome(), new IrisDimension(), 0, 0, new RNG(1), 8, 64, data(), null);
|
||||
|
||||
assertTrue(result.isEmpty());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package art.arcane.iris.engine.terrain;
|
||||
|
||||
import art.arcane.iris.builtin.post.PostProcessingSettings;
|
||||
import art.arcane.iris.builtin.post.PostProcessingSlabsSettings;
|
||||
import art.arcane.iris.builtin.post.PostProcessingWallsSettings;
|
||||
import art.arcane.iris.builtin.terrain.CaveCeilingLayersSettings;
|
||||
import art.arcane.iris.builtin.terrain.FluidPaletteSettings;
|
||||
import art.arcane.iris.builtin.terrain.LayersSettings;
|
||||
import art.arcane.iris.builtin.terrain.LockLayersMaxSettings;
|
||||
import art.arcane.iris.builtin.terrain.LockLayersSettings;
|
||||
import art.arcane.iris.builtin.terrain.RockPaletteSettings;
|
||||
import art.arcane.iris.builtin.terrain.SeaLayersSettings;
|
||||
import art.arcane.iris.builtin.terrain.SlabSettings;
|
||||
import art.arcane.iris.builtin.terrain.WallSettings;
|
||||
import art.arcane.iris.core.modules.BuiltInPack;
|
||||
import art.arcane.iris.core.modules.ModuleSettings;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.volmit.IrisFeature;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Pack JSON as the module settings the decoder reads it into: each key a terrain or post feature declares, under its root
|
||||
* option, without loading the module host. {@code ModuleSettingsDecoder} reads the same shapes (see the settings decoding tests).
|
||||
*/
|
||||
public final class TerrainTestSettings {
|
||||
private static final Gson GSON = new Gson();
|
||||
private static final Map<String, Object[]> FEATURES = Map.ofEntries(
|
||||
Map.entry("layers", new Object[]{LayersSettings.class, "layers"}),
|
||||
Map.entry("seaLayers", new Object[]{SeaLayersSettings.class, "layers"}),
|
||||
Map.entry("caveCeilingLayers", new Object[]{CaveCeilingLayersSettings.class, "layers"}),
|
||||
Map.entry("slab", new Object[]{SlabSettings.class, "layer"}),
|
||||
Map.entry("wall", new Object[]{WallSettings.class, "layer"}),
|
||||
Map.entry("lockLayers", new Object[]{LockLayersSettings.class, "locked"}),
|
||||
Map.entry("lockLayersMax", new Object[]{LockLayersMaxSettings.class, "layers"}),
|
||||
Map.entry("rockPalette", new Object[]{RockPaletteSettings.class, "palette"}),
|
||||
Map.entry("fluidPalette", new Object[]{FluidPaletteSettings.class, "palette"}),
|
||||
Map.entry("postProcessing", new Object[]{PostProcessingSettings.class, "enabled"}),
|
||||
Map.entry("postProcessingSlabs", new Object[]{PostProcessingSlabsSettings.class, "enabled"}),
|
||||
Map.entry("postProcessingWalls", new Object[]{PostProcessingWallsSettings.class, "enabled"}));
|
||||
|
||||
private TerrainTestSettings() {
|
||||
}
|
||||
|
||||
/** The settings a biome or dimension file holds, of the terrain and post keys it writes. */
|
||||
@SuppressWarnings("unchecked")
|
||||
public static ModuleSettings of(String json) {
|
||||
List<IrisFeature> settings = new ArrayList<>();
|
||||
for (Map.Entry<String, JsonElement> entry : GSON.fromJson(json, JsonObject.class).entrySet()) {
|
||||
Object[] feature = FEATURES.get(entry.getKey());
|
||||
if (feature == null) {
|
||||
continue;
|
||||
}
|
||||
JsonObject wrapped = new JsonObject();
|
||||
wrapped.add((String) feature[1], entry.getValue());
|
||||
settings.add(GSON.fromJson(wrapped, (Class<? extends IrisFeature>) feature[0]));
|
||||
}
|
||||
return BuiltInPack.settings(settings.toArray(new IrisFeature[0]));
|
||||
}
|
||||
}
|
||||
-35
@@ -4,7 +4,6 @@ import art.arcane.iris.engine.IrisComplex;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.engine.object.world.region.IrisRegion;
|
||||
import art.arcane.iris.util.project.stream.ProceduralStream;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
@@ -22,23 +21,17 @@ public class ChunkContextPrefillPlanTest {
|
||||
AtomicInteger caveCalls = new AtomicInteger();
|
||||
AtomicInteger heightCalls = new AtomicInteger();
|
||||
AtomicInteger biomeCalls = new AtomicInteger();
|
||||
AtomicInteger rockCalls = new AtomicInteger();
|
||||
AtomicInteger fluidCalls = new AtomicInteger();
|
||||
AtomicInteger regionCalls = new AtomicInteger();
|
||||
ChunkContext context = createContext(
|
||||
ChunkContext.PrefillPlan.NO_CAVE,
|
||||
caveCalls,
|
||||
heightCalls,
|
||||
biomeCalls,
|
||||
rockCalls,
|
||||
fluidCalls,
|
||||
regionCalls
|
||||
);
|
||||
|
||||
assertEquals(256, heightCalls.get());
|
||||
assertEquals(256, biomeCalls.get());
|
||||
assertEquals(256, rockCalls.get());
|
||||
assertEquals(256, fluidCalls.get());
|
||||
assertEquals(256, regionCalls.get());
|
||||
assertEquals(0, caveCalls.get());
|
||||
|
||||
@@ -53,23 +46,17 @@ public class ChunkContextPrefillPlanTest {
|
||||
AtomicInteger caveCalls = new AtomicInteger();
|
||||
AtomicInteger heightCalls = new AtomicInteger();
|
||||
AtomicInteger biomeCalls = new AtomicInteger();
|
||||
AtomicInteger rockCalls = new AtomicInteger();
|
||||
AtomicInteger fluidCalls = new AtomicInteger();
|
||||
AtomicInteger regionCalls = new AtomicInteger();
|
||||
ChunkContext context = createContext(
|
||||
ChunkContext.PrefillPlan.ALL,
|
||||
caveCalls,
|
||||
heightCalls,
|
||||
biomeCalls,
|
||||
rockCalls,
|
||||
fluidCalls,
|
||||
regionCalls
|
||||
);
|
||||
|
||||
assertEquals(256, heightCalls.get());
|
||||
assertEquals(256, biomeCalls.get());
|
||||
assertEquals(256, rockCalls.get());
|
||||
assertEquals(256, fluidCalls.get());
|
||||
assertEquals(256, regionCalls.get());
|
||||
assertEquals(256, caveCalls.get());
|
||||
|
||||
@@ -88,8 +75,6 @@ public class ChunkContextPrefillPlanTest {
|
||||
AtomicInteger caveCalls,
|
||||
AtomicInteger heightCalls,
|
||||
AtomicInteger biomeCalls,
|
||||
AtomicInteger rockCalls,
|
||||
AtomicInteger fluidCalls,
|
||||
AtomicInteger regionCalls
|
||||
) {
|
||||
IrisComplex complex = mock(IrisComplex.class);
|
||||
@@ -119,24 +104,6 @@ public class ChunkContextPrefillPlanTest {
|
||||
return caveBiome;
|
||||
}).when(caveStream).get(anyDouble(), anyDouble());
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ProceduralStream<BlockData> rockStream = mock(ProceduralStream.class);
|
||||
BlockData rock = mock(BlockData.class);
|
||||
doReturn("minecraft:stone").when(rock).getAsString();
|
||||
doAnswer(invocation -> {
|
||||
rockCalls.incrementAndGet();
|
||||
return rock;
|
||||
}).when(rockStream).get(anyDouble(), anyDouble());
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ProceduralStream<BlockData> fluidStream = mock(ProceduralStream.class);
|
||||
BlockData fluid = mock(BlockData.class);
|
||||
doReturn("minecraft:water").when(fluid).getAsString();
|
||||
doAnswer(invocation -> {
|
||||
fluidCalls.incrementAndGet();
|
||||
return fluid;
|
||||
}).when(fluidStream).get(anyDouble(), anyDouble());
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ProceduralStream<IrisRegion> regionStream = mock(ProceduralStream.class);
|
||||
IrisRegion region = mock(IrisRegion.class);
|
||||
@@ -148,8 +115,6 @@ public class ChunkContextPrefillPlanTest {
|
||||
doReturn(heightStream).when(complex).getHeightStream();
|
||||
doReturn(biomeStream).when(complex).getTrueBiomeStream();
|
||||
doReturn(caveStream).when(complex).getCaveBiomeStream();
|
||||
doReturn(rockStream).when(complex).getRockStream();
|
||||
doReturn(fluidStream).when(complex).getFluidStream();
|
||||
doReturn(regionStream).when(complex).getRegionStream();
|
||||
|
||||
return new ChunkContext(32, 48, complex, true, prefillPlan, null);
|
||||
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
{
|
||||
"name": "Polarity Grotto",
|
||||
"derivative": "minecraft:lush_caves",
|
||||
"vanillaDerivative": "minecraft:lush_caves",
|
||||
"caveMinDepthBelowSurface": 9,
|
||||
"caveProfile": {
|
||||
"enabled": true,
|
||||
"verticalRange": {
|
||||
"min": 6,
|
||||
"max": 700
|
||||
},
|
||||
"baseDensityStyle": {
|
||||
"style": "SIMPLEX_VASCULAR",
|
||||
"zoom": 0.88
|
||||
},
|
||||
"detailDensityStyle": {
|
||||
"style": "FRACTAL_BILLOW_SIMPLEX",
|
||||
"zoom": 0.42
|
||||
},
|
||||
"warpStyle": {
|
||||
"style": "SIMPLEX",
|
||||
"zoom": 0.28
|
||||
},
|
||||
"baseWeight": 0.9,
|
||||
"detailWeight": 0.12,
|
||||
"warpStrength": 0.38,
|
||||
"densityThreshold": {
|
||||
"min": -0.13,
|
||||
"max": -0.035,
|
||||
"style": {
|
||||
"style": "SIMPLEX",
|
||||
"zoom": 0.66
|
||||
}
|
||||
},
|
||||
"thresholdBias": 0.08,
|
||||
"sampleStep": 2,
|
||||
"surfaceClearance": 9,
|
||||
"allowSurfaceBreak": false,
|
||||
"objectMinDepthBelowSurface": 13,
|
||||
"defaultObjectAnchor": "FLOOR",
|
||||
"defaultObjectPlaceMode": "ORGANIC_STILT",
|
||||
"anchorScanStep": 1,
|
||||
"anchorSearchAttempts": 16,
|
||||
"allowFluid": true,
|
||||
"fluidMinDepthBelowSurface": 18,
|
||||
"fluidRequiresFloor": true,
|
||||
"allowLava": true,
|
||||
"modules": [
|
||||
{
|
||||
"style": {
|
||||
"style": "FRACTAL_BILLOW_SIMPLEX",
|
||||
"zoom": 0.34
|
||||
},
|
||||
"weight": 0.06,
|
||||
"threshold": 0.06,
|
||||
"verticalRange": {
|
||||
"min": 12,
|
||||
"max": 420
|
||||
},
|
||||
"invert": true
|
||||
}
|
||||
],
|
||||
"verticalEdgeFade": 22,
|
||||
"verticalEdgeFadeStrength": 0.15,
|
||||
"minCarveCells": 20,
|
||||
"recoveryThresholdBoost": 0.06
|
||||
},
|
||||
"wall": {
|
||||
"style": {
|
||||
"style": "SIMPLEX",
|
||||
"zoom": 0.52
|
||||
},
|
||||
"palette": [
|
||||
{
|
||||
"block": "minecraft:tuff",
|
||||
"weight": 5
|
||||
},
|
||||
{
|
||||
"block": "minecraft:andesite",
|
||||
"weight": 4
|
||||
},
|
||||
{
|
||||
"block": "minecraft:mossy_cobblestone",
|
||||
"weight": 2
|
||||
},
|
||||
{
|
||||
"block": "minecraft:stone",
|
||||
"weight": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
"layers": [
|
||||
{
|
||||
"minHeight": 1,
|
||||
"maxHeight": 2,
|
||||
"palette": [
|
||||
{
|
||||
"block": "minecraft:moss_block",
|
||||
"weight": 5
|
||||
},
|
||||
{
|
||||
"block": "minecraft:rooted_dirt",
|
||||
"weight": 2
|
||||
},
|
||||
{
|
||||
"block": "minecraft:andesite",
|
||||
"weight": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"caveCeilingLayers": [
|
||||
{
|
||||
"minHeight": 1,
|
||||
"maxHeight": 2,
|
||||
"palette": [
|
||||
{
|
||||
"block": "minecraft:tuff",
|
||||
"weight": 4
|
||||
},
|
||||
{
|
||||
"block": "minecraft:moss_block",
|
||||
"weight": 3
|
||||
},
|
||||
{
|
||||
"block": "minecraft:andesite",
|
||||
"weight": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"objects": [
|
||||
{
|
||||
"chance": 0.15,
|
||||
"density": 2,
|
||||
"carvingSupport": "CARVING_ONLY",
|
||||
"caveAnchorMode": "PROFILE_DEFAULT",
|
||||
"translate": {
|
||||
"y": -1
|
||||
},
|
||||
"place": [
|
||||
"clutter/shrub1",
|
||||
"clutter/shrub2",
|
||||
"clutter/shrub3",
|
||||
"clutter/oakshrub1",
|
||||
"clutter/oakshrub2",
|
||||
"clutter/oakshrub3"
|
||||
],
|
||||
"bottom": true,
|
||||
"force": true,
|
||||
"scale": {
|
||||
"size": 0.6
|
||||
}
|
||||
},
|
||||
{
|
||||
"chance": 0.1,
|
||||
"density": 2,
|
||||
"carvingSupport": "CARVING_ONLY",
|
||||
"caveAnchorMode": "PROFILE_DEFAULT",
|
||||
"translate": {
|
||||
"y": -1
|
||||
},
|
||||
"place": [
|
||||
"clutter/rock1",
|
||||
"clutter/rock2",
|
||||
"clutter/rock3",
|
||||
"clutter/stoneclutt1",
|
||||
"clutter/stoneclutt2",
|
||||
"clutter/stoneclutt3"
|
||||
],
|
||||
"bottom": true,
|
||||
"force": true,
|
||||
"scale": {
|
||||
"size": 0.6
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"proceduralObjects": "snippet/procedural-objects/frozen/magical-ice-spikes-surface",
|
||||
"name": "Frozen River",
|
||||
"color": "#3DB9F5",
|
||||
"derivative": "minecraft:frozen_river",
|
||||
"vanillaDerivative": "minecraft:frozen_river",
|
||||
"generators": [{
|
||||
"min": -32,
|
||||
"max": -10,
|
||||
"generator": "mountain"
|
||||
}],
|
||||
"layers": [
|
||||
{"palette": [
|
||||
{"block": "minecraft:dirt"},
|
||||
{"block": "minecraft:gravel"},
|
||||
{"block": "minecraft:stone"}
|
||||
]},
|
||||
{
|
||||
"minHeight": 2,
|
||||
"maxHeight": 3,
|
||||
"style": {"style": "STATIC"},
|
||||
"palette": [
|
||||
{"block": "minecraft:sand"},
|
||||
{"block": "minecraft:clay"},
|
||||
{"block": "minecraft:sand"},
|
||||
{"block": "minecraft:gravel"},
|
||||
{"block": "minecraft:sand"},
|
||||
{"block": "minecraft:dirt"},
|
||||
{
|
||||
"weight": 2,
|
||||
"block": "minecraft:sand"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"objects": [
|
||||
|
||||
],
|
||||
"seaLayers": [
|
||||
{
|
||||
"minHeight": 3,
|
||||
"maxHeight": 6,
|
||||
"style": {"style": "NOWHERE"},
|
||||
"zoom": 1.16,
|
||||
"palette": [
|
||||
{
|
||||
"weight": 2,
|
||||
"block": "minecraft:ice"
|
||||
},
|
||||
{
|
||||
"weight": 3,
|
||||
"block": "minecraft:packed_ice"
|
||||
},
|
||||
{"block": "minecraft:blue_ice"},
|
||||
{
|
||||
"weight": 3,
|
||||
"block": "minecraft:packed_ice"
|
||||
},
|
||||
{
|
||||
"weight": 2,
|
||||
"block": "minecraft:ice"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"minHeight": 1,
|
||||
"maxHeight": 2,
|
||||
"palette": [{"block": "minecraft:packed_ice"}]
|
||||
}
|
||||
]
|
||||
}
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"name": "Mesa Yellow",
|
||||
"color": "#83300B",
|
||||
"rarity": 1,
|
||||
"derivative": "minecraft:windswept_savanna",
|
||||
"vanillaDerivative": "minecraft:badlands",
|
||||
"children": ["mesa/dark"],
|
||||
"generators": [
|
||||
{
|
||||
"min": 50,
|
||||
"max": 70,
|
||||
"generator": "highplains"
|
||||
},
|
||||
{
|
||||
"min": 70,
|
||||
"max": 110,
|
||||
"generator": "mountain"
|
||||
}
|
||||
],
|
||||
"wall": {
|
||||
"style": {"style": "NOWHERE"},
|
||||
"palette": [
|
||||
{"block": "minecraft:red_terracotta"},
|
||||
{"block": "minecraft:gray_terracotta"},
|
||||
{"block": "minecraft:yellow_terracotta"}
|
||||
]
|
||||
},
|
||||
"layers": [
|
||||
{
|
||||
"minHeight": 2,
|
||||
"maxHeight": 3,
|
||||
"style": {"style": "STATIC"},
|
||||
"palette": [{"block": "minecraft:terracotta"}]
|
||||
},
|
||||
{
|
||||
"minHeight": 2,
|
||||
"maxHeight": 3,
|
||||
"style": {"style": "STATIC"},
|
||||
"palette": [{"block": "minecraft:white_terracotta"}]
|
||||
},
|
||||
{
|
||||
"minHeight": 2,
|
||||
"maxHeight": 3,
|
||||
"style": {"style": "STATIC"},
|
||||
"palette": [{"block": "minecraft:terracotta"}]
|
||||
},
|
||||
{
|
||||
"minHeight": 2,
|
||||
"maxHeight": 3,
|
||||
"style": {"style": "STATIC"},
|
||||
"palette": [{"block": "minecraft:red_terracotta"}]
|
||||
},
|
||||
{
|
||||
"minHeight": 4,
|
||||
"maxHeight": 4,
|
||||
"style": {"style": "STATIC"},
|
||||
"palette": [{"block": "minecraft:terracotta"}]
|
||||
},
|
||||
{
|
||||
"minHeight": 2,
|
||||
"maxHeight": 3,
|
||||
"style": {"style": "STATIC"},
|
||||
"palette": [{"block": "minecraft:yellow_terracotta"}]
|
||||
},
|
||||
{
|
||||
"minHeight": 2,
|
||||
"maxHeight": 3,
|
||||
"style": {"style": "STATIC"},
|
||||
"palette": [{"block": "minecraft:terracotta"}]
|
||||
},
|
||||
{
|
||||
"minHeight": 2,
|
||||
"maxHeight": 3,
|
||||
"style": {"style": "STATIC"},
|
||||
"palette": [{"block": "minecraft:brown_terracotta"}]
|
||||
}
|
||||
],
|
||||
"decorators": [
|
||||
{
|
||||
"chance": 0.009,
|
||||
"variance": {"style": "STATIC"},
|
||||
"zoom": 0.3,
|
||||
"palette": [
|
||||
{
|
||||
"data": {
|
||||
"face": "floor",
|
||||
"powered": false,
|
||||
"facing": "east"
|
||||
},
|
||||
"block": "minecraft:stone_button"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"face": "floor",
|
||||
"powered": false,
|
||||
"facing": "south"
|
||||
},
|
||||
"block": "minecraft:stone_button"
|
||||
}
|
||||
],
|
||||
"style": {"style": "STATIC"}
|
||||
},
|
||||
{
|
||||
"chance": 0.01,
|
||||
"variance": {"style": "STATIC"},
|
||||
"zoom": 0.3,
|
||||
"palette": [{"block": "minecraft:dead_bush"}],
|
||||
"style": {"style": "STATIC"}
|
||||
},
|
||||
"snippet/decorator/dry_grass"
|
||||
],
|
||||
"lockLayers": true
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "Mountain Beach",
|
||||
"color": "#365B8F",
|
||||
"rarity": 1,
|
||||
"derivative": "minecraft:old_growth_spruce_taiga",
|
||||
"vanillaDerivative": "minecraft:old_growth_spruce_taiga",
|
||||
"generators": [{
|
||||
"min": 0,
|
||||
"max": 2,
|
||||
"generator": "plain"
|
||||
}],
|
||||
"layers": [
|
||||
{
|
||||
"minHeight": 1,
|
||||
"maxHeight": 1,
|
||||
"palette": [
|
||||
{"block": "minecraft:stone"},
|
||||
{"block": "minecraft:andesite"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"minHeight": 1,
|
||||
"maxHeight": 6,
|
||||
"palette": [{"block": "minecraft:stone"}]
|
||||
}
|
||||
],
|
||||
"objects": [{
|
||||
"mode": "PAINT",
|
||||
"chance": 0.0025,
|
||||
"rotation": {
|
||||
"yAxis": {
|
||||
"min": 0,
|
||||
"max": 270,
|
||||
"interval": 90,
|
||||
"enabled": true
|
||||
},
|
||||
"enabled": true
|
||||
},
|
||||
"place": ["clutter/bincluster1"]
|
||||
}],
|
||||
"slab": {
|
||||
"style": {"style": "STATIC"},
|
||||
"palette": [
|
||||
{"block": "minecraft:stone_slab"},
|
||||
{"block": "minecraft:air"}
|
||||
]
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"chance": 0.01,
|
||||
"style": {
|
||||
"style": "CELLULAR",
|
||||
"zoom": 0.3,
|
||||
"exponent": 1.5,
|
||||
"axialFracturing": true,
|
||||
"fracture": {
|
||||
"multiplier": 55,
|
||||
"axialFracturing": true,
|
||||
"style": "NOWHERE",
|
||||
"zoom": 0.15,
|
||||
"fracture": {
|
||||
"axialFracturing": true,
|
||||
"style": "STATIC",
|
||||
"multiplier": 18
|
||||
}
|
||||
}
|
||||
},
|
||||
"slopeCondition":{
|
||||
"maximumSlope": 5
|
||||
},
|
||||
"palette": [
|
||||
{
|
||||
"block": "minecraft:tall_dry_grass",
|
||||
"weight": 1
|
||||
},
|
||||
{
|
||||
"block": "minecraft:short_dry_grass",
|
||||
"weight": 1
|
||||
},
|
||||
{
|
||||
"block": "minecraft:air",
|
||||
"weight": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user