mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 16:54:04 +00:00
Pin tree palettes to Iris's palette noise as before the port
The golden test stubs palettes with a hash, so nothing pinned the real picks. A bloomspire tree with a diamond/gold trunk palette now bakes through IrisPackResources' real block registry. A probe of a pack whose only land biome grows that tree gave the same signature on this build and on the build before the tree port (Iris48e328bae, IrisModule0d557da), and this digest was taken after.
This commit is contained in:
1 parent
c0080c4bbe
commit
8aa07403e7
2 files changed
+110
No files matched your search
+22
@@ -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<String, String> 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<String, String> bakeAll() throws Exception {
|
||||
copyFixtureInto(folder.getRoot().toPath());
|
||||
IrisData data = mock(IrisData.class, withSettings().stubOnly().defaultAnswer(CALLS_REAL_METHODS));
|
||||
|
||||
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user