mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 16:25:36 +00:00
Give the modded native reference repair test a pack without modules, which the generation policy now asks, and keep IrisValues' conversions to its package
This commit is contained in:
1 parent
621e0e65bc
commit
5cb83a4232
2 files changed
+18
-4
No files matched your search
+15
-1
@@ -43,6 +43,7 @@ import net.minecraft.world.level.levelgen.structure.structures.OceanMonumentStru
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
@@ -56,6 +57,9 @@ import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class NativeStructureReferenceRepairTest {
|
||||
@BeforeClass
|
||||
@@ -138,7 +142,7 @@ public class NativeStructureReferenceRepairTest {
|
||||
NativeStructureReferenceEnvelope.referenceBounds(start, structure, terrain));
|
||||
IrisDimension dimension = new IrisDimension();
|
||||
dimension.getImportedStructures().getDisabled().add(structureKey);
|
||||
IrisData data = allocateWithoutConstructor(IrisData.class);
|
||||
IrisData data = packWithoutModules();
|
||||
Engine engine = engine(dimension, data);
|
||||
IrisNativeStructureDecision currentDecision = NativeStructureGenerationPolicy.resolve(
|
||||
engine, structureKey, false);
|
||||
@@ -322,6 +326,16 @@ public class NativeStructureReferenceRepairTest {
|
||||
handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* A pack without modules: the generation policy asks the pack's vanilla structure hooks, and there are none. The
|
||||
* adapters' tests do not see IrisApi's host classes, so the catalog is a deep stub.
|
||||
*/
|
||||
private static IrisData packWithoutModules() {
|
||||
IrisData data = mock(IrisData.class, RETURNS_DEEP_STUBS);
|
||||
when(data.getDataFolder()).thenReturn(new File("pack"));
|
||||
return data;
|
||||
}
|
||||
|
||||
private static Engine engine(IrisDimension dimension, IrisData data) throws Exception {
|
||||
TestEngine engine = allocateWithoutConstructor(TestEngine.class);
|
||||
engine.dimension = dimension;
|
||||
|
||||
@@ -55,12 +55,12 @@ public final class IrisValues {
|
||||
}
|
||||
|
||||
/** The IrisApi value types and the Iris classes that read the same JSON. */
|
||||
public static Map<String, Class<?>> irisClasses() {
|
||||
static Map<String, Class<?>> irisClasses() {
|
||||
return IRIS_CLASSES;
|
||||
}
|
||||
|
||||
/** {@code spec} as the block data Iris resolves: its block, properties, weight, backup and tile data. */
|
||||
public static IrisBlockData blockData(BlockSpec spec) {
|
||||
static IrisBlockData blockData(BlockSpec spec) {
|
||||
IrisBlockData block = new IrisBlockData(spec.block());
|
||||
block.setData(irisMap(spec.data()));
|
||||
block.setWeight(spec.weight());
|
||||
@@ -81,7 +81,7 @@ public final class IrisValues {
|
||||
}
|
||||
|
||||
/** {@code style} as the generator style Iris builds noise from; a style name Iris does not know is flat. */
|
||||
public static IrisGeneratorStyle generatorStyle(com.volmit.noise.NoiseStyle style) {
|
||||
static IrisGeneratorStyle generatorStyle(com.volmit.noise.NoiseStyle style) {
|
||||
IrisGeneratorStyle iris = new IrisGeneratorStyle(irisStyle(style.style()));
|
||||
iris.setCellularFrequency(style.cellularFrequency());
|
||||
iris.setCellularZoom(style.cellularZoom());
|
||||
|
||||
Reference in new issue
Block a user