Release engine-keyed structure registries when an engine closes

- Keep structure graph compilations in the pack scope of their pack data
- Hold live engines strongly in the structure registries and drop each one in the shutdown sequence
- Release the native structure ownership store of a closed engine and refuse to reopen it
- Build structure indexes uncached for a closed engine
- Settle the remaining static holders in the ledger and delete the pending list
This commit is contained in:
piexel committed 2026-11-26 21:08:02 +01:00
1 parent 170e5a726e
commit 7a3d2b10bb
11 files changed
+130 -66

No files matched your search

@@ -18,6 +18,9 @@
package art.arcane.iris.generation.runtime;
import art.arcane.iris.structure.nativegen.NativeStructureVolumeIndex;
import art.arcane.iris.structure.placement.StructureReachability;
import art.arcane.iris.structure.placement.IrisStructureLocator;
import art.arcane.iris.pack.loading.IrisData;
import art.arcane.iris.generation.runtime.EngineBackgroundTasks.BackgroundTaskDrain;
import art.arcane.iris.generation.runtime.EngineRuntimeBuilder.RuntimeAssembly;
@@ -180,6 +183,7 @@ final class EngineShutdownSequence {
engine.closed = true;
engine.lifecycleState = LifecycleState.CLOSED;
}
failure = appendFailure(failure, runCleanup(null, this::releaseStructureRegistries));
IrisLogging.debug("Engine Fully Shutdown!");
}
}
@@ -207,6 +211,14 @@ final class EngineShutdownSequence {
throw new IllegalStateException("Iris engine shutdown remains incomplete after cleanup failures.", failure);
}
/** Engine-keyed structure registries hold only live engines, so a closed engine removes itself from each one. */
private void releaseStructureRegistries() {
NativeStructureOwnershipStore.release(engine);
IrisStructureLocator.invalidate(engine);
StructureReachability.invalidate(engine);
NativeStructureVolumeIndex.uninstall(engine);
}
void cleanupFailedConstruction(Throwable original) {
engine.getClosing().set(true);
engine.backgroundTasks.closeBackgroundTaskAdmission();
@@ -251,6 +263,7 @@ final class EngineShutdownSequence {
cleanupFailure = releaseGenerationAdmissions(cleanupFailure);
if (generationAdmissions.isEmpty()) {
engine.closed = true;
cleanupFailure = appendFailure(cleanupFailure, runCleanup(null, this::releaseStructureRegistries));
}
}
}
@@ -39,6 +39,7 @@ import art.arcane.iris.generation.noise.IrisNoiseGenerator;
import art.arcane.iris.generation.terrain.IrisDimensionCarvingEntry;
import art.arcane.iris.generation.terrain.IrisDimensionCarvingResolver;
import art.arcane.iris.generation.terrain.IrisMaterialPalette;
import art.arcane.iris.structure.graph.StructureGraphCompilation;
import art.arcane.iris.structure.object.IrisObjectPlacement;
import art.arcane.iris.world.entity.IrisEffect;
import art.arcane.iris.pack.loading.IrisData;
@@ -47,6 +48,8 @@ import art.arcane.volmlib.util.noise.CNG;
import art.arcane.volmlib.util.scheduling.ChronoLatch;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/**
* The runtime objects one owner derives from pack objects: seeded generators, samplers and profiles. Pack objects are
@@ -76,6 +79,8 @@ public final class PackRuntime {
ore -> new SeedTable<>(ORE_CHANCE_SEED_CAPACITY, seed -> ore.createChance(seed, this)));
private final RuntimeTable<IrisObjectPlacement, SeedTable<CNG>> surfaceWarps = new RuntimeTable<>(
placement -> new SeedTable<>(SURFACE_WARP_SEED_CAPACITY, seed -> placement.createSurfaceWarp(seed, this)));
private final ConcurrentMap<String, StructureGraphCompilation> structureGraphs = new ConcurrentHashMap<>();
private final ConcurrentMap<String, Boolean> structureRuntimeOutputs = new ConcurrentHashMap<>();
private final ThreadSlots<IrisDimensionCarvingResolver.State> carvingResolverStates =
new ThreadSlots<>(IrisDimensionCarvingResolver.State::new);
private final RuntimeTable<IrisEffect, ChronoLatch> effectLatches =
@@ -190,6 +195,22 @@ public final class PackRuntime {
return surfaceWarps.get(placement).get(seed);
}
/** Structure graphs compile from the pack's own files, so the pack scope keeps one compilation per structure key. */
public ConcurrentMap<String, StructureGraphCompilation> structureGraphs() {
return structureGraphs;
}
/** Whether each structure's sampled assemblies always place output, keyed like {@link #structureGraphs()}. */
public ConcurrentMap<String, Boolean> structureRuntimeOutputs() {
return structureRuntimeOutputs;
}
/** Hotload drops the compiled structure graphs of a pack whose files changed. */
public void forgetStructureGraphs() {
structureGraphs.clear();
structureRuntimeOutputs.clear();
}
/** Carving lookups that are not handed a resolver state memoize their roots in the calling thread's state. */
public IrisDimensionCarvingResolver.State carvingResolverState() {
return carvingResolverStates.get();
@@ -1,24 +1,18 @@
package art.arcane.iris.structure.graph;
import art.arcane.iris.generation.runtime.PackRuntime;
import art.arcane.iris.pack.loading.IrisData;
import art.arcane.iris.structure.placement.StructureAssembler;
import art.arcane.iris.pack.value.IrisPosition;
import art.arcane.iris.structure.placement.IrisStructure;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.volmlib.util.math.RNG;
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public final class StructureGraphCatalog {
private static final Cache<IrisData, ConcurrentMap<String, StructureGraphCompilation>> CACHE =
Caffeine.newBuilder().weakKeys().build();
private static final Cache<IrisData, ConcurrentMap<String, Boolean>> RUNTIME_OUTPUT =
Caffeine.newBuilder().weakKeys().build();
private static final List<Long> RUNTIME_SAMPLE_SEEDS = List.of(
0L, 1L, 2L, 3L, 5L, 8L, 13L, 21L, 34L, 55L, 89L, 144L, 233L, 377L, 610L, 987L);
@@ -32,15 +26,13 @@ public final class StructureGraphCatalog {
if (structureKey == null || structureKey.isBlank()) {
return compileAndReport(activeData, activeStructure);
}
ConcurrentMap<String, StructureGraphCompilation> catalog = CACHE.get(
activeData, ignored -> new ConcurrentHashMap<>());
ConcurrentMap<String, StructureGraphCompilation> catalog = PackRuntime.forPack(activeData).structureGraphs();
return catalog.computeIfAbsent(structureKey, ignored -> compileAndReport(activeData, activeStructure));
}
public static void invalidate(IrisData data) {
if (data != null) {
CACHE.invalidate(data);
RUNTIME_OUTPUT.invalidate(data);
PackRuntime.forPack(data).forgetStructureGraphs();
}
}
@@ -54,8 +46,7 @@ public final class StructureGraphCatalog {
if (structureKey == null || structureKey.isBlank()) {
return sampleRuntimeAssembly(activeData, activeStructure);
}
ConcurrentMap<String, Boolean> catalog = RUNTIME_OUTPUT.get(
activeData, ignored -> new ConcurrentHashMap<>());
ConcurrentMap<String, Boolean> catalog = PackRuntime.forPack(activeData).structureRuntimeOutputs();
return catalog.computeIfAbsent(
structureKey, ignored -> sampleRuntimeAssembly(activeData, activeStructure));
}
@@ -29,7 +29,8 @@ import java.util.function.IntConsumer;
public final class NativeStructureOwnershipStore {
private static final int MAX_CACHED_AUTHORITIES = 65_536;
private static final Cache<Engine, State> STATES = Caffeine.newBuilder().weakKeys().build();
/** Stores of live engines; each engine closes its store, then releases it once the engine is closed. */
private static final Cache<Engine, State> STATES = Caffeine.newBuilder().build();
private NativeStructureOwnershipStore() {
}
@@ -68,9 +69,21 @@ public final class NativeStructureOwnershipStore {
state.close();
}
/** Drops a closed engine's store; a closed engine cannot open a new one. */
public static void release(Engine engine) {
STATES.invalidate(Objects.requireNonNull(engine, "Native structure ownership store requires an engine"));
}
private static State state(Engine engine) {
Engine resolved = Objects.requireNonNull(engine,
"Native structure ownership store requires an engine");
State state = STATES.getIfPresent(resolved);
if (state != null) {
return state;
}
if (resolved.isClosed()) {
throw new IllegalStateException("Native structure ownership store is closed for this engine.");
}
return STATES.get(resolved, State::new);
}
@@ -13,9 +13,9 @@ import art.arcane.volmlib.util.collection.KList;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.WeakHashMap;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
@@ -35,8 +35,8 @@ public final class NativeStructureVolumeIndex {
private static final int ORIGIN_REACH_CHUNKS = StructureOwnershipRecordView.MAX_REFERENCE_DISTANCE_CHUNKS;
private static final int MAX_CACHED_ORIGIN_CHUNKS = 16_384;
private static final int MAX_CACHED_QUERY_CHUNKS = 4_096;
private static final Map<Engine, NativeStructureVolumeIndex> INDEXES =
Collections.synchronizedMap(new WeakHashMap<>());
/** Indexes of live engines; each engine uninstalls its own index when it closes. */
private static final Map<Engine, NativeStructureVolumeIndex> INDEXES = Collections.synchronizedMap(new HashMap<>());
private final OriginResolver origins;
private final VolumeCache originCache = new VolumeCache(MAX_CACHED_ORIGIN_CHUNKS);
@@ -81,9 +81,9 @@ public final class IrisStructureLocator {
private static final long CAVE_ANCHOR_DOMAIN = 0x43415645414E4348L;
private static final Pattern NAMESPACED_RESOURCE_KEY = Pattern.compile("[a-z0-9_.-]+:[a-z0-9/._-]+");
private static final Cache<Engine, PlacementIndex> INDEX_CACHE = Caffeine.newBuilder().weakKeys().build();
private static final Cache<Engine, LocatableIndex> LOCATABLE_INDEX_CACHE =
Caffeine.newBuilder().weakKeys().build();
/** Indexes of live engines; each engine invalidates its own entries when it closes. */
private static final Cache<Engine, PlacementIndex> INDEX_CACHE = Caffeine.newBuilder().build();
private static final Cache<Engine, LocatableIndex> LOCATABLE_INDEX_CACHE = Caffeine.newBuilder().build();
private static final PlacementIndex EMPTY_INDEX = new PlacementIndex(
Collections.emptySet(), Collections.emptySet(), Collections.emptySet(), Collections.emptySet(),
Collections.emptySet(), Collections.emptyList());
@@ -1143,6 +1143,9 @@ public final class IrisStructureLocator {
if (engine.getData() == null || engine.getDimension() == null) {
throw new IllegalStateException("Iris structure index requires a fully bound engine and dimension");
}
if (engine.isClosed()) {
return build(engine);
}
return INDEX_CACHE.get(engine, ignored -> build(engine));
}
@@ -1150,6 +1153,9 @@ public final class IrisStructureLocator {
if (engine == null) {
return EMPTY_LOCATABLE_INDEX;
}
if (engine.isClosed()) {
return buildLocatableIndex(engine);
}
return LOCATABLE_INDEX_CACHE.get(engine, ignored -> buildLocatableIndex(engine));
}
@@ -42,7 +42,8 @@ import java.util.Set;
* <p>The reachable set is fixed per live engine/world and is rebuilt after hotload.
*/
public final class StructureReachability {
private static final Cache<Engine, Set<String>> REACHABLE_CACHE = Caffeine.newBuilder().weakKeys().build();
/** Reachable keys of live engines; each engine invalidates its own entry when it closes. */
private static final Cache<Engine, Set<String>> REACHABLE_CACHE = Caffeine.newBuilder().build();
private StructureReachability() {
}
@@ -52,6 +53,9 @@ public final class StructureReachability {
if (activeEngine.getData() == null) {
throw new IllegalStateException("Structure reachability requires a bound pack data loader");
}
if (activeEngine.isClosed()) {
return build(activeEngine);
}
return REACHABLE_CACHE.get(activeEngine, ignored -> build(activeEngine));
}
@@ -1,5 +1,8 @@
package art.arcane.iris.generation.runtime;
import art.arcane.iris.structure.nativegen.NativeStructureVolumeIndex;
import art.arcane.iris.structure.placement.StructureReachability;
import art.arcane.iris.structure.placement.IrisStructureLocator;
import art.arcane.iris.pack.loading.IrisData;
import art.arcane.iris.generation.runtime.EngineRuntimeBuilder.RuntimeAssembly;
import art.arcane.iris.structure.nativegen.NativeStructureOwnershipStore;
@@ -135,6 +138,23 @@ public class EngineShutdownDrainTest {
}
}
@Test
public void closedEngineRemovesItselfFromEveryStructureRegistry() throws Exception {
ShutdownFixture fixture = new ShutdownFixture();
try (MockedStatic<NativeStructureOwnershipStore> ownership = mockStatic(NativeStructureOwnershipStore.class);
MockedStatic<IrisStructureLocator> locator = mockStatic(IrisStructureLocator.class);
MockedStatic<StructureReachability> reachability = mockStatic(StructureReachability.class);
MockedStatic<NativeStructureVolumeIndex> volumes = mockStatic(NativeStructureVolumeIndex.class)) {
fixture.shutdown.close();
assertTrue(fixture.engine.closed);
ownership.verify(() -> NativeStructureOwnershipStore.release(fixture.engine));
locator.verify(() -> IrisStructureLocator.invalidate(fixture.engine));
reachability.verify(() -> StructureReachability.invalidate(fixture.engine));
volumes.verify(() -> NativeStructureVolumeIndex.uninstall(fixture.engine));
}
}
@Test
public void closingRuntimeAllowsItsBackgroundWorkersToOpenCapturedScopes() throws Exception {
ShutdownFixture fixture = new ShutdownFixture();
@@ -76,10 +76,6 @@ public class PackRuntimeStateGateTest {
return new Entry(owner, field, Kind.CONFIG, reason);
}
private static Entry pending(String owner, String field, Kind kind) {
return new Entry(owner, field, kind, "pending migration");
}
private static final List<Entry> CONFIG_FIELDS = List.of(
config("art.arcane.iris.generation.biome.IrisBiome", "biomeScatterResolved", "platform biome resolved from the biome's own key"),
config("art.arcane.iris.generation.biome.IrisBiome", "biomeSkyScatterResolved", "platform biome resolved from the biome's own key"),
@@ -196,20 +192,6 @@ public class PackRuntimeStateGateTest {
config("art.arcane.iris.world.loot.IrisVanillaLootTable", "resolvedKey", "namespaced key parsed from its own string")
);
private static final List<Entry> PENDING_MIGRATION = List.of(
pending("art.arcane.iris.structure.graph.StructureGraphCatalog", "CACHE", Kind.STATIC),
pending("art.arcane.iris.structure.graph.StructureGraphCatalog", "RUNTIME_OUTPUT", Kind.STATIC),
pending("art.arcane.iris.structure.nativegen.NativeStructureOwnershipStore", "STATES", Kind.STATIC),
pending("art.arcane.iris.structure.nativegen.NativeStructureVolumeIndex", "INDEXES", Kind.STATIC),
pending("art.arcane.iris.structure.placement.IrisStructureLocator", "INDEX_CACHE", Kind.STATIC),
pending("art.arcane.iris.structure.placement.IrisStructureLocator", "LOCATABLE_INDEX_CACHE", Kind.STATIC),
pending("art.arcane.iris.structure.placement.StructureReachability", "REACHABLE_CACHE", Kind.STATIC),
pending("art.arcane.iris.studio.object.ObjectStudioActivation", "SOURCES", Kind.STATIC),
pending("art.arcane.iris.generation.runtime.EngineTickRegistry", "TICK_ENGINES", Kind.STATIC),
pending("art.arcane.iris.pack.loading.IrisData", "ENGINE_HOLDERS", Kind.STATIC),
pending("art.arcane.iris.pack.loading.IrisData", "dataLoaders", Kind.STATIC)
);
@Test
public void everyNonSerializedPackFieldIsInTheLedger() throws Exception {
Map<String, Entry> ledger = ledger();
@@ -253,7 +235,7 @@ public class PackRuntimeStateGateTest {
public void everyLedgerEntryStillExists() throws Exception {
PackTypes types = PackTypes.scan();
List<String> stale = new ArrayList<>();
for (List<Entry> list : List.of(CONFIG_FIELDS, PENDING_MIGRATION, SETTLED_HOLDERS, ENGINE_PARAMETERS)) {
for (List<Entry> list : List.of(CONFIG_FIELDS, SETTLED_HOLDERS, ENGINE_PARAMETERS)) {
for (Entry entry : list) {
if (!types.declares(entry.owner(), entry.field())) {
stale.add(entry.key());
@@ -269,16 +251,12 @@ public class PackRuntimeStateGateTest {
assertTrue(entry.key() + " is not CONFIG", entry.kind() == Kind.CONFIG);
assertTrue(entry.key() + " needs a reason", !entry.reason().isBlank());
}
for (Entry entry : PENDING_MIGRATION) {
assertTrue(entry.key() + " is CONFIG and belongs in the allowlist", entry.kind() != Kind.CONFIG);
}
}
@Test
public void packTypesHoldNoEngineReference() throws Exception {
PackTypes types = PackTypes.scan();
Set<String> exempt = keys(PENDING_MIGRATION);
exempt.addAll(keys(ENGINE_PARAMETERS));
Set<String> exempt = keys(ENGINE_PARAMETERS);
List<String> failures = new ArrayList<>();
for (String type : types.packTypesWithNested()) {
for (ClassFileFacts.DeclaredField field : types.facts(type).fields()) {
@@ -301,13 +279,9 @@ public class PackRuntimeStateGateTest {
@Test
public void packTypesDoNotUseLazyBoundedCache() throws Exception {
PackTypes types = PackTypes.scan();
Set<String> pending = keys(PENDING_MIGRATION);
List<String> failures = new ArrayList<>();
for (String type : types.packTypesWithNested()) {
for (ClassFileFacts.DeclaredField field : types.facts(type).fields()) {
if (pending.contains(type + "#" + field.name())) {
continue;
}
if (mentions(field, LAZY_BOUNDED_CACHE)) {
failures.add(type + "#" + field.name());
}
@@ -385,6 +359,15 @@ public class PackRuntimeStateGateTest {
holder("art.arcane.iris.world.history.SavedBiomeStore", "DEFLATERS", Kind.SCRATCH, "a reusable zlib deflater, no engine or pack reference"),
holder("art.arcane.iris.world.storage.matter.IrisMatterContext", "DATA", Kind.SCRATCH, "a scoped pack data binding removed when the thread's outermost scope closes"),
holder("art.arcane.iris.world.tree.TreeSVC", "REENTRANT", Kind.SCRATCH, "a reentrancy flag, no engine or pack reference"),
holder("art.arcane.iris.structure.nativegen.NativeStructureOwnershipStore", "STATES", Kind.STATIC, "live-engine registry; a closed engine releases its store in the shutdown sequence (EngineShutdownDrainTest)"),
holder("art.arcane.iris.structure.nativegen.NativeStructureVolumeIndex", "INDEXES", Kind.STATIC, "live-engine registry; a closed engine uninstalls its index in the shutdown sequence (EngineShutdownDrainTest)"),
holder("art.arcane.iris.structure.placement.IrisStructureLocator", "INDEX_CACHE", Kind.STATIC, "live-engine registry; a closed engine invalidates its index in the shutdown sequence (EngineShutdownDrainTest)"),
holder("art.arcane.iris.structure.placement.IrisStructureLocator", "LOCATABLE_INDEX_CACHE", Kind.STATIC, "live-engine registry; a closed engine invalidates its index in the shutdown sequence (EngineShutdownDrainTest)"),
holder("art.arcane.iris.structure.placement.StructureReachability", "REACHABLE_CACHE", Kind.STATIC, "live-engine registry; a closed engine invalidates its keys in the shutdown sequence (EngineShutdownDrainTest)"),
holder("art.arcane.iris.generation.runtime.EngineTickRegistry", "TICK_ENGINES", Kind.STATIC, "live-engine registry; every engine unregisters itself when it closes (EngineReleaseProbeTest)"),
holder("art.arcane.iris.pack.loading.IrisData", "ENGINE_HOLDERS", Kind.STATIC, "pack data with live engines; an engine unregisters from its pack data when it closes (EngineReleaseProbeTest)"),
holder("art.arcane.iris.pack.loading.IrisData", "dataLoaders", Kind.STATIC, "pack data by folder; pack data drops each engine that closes (EngineReleaseProbeTest)"),
holder("art.arcane.iris.studio.object.ObjectStudioActivation", "SOURCES", Kind.STATIC, "studio object source packs, removed when the studio pack deactivates; pack data holds no closed engine"),
holder("art.arcane.iris.generation.runtime.EnginePanic$Diagnostics", "current", Kind.UNRELATED, "panic diagnostics strings for crash reports"),
holder("art.arcane.iris.pack.IrisPackBenchmarking", "instance", Kind.UNRELATED, "benchmark command session")
);
@@ -408,9 +391,6 @@ public class PackRuntimeStateGateTest {
fail("Duplicate holder ledger entry " + entry.key());
}
}
for (Entry entry : PENDING_MIGRATION) {
entries.putIfAbsent(entry.key(), entry);
}
return entries;
}
@@ -421,11 +401,6 @@ public class PackRuntimeStateGateTest {
fail("Duplicate ledger entry " + entry.key());
}
}
for (Entry entry : PENDING_MIGRATION) {
if (entries.put(entry.key(), entry) != null) {
fail("Duplicate ledger entry " + entry.key());
}
}
return entries;
}
@@ -1,5 +1,8 @@
package art.arcane.iris.structure.nativegen;
import com.github.benmanes.caffeine.cache.Cache;
import java.lang.reflect.Field;
import art.arcane.iris.generation.runtime.PackRuntime;
import art.arcane.iris.generation.runtime.Engine;
import art.arcane.iris.generation.runtime.IrisEngine;
@@ -221,6 +224,23 @@ public class NativeStructureOwnershipStoreTest {
record.structureKey(), record.originChunkX(), record.originChunkZ()));
}
@Test
public void releasedStoreOfAClosedEngineCannotReopen() throws Exception {
Engine engine = engine();
NativeStructureOwnershipStore.close(engine);
when(engine.isClosed()).thenReturn(true);
NativeStructureOwnershipStore.release(engine);
Field states = NativeStructureOwnershipStore.class.getDeclaredField("STATES");
states.setAccessible(true);
@SuppressWarnings("unchecked")
Cache<Engine, ?> stores = (Cache<Engine, ?>) states.get(null);
assertNull(stores.getIfPresent(engine));
assertThrows(IllegalStateException.class, () ->
NativeStructureOwnershipStore.findPersisted(engine, "test:after_release", 0, 0));
}
@Test
public void explicitCloseCreatesAndRetainsAClosedOwnershipState() {
Engine engine = engine();
@@ -18,6 +18,7 @@
package art.arcane.iris.structure.placement;
import art.arcane.iris.testsupport.MockPackData;
import art.arcane.volmlib.util.structure.StructureTerrainMode;
import art.arcane.volmlib.util.structure.StructureCarveShape;
@@ -114,7 +115,7 @@ public class IrisStructureLocatorContractTest {
@Test
public void locatableIndexIncludesAliasesAndSeparatesEditableFromNativePlacements() {
IrisData data = mock(IrisData.class);
IrisData data = MockPackData.create();
IrisStructure structure = new IrisStructure();
structure.setLoadKey("test:city");
structure.setVanillaSource("source:city");
@@ -156,7 +157,7 @@ public class IrisStructureLocatorContractTest {
@Test
public void nativeStructureReplacementSuppressesOnlyItsRegisteredSource() {
IrisData data = mock(IrisData.class);
IrisData data = MockPackData.create();
Engine engine = mock(Engine.class);
IrisDimension dimension = mock(IrisDimension.class);
IrisStructurePlacement placement = new IrisStructurePlacement()
@@ -185,7 +186,7 @@ public class IrisStructureLocatorContractTest {
@Test
public void vanillaSourceRequiresExplicitDimensionSuppression() {
IrisData data = mock(IrisData.class);
IrisData data = MockPackData.create();
IrisStructure structure = new IrisStructure();
structure.setLoadKey("test:city");
structure.setVanillaSource("minecraft:ancient_city");
@@ -214,7 +215,7 @@ public class IrisStructureLocatorContractTest {
@Test
public void regionReplacementFailsInsteadOfFallingBackToNative() {
IrisData data = mock(IrisData.class);
IrisData data = MockPackData.create();
IrisStructure structure = new IrisStructure();
structure.setLoadKey("test:city");
structure.setVanillaSource("minecraft:ancient_city");
@@ -242,7 +243,7 @@ public class IrisStructureLocatorContractTest {
@Test
public void geometryFailureFailsInsteadOfFallingBackToNative() {
IrisData data = mock(IrisData.class);
IrisData data = MockPackData.create();
IrisStructure structure = new IrisStructure()
.setStartPool("test:start")
.setMaxDepth(1)
@@ -304,7 +305,7 @@ public class IrisStructureLocatorContractTest {
@Test
public void missingVanillaSourceFailsInsteadOfFallingBackToNative() {
IrisData data = mock(IrisData.class);
IrisData data = MockPackData.create();
IrisStructure structure = new IrisStructure();
structure.setLoadKey("test:city");
when(data.load(IrisStructure.class, "test:city", false)).thenReturn(structure);
@@ -327,7 +328,7 @@ public class IrisStructureLocatorContractTest {
@Test
public void missingNonReplacementStructureFailsInsteadOfBeingSkipped() {
IrisData data = mock(IrisData.class);
IrisData data = MockPackData.create();
IrisStructurePlacement placement = new IrisStructurePlacement();
placement.getStructures().add("test:missing");
IrisDimension dimension = mock(IrisDimension.class);
@@ -752,7 +753,7 @@ public class IrisStructureLocatorContractTest {
@Test
public void placementIndexIsScopedAndInvalidatedPerEngine() {
IrisData sharedData = mock(IrisData.class);
IrisData sharedData = MockPackData.create();
Engine firstEngine = emptyEngine(sharedData);
Engine secondEngine = emptyEngine(sharedData);
Set<String> firstIndex = IrisStructureLocator.placedKeys(firstEngine);
@@ -1089,7 +1090,7 @@ public class IrisStructureLocatorContractTest {
private Engine densityEngine(double density, boolean underground, int worldMin, int worldHeight,
int placementMin, int placementMax) {
IrisData data = mock(IrisData.class);
IrisData data = MockPackData.create();
IrisStructure structure = new IrisStructure();
structure.setLoadKey("test:density");
when(data.load(IrisStructure.class, "test:density", false)).thenReturn(structure);