diff --git a/core/src/main/java/art/arcane/iris/core/modules/EngineSpawnCooldowns.java b/core/src/main/java/art/arcane/iris/core/modules/EngineSpawnCooldowns.java
new file mode 100644
index 000000000..a9516fba5
--- /dev/null
+++ b/core/src/main/java/art/arcane/iris/core/modules/EngineSpawnCooldowns.java
@@ -0,0 +1,58 @@
+/*
+ * 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 .
+ */
+
+package art.arcane.iris.core.modules;
+
+import art.arcane.iris.builtin.spawn.SpawnCooldowns;
+import art.arcane.iris.engine.framework.Engine;
+
+import java.util.function.ToLongFunction;
+
+/** The cooldowns of an engine's spawners, in the data the engine saves with its world. */
+final class EngineSpawnCooldowns implements SpawnCooldowns {
+ private final Engine engine;
+
+ EngineSpawnCooldowns(Engine engine) {
+ this.engine = engine;
+ }
+
+ @Override
+ public boolean canSpawn(String spawner, long intervalMilliseconds) {
+ return engine.getEngineData().getCooldown(spawner).canSpawn(intervalMilliseconds);
+ }
+
+ @Override
+ public void spawned(String spawner) {
+ engine.getEngineData().getCooldown(spawner).spawn();
+ }
+
+ @Override
+ public boolean canSpawnInChunk(int chunkX, int chunkZ, String spawner, long intervalMilliseconds) {
+ return engine.getEngineData().getChunk(chunkX, chunkZ).getCooldown(spawner).canSpawn(intervalMilliseconds);
+ }
+
+ @Override
+ public void spawnedInChunk(int chunkX, int chunkZ, String spawner) {
+ engine.getEngineData().getChunk(chunkX, chunkZ).getCooldown(spawner).spawn();
+ }
+
+ @Override
+ public void forgetExpired(ToLongFunction intervalMilliseconds) {
+ engine.getEngineData().cleanup(intervalMilliseconds);
+ }
+}
diff --git a/core/src/main/java/art/arcane/iris/core/modules/IrisLiveWorld.java b/core/src/main/java/art/arcane/iris/core/modules/IrisLiveWorld.java
new file mode 100644
index 000000000..97f8a4a0c
--- /dev/null
+++ b/core/src/main/java/art/arcane/iris/core/modules/IrisLiveWorld.java
@@ -0,0 +1,155 @@
+/*
+ * 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 .
+ */
+
+package art.arcane.iris.core.modules;
+
+import art.arcane.iris.builtin.LiveWorld;
+import art.arcane.iris.builtin.spawn.SpawnCooldowns;
+import art.arcane.iris.core.loader.IrisRegistrant;
+import art.arcane.iris.engine.framework.Engine;
+import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
+import art.arcane.iris.engine.object.value.IrisPosition;
+import art.arcane.iris.engine.object.world.biome.IrisBiome;
+import art.arcane.iris.engine.framework.PlacedObject;
+import art.arcane.iris.engine.object.world.biome.InferredType;
+import art.arcane.iris.spi.IrisPlatforms;
+import art.arcane.iris.spi.PlatformWorld;
+import art.arcane.iris.util.common.scheduling.J;
+import art.arcane.volmlib.util.matter.slices.MarkerMatter;
+import com.volmit.IrisFeature;
+import com.volmit.resource.ResourceId;
+import com.volmit.world.BlockPosition;
+
+import java.util.List;
+import java.util.Optional;
+import java.util.Set;
+
+/**
+ * An engine as {@link LiveWorld} shows it to the built-in services: the engine's own answers for a block, turned into pack
+ * resource ids and values.
+ */
+final class IrisLiveWorld implements LiveWorld {
+ private final Engine engine;
+ private final IrisPackResources resources;
+ private final SpawnCooldowns cooldowns;
+ private volatile Set platformLootTables;
+
+ IrisLiveWorld(Engine engine, IrisPackResources resources) {
+ this.engine = engine;
+ this.resources = resources;
+ this.cooldowns = new EngineSpawnCooldowns(engine);
+ }
+
+ @Override
+ public int bottomY() {
+ return engine.getMinHeight();
+ }
+
+ @Override
+ public ResourceId surfaceBiome(int x, int z) {
+ return idOf(engine.getSurfaceBiome(x, z));
+ }
+
+ @Override
+ public ResourceId caveBiome(int x, int y, int z) {
+ IrisBiome cave = engine.getCaveBiome(x, y, z);
+ return cave == null ? surfaceBiome(x, z) : idOf(cave);
+ }
+
+ @Override
+ public BiomeKind surfaceKind(int x, int z) {
+ InferredType type = engine.getSurfaceBiome(x, z).getInferredType();
+ return BiomeKind.valueOf(type.name());
+ }
+
+ @Override
+ public double terrainHeight(int x, int z) {
+ return engine.getComplex().getHeightStream().get(x, z);
+ }
+
+ @Override
+ public int highestBlock(int x, int z, boolean ignoreFluid) {
+ return engine.getHeight(x, z, ignoreFluid);
+ }
+
+ @Override
+ public Optional settings(Class type, Level level, int x, int y, int z) {
+ IrisRegistrant owner = switch (level) {
+ case DIMENSION -> engine.getDimension();
+ case REGION -> engine.getRegion(x, z);
+ case SURFACE_BIOME -> engine.getSurfaceBiome(x, z);
+ case BIOME -> engine.getBiome(x, y, z);
+ case CAVE_BIOME -> engine.getCaveBiome(x, y, z);
+ };
+ return owner == null ? Optional.empty() : owner.getModuleSettings().find(type);
+ }
+
+ @Override
+ public Optional sky() {
+ PlatformWorld world = engine.getWorld().platformWorld();
+ if (world == null) {
+ return Optional.empty();
+ }
+ return Optional.of(new Sky(world.getTime(), world.isStorming(), world.isThundering()));
+ }
+
+ @Override
+ public boolean studio() {
+ return engine.isStudio();
+ }
+
+ @Override
+ public Set platformLootTables() {
+ Set known = platformLootTables;
+ if (known == null) {
+ known = Set.copyOf(IrisPlatforms.get().registries().lootTableKeys());
+ platformLootTables = known;
+ }
+ return known;
+ }
+
+ @Override
+ public List caveFloors(int chunkX, int chunkZ) {
+ if (J.isFolia()) {
+ return List.of();
+ }
+ int bottom = engine.getMinHeight();
+ return engine.getMantle().findMarkers(chunkX, chunkZ, MarkerMatter.CAVE_FLOOR).stream()
+ .map(floor -> new BlockPosition(floor.getX(), floor.getY() - bottom, floor.getZ()))
+ .toList();
+ }
+
+ @Override
+ public Optional objectLoots(int x, int y, int z) {
+ PlacedObject placed = engine.getObjectPlacement(x, y, z);
+ IrisObjectPlacement placement = placed == null ? null : placed.getPlacement();
+ if (placement == null) {
+ return Optional.empty();
+ }
+ return Optional.of(new ObjectLoots(placement.getLoot(), placement.getVanillaLoot(), placement.isOverrideGlobalLoot()));
+ }
+
+ @Override
+ public SpawnCooldowns spawnCooldowns() {
+ return cooldowns;
+ }
+
+ private ResourceId idOf(IrisBiome biome) {
+ return resources.idOf(biome.getLoadKey());
+ }
+}
diff --git a/core/src/main/java/art/arcane/iris/core/modules/IrisPackWorld.java b/core/src/main/java/art/arcane/iris/core/modules/IrisPackWorld.java
index eee4832ee..aec04842f 100644
--- a/core/src/main/java/art/arcane/iris/core/modules/IrisPackWorld.java
+++ b/core/src/main/java/art/arcane/iris/core/modules/IrisPackWorld.java
@@ -19,6 +19,7 @@
package art.arcane.iris.core.modules;
import art.arcane.iris.builtin.IrisSeed;
+import art.arcane.iris.builtin.LiveWorld;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.framework.SeedManager;
import com.volmit.ModuleLog;
@@ -35,12 +36,13 @@ import java.util.function.Function;
* pack's resources reload under it. Iris's built-in modules reach the engine through {@link #of(PackWorld)}, as built-in
* reaches do through {@link IrisPackSettings#of}.
*/
-public final class IrisPackWorld implements PackWorld, IrisSeed.Source {
+public final class IrisPackWorld implements PackWorld, IrisSeed.Source, LiveWorld.Source {
private final Engine engine;
private final IrisPackResources resources;
private final WorldStates states;
private final ModuleLog log;
private final Map viewsByLog;
+ private final LiveWorld liveWorld;
IrisPackWorld(Engine engine) {
this(engine, engine.getData().getPackResources(), new WorldStates(), IrisApiLogger.hostLog(), new ConcurrentHashMap<>());
@@ -53,6 +55,7 @@ public final class IrisPackWorld implements PackWorld, IrisSeed.Source {
this.states = states;
this.log = log;
this.viewsByLog = viewsByLog;
+ this.liveWorld = new IrisLiveWorld(engine, resources);
}
/** Iris's own view of {@code world}, which Iris hands to every stage, service and lifecycle hook. */
@@ -99,6 +102,11 @@ public final class IrisPackWorld implements PackWorld, IrisSeed.Source {
return viewsByLog.computeIfAbsent(log, moduleLog -> new IrisPackWorld(engine, resources, states, moduleLog, viewsByLog));
}
+ @Override
+ public LiveWorld liveWorld() {
+ return liveWorld;
+ }
+
@Override
public long seed(IrisSeed seed) {
SeedManager seeds = engine.getSeedManager();
diff --git a/core/src/main/java/art/arcane/iris/engine/IrisWorldManager.java b/core/src/main/java/art/arcane/iris/engine/IrisWorldManager.java
index 93fbfd7bf..59abe339c 100644
--- a/core/src/main/java/art/arcane/iris/engine/IrisWorldManager.java
+++ b/core/src/main/java/art/arcane/iris/engine/IrisWorldManager.java
@@ -58,7 +58,6 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
private final KList updateQueue = new KList<>();
final ChronoLatch cl;
private final ChronoLatch clw;
- private final ChronoLatch cln;
private final ChronoLatch chunkUpdater;
private final ChronoLatch chunkDiscovery;
private final KMap> cleanup = new KMap<>();
@@ -89,7 +88,6 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
public IrisWorldManager() {
super(null);
cl = null;
- cln = null;
clw = null;
looper = null;
chunkUpdater = null;
@@ -101,7 +99,6 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
super(engine);
chunkUpdater = new ChronoLatch(3000);
chunkDiscovery = new ChronoLatch(5000);
- cln = new ChronoLatch(60000);
cl = new ChronoLatch(3000);
clw = new ChronoLatch(1000, true);
cleanupService = createCleanupExecutor(getTarget().getWorld().name());
@@ -157,10 +154,6 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
chunkMaintenance.discoverChunks();
}
- if (cln.flip()) {
- getEngine().getEngineData().cleanup(getEngine());
- }
-
if (!IrisSettings.get().getWorld().isMarkerEntitySpawningSystem()
&& !IrisSettings.get().getWorld().isAmbientEntitySpawningSystem()) {
return 3000L;
diff --git a/core/src/test/java/art/arcane/iris/core/modules/IrisLiveWorldTest.java b/core/src/test/java/art/arcane/iris/core/modules/IrisLiveWorldTest.java
new file mode 100644
index 000000000..ce9cef4cc
--- /dev/null
+++ b/core/src/test/java/art/arcane/iris/core/modules/IrisLiveWorldTest.java
@@ -0,0 +1,208 @@
+/*
+ * 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 .
+ */
+
+package art.arcane.iris.core.modules;
+
+import art.arcane.iris.builtin.LiveWorld;
+import art.arcane.iris.builtin.LiveWorld.BiomeKind;
+import art.arcane.iris.builtin.LiveWorld.Level;
+import art.arcane.iris.builtin.LiveWorld.ObjectLoots;
+import art.arcane.iris.builtin.LiveWorld.Sky;
+import art.arcane.iris.builtin.loot.LootSettings;
+import art.arcane.iris.builtin.loot.ObjectLoot;
+import art.arcane.iris.builtin.spawn.SpawnCooldowns;
+import art.arcane.iris.core.loader.IrisData;
+import art.arcane.iris.core.loader.IrisRegistrant;
+import art.arcane.iris.engine.framework.Engine;
+import art.arcane.iris.engine.framework.EngineGeneration;
+import art.arcane.iris.engine.UsableBlockPlatform;
+import art.arcane.iris.engine.framework.PlacedObject;
+import art.arcane.iris.engine.mantle.EngineMantle;
+import art.arcane.iris.engine.object.TestSettings;
+import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
+import art.arcane.iris.engine.object.runtime.IrisEngineData;
+import art.arcane.iris.engine.object.value.IrisPosition;
+import art.arcane.iris.engine.object.world.IrisWorld;
+import art.arcane.iris.engine.object.world.biome.InferredType;
+import art.arcane.iris.engine.object.world.biome.IrisBiome;
+import art.arcane.iris.engine.object.world.region.IrisRegion;
+import art.arcane.iris.engine.object.world.dimension.IrisDimension;
+import art.arcane.iris.spi.PlatformWorld;
+import art.arcane.volmlib.util.collection.KList;
+import com.volmit.world.BlockPosition;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.util.List;
+import java.util.Optional;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+/** What the built-in services ask a running world: the engine's answers for a block, as values. */
+public class IrisLiveWorldTest {
+ private static final int X = 10;
+ private static final int Y = 70;
+ private static final int Z = -20;
+ private static final int BOTTOM = -64;
+
+ private Engine engine;
+ private LiveWorld live;
+
+ @BeforeClass
+ public static void bindPlatform() {
+ UsableBlockPlatform.bind();
+ }
+
+ @AfterClass
+ public static void unbindPlatform() {
+ UsableBlockPlatform.unbind();
+ }
+
+ @Before
+ public void buildWorld() {
+ engine = mock(Engine.class);
+ IrisData data = mock(IrisData.class);
+ ModuleResourceFixture.serve(data);
+ when(engine.getData()).thenReturn(data);
+ when(engine.getMinHeight()).thenReturn(BOTTOM);
+ live = LiveWorld.of(new EngineGeneration(engine).world());
+ }
+
+ @Test
+ public void everyLevelReadsTheSettingsOfItsOwnerAtTheBlock() {
+ IrisDimension dimension = owner(IrisDimension.class, "dimension");
+ IrisRegion region = owner(IrisRegion.class, "region");
+ IrisBiome surface = owner(IrisBiome.class, "surface");
+ IrisBiome here = owner(IrisBiome.class, "here");
+ IrisBiome cave = owner(IrisBiome.class, "cave");
+ when(engine.getDimension()).thenReturn(dimension);
+ when(engine.getRegion(X, Z)).thenReturn(region);
+ when(engine.getSurfaceBiome(X, Z)).thenReturn(surface);
+ when(engine.getBiome(X, Y, Z)).thenReturn(here);
+ when(engine.getCaveBiome(X, Y, Z)).thenReturn(cave);
+
+ assertEquals(List.of("dimension", "region", "surface", "here", "cave"), List.of(
+ tableAt(Level.DIMENSION), tableAt(Level.REGION), tableAt(Level.SURFACE_BIOME), tableAt(Level.BIOME), tableAt(Level.CAVE_BIOME)));
+ }
+
+ @Test
+ public void aLevelWithoutSettingsOrOwnerHasNone() {
+ IrisRegion bare = mock(IrisRegion.class);
+ when(bare.getModuleSettings()).thenReturn(ModuleSettings.NONE);
+ when(engine.getRegion(X, Z)).thenReturn(bare);
+
+ assertTrue(live.settings(LootSettings.class, Level.REGION, X, Y, Z).isEmpty());
+ assertTrue(live.settings(LootSettings.class, Level.BIOME, X, Y, Z).isEmpty());
+ }
+
+ @Test
+ public void biomesAreAskedByTheIdsThePackGivesThem() {
+ IrisBiome surface = mock(IrisBiome.class);
+ when(surface.getLoadKey()).thenReturn("Plains/Meadow");
+ when(surface.getInferredType()).thenReturn(InferredType.SHORE);
+ when(engine.getSurfaceBiome(X, Z)).thenReturn(surface);
+ when(engine.getCaveBiome(X, Y, Z)).thenReturn(null);
+
+ assertEquals(engine.getData().getPackResources().idOf("Plains/Meadow"), live.surfaceBiome(X, Z));
+ assertEquals(live.surfaceBiome(X, Z), live.caveBiome(X, Y, Z));
+ assertEquals(BiomeKind.SHORE, live.surfaceKind(X, Z));
+ assertEquals(BOTTOM, live.bottomY());
+ }
+
+ @Test
+ public void theSkyIsTheWorldsTimeAndWeatherOnceThereIsAPlatformWorld() {
+ IrisWorld world = mock(IrisWorld.class);
+ when(engine.getWorld()).thenReturn(world);
+ assertEquals(Optional.empty(), live.sky());
+
+ PlatformWorld platform = mock(PlatformWorld.class);
+ when(platform.getTime()).thenReturn(18000L);
+ when(platform.isThundering()).thenReturn(true);
+ when(world.platformWorld()).thenReturn(platform);
+
+ assertEquals(Optional.of(new Sky(18000L, false, true)), live.sky());
+ }
+
+ @Test
+ public void caveFloorsAreHeightsAboveTheBottom() {
+ EngineMantle mantle = mock(EngineMantle.class);
+ when(engine.getMantle()).thenReturn(mantle);
+ when(mantle.findMarkers(2, 3, art.arcane.volmlib.util.matter.slices.MarkerMatter.CAVE_FLOOR))
+ .thenReturn(new KList<>(new IrisPosition(40, 0, 50), new IrisPosition(41, 30, 51)));
+
+ assertEquals(List.of(new BlockPosition(40, 64, 50), new BlockPosition(41, 94, 51)), live.caveFloors(2, 3));
+ }
+
+ @Test
+ public void anObjectsLootIsWhatItsPlacementDefines() {
+ IrisObjectPlacement placement = new IrisObjectPlacement();
+ placement.getLoot().add(new ObjectLoot("chest", 2));
+ placement.setOverrideGlobalLoot(true);
+ when(engine.getObjectPlacement(X, Y, Z)).thenReturn(new PlacedObject(placement, null, 1, X, Z));
+ when(engine.getObjectPlacement(X + 1, Y, Z)).thenReturn(new PlacedObject(null, null, 1, X + 1, Z));
+
+ ObjectLoots loots = live.objectLoots(X, Y, Z).orElseThrow();
+
+ assertEquals(1, loots.packTables().size());
+ assertEquals("chest", loots.packTables().getFirst().name());
+ assertTrue(loots.platformTables().isEmpty());
+ assertTrue(loots.overridesGlobalLoot());
+ assertTrue(loots.defined());
+ assertTrue(live.objectLoots(X + 1, Y, Z).isEmpty());
+ assertTrue(live.objectLoots(X + 2, Y, Z).isEmpty());
+ }
+
+ @Test
+ public void spawnCooldownsCountPerWorldAndPerChunkAndForgetWhatRanOut() {
+ IrisEngineData saved = new IrisEngineData();
+ when(engine.getEngineData()).thenReturn(saved);
+ SpawnCooldowns cooldowns = live.spawnCooldowns();
+
+ assertTrue(cooldowns.canSpawn("wolves", 600_000L));
+ cooldowns.spawned("wolves");
+ cooldowns.spawnedInChunk(3, 4, "wolves");
+ cooldowns.spawned("gone");
+
+ assertFalse(cooldowns.canSpawn("wolves", 600_000L));
+ assertFalse(cooldowns.canSpawnInChunk(3, 4, "wolves", 600_000L));
+ assertTrue(cooldowns.canSpawnInChunk(3, 5, "wolves", 600_000L));
+
+ cooldowns.forgetExpired(spawner -> spawner.equals("wolves") ? 600_000L : -1L);
+
+ assertFalse("a cooldown still running stays", cooldowns.canSpawn("wolves", 600_000L));
+ assertFalse(cooldowns.canSpawnInChunk(3, 4, "wolves", 600_000L));
+ assertTrue("a spawner the pack lacks is forgotten", cooldowns.canSpawn("gone", 600_000L));
+ }
+
+ private T owner(Class type, String table) {
+ T owner = mock(type);
+ LootSettings loot = TestSettings.of(LootSettings.class, "{\"tables\": [\"" + table + "\"]}");
+ when(owner.getModuleSettings()).thenReturn(BuiltInPack.settings(loot));
+ return owner;
+ }
+
+ private String tableAt(Level level) {
+ return live.settings(LootSettings.class, level, X, Y, Z).orElseThrow().tables().getFirst();
+ }
+}