diff --git a/core/src/test/java/art/arcane/iris/engine/object/procedural/ProceduralObjectsGoldenTest.java b/core/src/test/java/art/arcane/iris/engine/object/procedural/ProceduralObjectsGoldenTest.java index 0b75020d4..33bd9193f 100644 --- a/core/src/test/java/art/arcane/iris/engine/object/procedural/ProceduralObjectsGoldenTest.java +++ b/core/src/test/java/art/arcane/iris/engine/object/procedural/ProceduralObjectsGoldenTest.java @@ -23,6 +23,7 @@ import art.arcane.iris.builtin.objects.PlaceableObject; import art.arcane.iris.builtin.objects.ProceduralObjectSettings; import art.arcane.iris.builtin.objects.ProceduralPlacement; import art.arcane.iris.core.loader.IrisData; +import art.arcane.iris.core.loader.ResourceLoader; import art.arcane.iris.core.modules.IrisObjectBuilder; import art.arcane.iris.core.modules.IrisPackResources; import art.arcane.iris.core.modules.PlatformBlockStates; @@ -79,6 +80,7 @@ import static org.mockito.Mockito.when; */ public class ProceduralObjectsGoldenTest { private static final String FIXTURE = "/procedural-golden"; + private static final String PALETTE_TREE = "/procedural-palette-tree.json"; /** Digests on a platform whose blocks have no properties and which knows no block by {@code blockOrNull}. */ private static final Map BLOCK_ONLY = Map.ofEntries( Map.entry("biomes-carving-frost-shards", "954613b558bd0e8b"), @@ -154,6 +156,26 @@ public class ProceduralObjectsGoldenTest { assertEquals(new TreeMap<>(GAME_LIKE), bakeAll()); } + /** + * A tree palette picks through Iris's own palette noise, seeded and positioned as before the port: the digest was + * taken from this build after a probe of the same tree gave one signature on it and on the build before the port. + */ + @Test + public void treePalettesPickWithIrisPaletteNoiseAsBefore() throws Exception { + UsableBlockPlatform.bind(); + IrisData data = mock(IrisData.class, withSettings().stubOnly().defaultAnswer(CALLS_REAL_METHODS)); + doReturn(folder.getRoot()).when(data).getDataFolder(); + doReturn(mock(ResourceLoader.class)).when(data).getBlockLoader(); + doReturn(null).when(data).getEngine(); + IrisPackResources resources = new IrisPackResources(data); + doReturn(resources).when(data).getPackResources(); + String json = Files.readString(Path.of(ProceduralObjectsGoldenTest.class.getResource(PALETTE_TREE).toURI())); + ProceduralObjectSettings settings = new GsonBuilder().registerTypeAdapterFactory(data).create() + .fromJson(json, ProceduralObjectSettings.class); + + assertEquals("393616b22e2dd257", bake(settings, data)); + } + private Map bakeAll() throws Exception { copyFixtureInto(folder.getRoot().toPath()); IrisData data = mock(IrisData.class, withSettings().stubOnly().defaultAnswer(CALLS_REAL_METHODS)); diff --git a/core/src/test/resources/procedural-palette-tree.json b/core/src/test/resources/procedural-palette-tree.json new file mode 100644 index 000000000..9a5ee6195 --- /dev/null +++ b/core/src/test/resources/procedural-palette-tree.json @@ -0,0 +1,88 @@ +{ + "trees": [ + { + "name": "bloomspire", + "chance": 0.6, + "density": 2, + "variants": 6, + "seed": 8501, + "trunk": "minecraft:cherry_wood", + "trunkPalette": { + "palette": [ + { + "block": "minecraft:diamond_block", + "weight": 1 + }, + { + "block": "minecraft:gold_block", + "weight": 1 + } + ] + }, + "leaves": "minecraft:cherry_leaves", + "leavesPalette": { + "style": { + "style": "CELLULAR", + "zoom": 0.3 + }, + "palette": [ + { + "block": "minecraft:cherry_leaves", + "weight": 5 + }, + { + "block": "minecraft:flowering_azalea_leaves", + "weight": 2 + } + ] + }, + "profile": "CHERRY", + "heightMin": 10, + "heightMax": 16, + "trunkWidth": 1, + "trunkShape": "BELL", + "shapeStart": 1.0, + "shapeEnd": 0.8, + "rotation": { + "enabled": true, + "yAxis": { + "enabled": true, + "min": 0, + "max": 360, + "interval": 90 + } + }, + "canopy": { + "mode": "DENSITY", + "leafDensity": 0.88, + "crownStretchX": 1.2, + "crownStretchZ": 1.2, + "branches": { + "probabilityFunction": "TOP_HEAVY", + "probabilityExponent": 2, + "lengthFunction": "LINEAR", + "lengthBase": 2, + "lengthCrown": 4, + "azimuthMode": "GOLDEN_ANGLE", + "elevation": 10, + "sag": 0.2, + "clusterRadius": 2, + "clusterMode": "DENSITY", + "clusterDensity": 0.85 + } + }, + "decorators": [ + { + "target": "GROUND_SCATTER", + "block": "minecraft:pink_petals", + "chance": 0.12 + }, + { + "target": "LEAF_SURFACE", + "block": "minecraft:cherry_leaves", + "chance": 0.04 + } + ] + } + ] +} \ No newline at end of file