Iris has no loaders for loot tables, spawners, entities and markers any more

Callers read them through LootResources and SpawnResources; the pack's loot check moved to iris:loot. RegistryMatter
asks its subclass how to load a key, the entity command handler lists entities through the module kind.
This commit is contained in:
piexel committed 2026-10-09 22:24:20 +02:00
1 parent 406d3e47d3
commit e120991ad3
24 files changed
+423 -394

No files matched your search

@@ -44,10 +44,11 @@ public class StructureResourcesTest {
try {
var catalog = data.getModules().pack().catalog();
var kinds = catalog.resourceKinds().stream().map(ResourceKindRegistration::kind)
.filter(kind -> kind.id().toString().startsWith("iris:structure/")).toList();
assertEquals(List.of("iris:structure/piece", "iris:structure/pool", "iris:structure/structure"),
catalog.resourceKinds().stream().map(registration -> registration.kind().id().toString()).toList());
assertEquals(List.of("jigsaw-pieces", "jigsaw-pools", "structures"),
catalog.resourceKinds().stream().map(ResourceKindRegistration::kind).map(kind -> kind.folder()).toList());
kinds.stream().map(kind -> kind.id().toString()).toList());
assertEquals(List.of("jigsaw-pieces", "jigsaw-pools", "structures"), kinds.stream().map(kind -> kind.folder()).toList());
assertTrue(catalog.validators().stream().map(ValidatorRegistration::validator).anyMatch(StructureValidator.class::isInstance));
assertFalse(data.getLoaders().containsKey(IrisStructure.class));
assertFalse(data.getLoaders().containsKey(IrisJigsawPool.class));
@@ -146,7 +147,8 @@ public class StructureResourcesTest {
List<JSONObject> entries = ModuleResourceSchemas.entries(data, true);
assertEquals(List.of("./.iris/schema/jigsaw-pieces-schema.json", "./.iris/schema/jigsaw-pools-schema.json",
"./.iris/schema/structures-schema.json"), entries.stream().map(entry -> entry.getString("url")).toList());
"./.iris/schema/structures-schema.json"),
entries.stream().map(entry -> entry.getString("url")).filter(url -> url.contains("jigsaw") || url.contains("structures-")).toList());
JSONObject structures = new JSONObject(Files.readString(pack.resolve(".iris/schema/structures-schema.json")));
JSONObject startPool = structures.getJSONObject("properties").getJSONObject("startPool");
assertEquals("#/definitions/erzjigsaw-pools", startPool.getString("$ref"));
@@ -0,0 +1,113 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.loot;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.core.project.ModuleResourceSchemas;
import art.arcane.iris.core.project.SchemaTestPlatform;
import art.arcane.iris.engine.object.loot.IrisLootTable;
import art.arcane.volmlib.util.json.JSONObject;
import com.volmit.host.ValidatorRegistration;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
/** Loot tables are a resource kind of module {@code iris:loot}, read from the folder packs have always had. */
public class LootResourcesTest {
@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
@Test
public void theLootModuleOwnsTheKindAndItsValidator() throws Exception {
IrisData data = IrisData.openValidation(lootPack("owned").toFile());
try {
var catalog = data.getModules().pack().catalog();
assertEquals(List.of("iris:loot/table"), catalog.resourceKinds().stream().map(registration -> registration.kind().id().toString())
.filter(id -> id.startsWith("iris:loot/")).toList());
assertTrue(catalog.validators().stream().map(ValidatorRegistration::validator).anyMatch(LootValidator.class::isInstance));
assertFalse(data.getLoaders().containsKey(IrisLootTable.class));
} finally {
data.close();
}
}
@Test
public void tablesAreReadThroughPackResourcesAndReadAgainAfterAReload() throws Exception {
Path pack = lootPack("tables");
IrisData data = IrisData.openValidation(pack.toFile());
try {
IrisLootTable table = LootResources.table(data, "dungeon/chest");
assertEquals("Chest", table.getName());
assertEquals("dungeon/chest", table.getLoadKey());
assertEquals(pack.resolve("loot/dungeon/chest.json").toFile(), table.getLoadFile());
assertEquals(List.of("dungeon/chest"), LootResources.tableKeys(data));
assertEquals(List.of(table), LootResources.tables(data, List.of("dungeon/chest", "missing")));
assertNull(LootResources.table(data, "missing"));
assertNull(LootResources.table(data, " "));
write(pack, "loot/dungeon/chest.json", "{\"name\":\"Renamed\"}");
data.dump();
assertEquals("Renamed", LootResources.table(data, "dungeon/chest").getName());
} finally {
data.close();
}
}
@Test
public void studioDescribesLootTablesAsIrisDoes() throws Exception {
Path pack = lootPack("studio");
IrisData data = IrisData.openValidation(pack.toFile());
try (SchemaTestPlatform ignored = SchemaTestPlatform.bind(temporaryFolder.getRoot())) {
List<JSONObject> entries = ModuleResourceSchemas.entries(data, true);
assertTrue(entries.stream().anyMatch(entry -> entry.getString("url").equals("./.iris/schema/loot-schema.json")));
assertTrue(Files.exists(pack.resolve(".iris/schema/loot-schema.json")));
} finally {
data.close();
}
}
private Path lootPack(String name) throws Exception {
File pack = temporaryFolder.newFolder(name);
write(pack.toPath(), "dimensions/main.json", "{\"regions\":[\"region\"]}");
write(pack.toPath(), "regions/region.json", "{\"landBiomes\":[\"biome\"]}");
write(pack.toPath(), "biomes/biome.json", "{\"name\":\"Biome\"}");
write(pack.toPath(), "loot/dungeon/chest.json", "{\"name\":\"Chest\",\"loot\":[{\"type\":\"stick\"}]}");
return pack.toPath();
}
private static void write(Path root, String relative, String content) throws Exception {
Path path = root.resolve(relative);
Files.createDirectories(path.getParent());
Files.writeString(path, content, StandardCharsets.UTF_8);
}
}
@@ -1,8 +1,10 @@
package art.arcane.iris.core.pack;
package art.arcane.iris.engine.loot;
import art.arcane.iris.engine.object.loot.IrisLoot;
import art.arcane.iris.engine.object.loot.IrisLootTable;
import art.arcane.iris.engine.object.annotations.MaxNumber;
import com.volmit.validation.Problem;
import com.volmit.validation.Severity;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
@@ -16,7 +18,7 @@ import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class PackValidatorLootTest {
public class LootValidatorTest {
@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
@@ -28,7 +30,7 @@ public class PackValidatorLootTest {
write(pack, "dimensions/main.json", "{\"loot\":{\"mode\":\"FALLBACK\",\"multiplier\":0.5,"
+ "\"tables\":[\"global/clutter\"]}}");
assertTrue(PackLootValidator.validateLootGraph(pack).errors().isEmpty());
assertTrue(errors(pack).isEmpty());
}
@Test
@@ -37,7 +39,7 @@ public class PackValidatorLootTest {
write(pack, "dimensions/main.json", "{\"loot\":{\"tables\":[\"missing\"]}}");
assertEquals(List.of("Dimension 'main'.loot.tables[0] references missing loot table 'missing'."),
PackLootValidator.validateLootGraph(pack).errors());
errors(pack));
}
@Test
@@ -47,7 +49,7 @@ public class PackValidatorLootTest {
+ "\"loot\":[{\"type\":\"\",\"rarity\":0,\"minAmount\":3,\"maxAmount\":1,"
+ "\"enchantments\":[{\"enchantment\":\"\",\"minLevel\":4,\"maxLevel\":2,\"chance\":2}]}]}");
List<String> errors = PackLootValidator.validateLootGraph(pack).errors();
List<String> errors = errors(pack);
assertTrue(errors.stream().anyMatch(error -> error.contains(".rarity must be at least 1")));
assertTrue(errors.stream().anyMatch(error -> error.contains(".minPicked must not exceed")));
@@ -63,7 +65,7 @@ public class PackValidatorLootTest {
File pack = temporaryFolder.newFolder("pack");
write(pack, "dimensions/main.json", "{\"loot\":{\"mode\":\"MERGE\",\"multiplier\":-1,\"tables\":[]}}");
List<String> errors = PackLootValidator.validateLootGraph(pack).errors();
List<String> errors = errors(pack);
assertEquals(2, errors.size());
assertTrue(errors.get(0).contains(".mode must be"));
@@ -74,12 +76,12 @@ public class PackValidatorLootTest {
public void enforcesPublishedLootMultiplierCap() throws Exception {
File acceptedPack = temporaryFolder.newFolder("accepted-pack");
write(acceptedPack, "dimensions/main.json", "{\"loot\":{\"multiplier\":16,\"tables\":[]}}");
assertTrue(PackLootValidator.validateLootGraph(acceptedPack).errors().isEmpty());
assertTrue(errors(acceptedPack).isEmpty());
File rejectedPack = temporaryFolder.newFolder("rejected-pack");
write(rejectedPack, "dimensions/main.json", "{\"loot\":{\"multiplier\":16.01,\"tables\":[]}}");
assertEquals(List.of("Dimension 'main'.loot.multiplier must be a finite number from 0 to 16."),
PackLootValidator.validateLootGraph(rejectedPack).errors());
errors(rejectedPack));
}
@Test
@@ -88,7 +90,7 @@ public class PackValidatorLootTest {
write(pack, "loot/boundary.json", "{\"minPicked\":64,\"maxPicked\":64,\"maxTries\":256,"
+ "\"loot\":[{\"type\":\"stone\",\"minAmount\":64,\"maxAmount\":64}]}");
assertTrue(PackLootValidator.validateLootGraph(pack).errors().isEmpty());
assertTrue(errors(pack).isEmpty());
}
@Test
@@ -97,7 +99,7 @@ public class PackValidatorLootTest {
write(pack, "loot/excessive.json", "{\"minPicked\":65,\"maxPicked\":65,\"maxTries\":257,"
+ "\"loot\":[{\"type\":\"stone\",\"minAmount\":65,\"maxAmount\":65}]}");
List<String> errors = PackLootValidator.validateLootGraph(pack).errors();
List<String> errors = errors(pack);
assertTrue(errors.contains("Loot table 'excessive'.minPicked must be at most 64."));
assertTrue(errors.contains("Loot table 'excessive'.maxPicked must be at most 64."));
@@ -127,12 +129,11 @@ public class PackValidatorLootTest {
write(pack, "loot/t.json", "{\"loot\":[{\"type\":\"minecraft:stone\"}]}");
write(pack, "biomes/x.json", "{\"loot\":{\"mode\":\"CLEAR\",\"tables\":[\"t\"]}}");
PackLootValidator.LootGraphIssues issues = PackLootValidator.validateLootGraph(pack);
assertTrue(issues.errors().isEmpty());
assertTrue(errors(pack).isEmpty());
assertEquals(List.of("Biome 'x'.loot uses mode CLEAR and lists 1 table(s); CLEAR clears parent tables"
+ " and contributes no tables of its own, so these entries are dead. Use REPLACE to substitute them."),
issues.warnings());
warnings(pack));
}
@Test
@@ -140,12 +141,23 @@ public class PackValidatorLootTest {
File pack = temporaryFolder.newFolder("clear-dangling");
write(pack, "biomes/x.json", "{\"loot\":{\"mode\":\"CLEAR\",\"tables\":[\"missing\"]}}");
PackLootValidator.LootGraphIssues issues = PackLootValidator.validateLootGraph(pack);
assertTrue(issues.errors().contains(
assertTrue(errors(pack).contains(
"Biome 'x'.loot.tables[0] references missing loot table 'missing'."));
}
private static List<String> errors(File pack) {
return messages(pack, Severity.ERROR);
}
private static List<String> warnings(File pack) {
return messages(pack, Severity.WARNING);
}
private static List<String> messages(File pack, Severity severity) {
return LootValidator.check(pack).stream().filter(problem -> problem.severity() == severity).map(Problem::message).toList();
}
private void write(File root, String relative, String content) throws Exception {
File file = new File(root, relative);
Files.createDirectories(file.toPath().getParent());
@@ -19,7 +19,6 @@
package art.arcane.iris.engine.spawn;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.core.loader.ResourceLoader;
import art.arcane.iris.core.modules.ModuleResourceFixture;
import art.arcane.iris.engine.UsableBlockPlatform;
import art.arcane.iris.engine.framework.Engine;
@@ -58,9 +57,7 @@ public class EntitySpawningTest {
private static final BlockPosition MARKER_BLOCK = new BlockPosition(40, 70, -12);
private Engine engine;
private ResourceLoader<IrisSpawner> spawners;
private ResourceLoader<IrisMarker> markers;
private ResourceLoader<IrisEntity> entities;
private ModuleResourceFixture fixture;
private PackWorld world;
@BeforeClass
@@ -74,18 +71,11 @@ public class EntitySpawningTest {
}
@Before
@SuppressWarnings("unchecked")
public void buildWorld() {
engine = mock(Engine.class);
IrisData data = mock(IrisData.class);
spawners = (ResourceLoader<IrisSpawner>) mock(ResourceLoader.class);
markers = (ResourceLoader<IrisMarker>) mock(ResourceLoader.class);
entities = (ResourceLoader<IrisEntity>) mock(ResourceLoader.class);
when(engine.getData()).thenReturn(data);
when(data.getSpawnerLoader()).thenReturn(spawners);
when(data.getMarkerLoader()).thenReturn(markers);
when(data.getEntityLoader()).thenReturn(entities);
ModuleResourceFixture.serve(data);
fixture = ModuleResourceFixture.serve(data);
when(data.getPackResources().items()).thenReturn(mock(ItemRegistry.class));
IrisWorld engineWorld = mock(IrisWorld.class);
when(engineWorld.platformWorld()).thenReturn(mock(PlatformWorld.class));
@@ -109,8 +99,8 @@ public class EntitySpawningTest {
public void aMarkerMeansItsSpawnersAndWhetherItGoesAwayWhenItsBlockChanges() {
IrisMarker marker = new IrisMarker();
marker.setSpawners(new KList<>("zombies", "missing")).setEmptyAbove(true).setRemoveOnChange(false);
when(markers.load("camp")).thenReturn(marker);
when(spawners.load("zombies")).thenReturn(new IrisSpawner());
fixture.resource(SpawnResources.MARKERS, "camp", marker);
fixture.resource(SpawnResources.SPAWNERS, "zombies", new IrisSpawner());
EntitySpawns.MarkerRule rule = new EntitySpawning().marker(world, "camp").orElseThrow();
@@ -130,13 +120,13 @@ public class EntitySpawningTest {
IrisSpawner spawner = new IrisSpawner();
spawner.setLoadKey("camp/zombies");
spawner.getSpawns().add(new IrisEntitySpawn().setEntity("zombie").setMinSpawns(2).setMaxSpawns(2));
when(spawners.load("camp/zombies")).thenReturn(spawner);
fixture.resource(SpawnResources.SPAWNERS, "camp/zombies", spawner);
IrisMarker marker = new IrisMarker();
marker.setExhaustionChance(2);
when(markers.load("camp")).thenReturn(marker);
fixture.resource(SpawnResources.MARKERS, "camp", marker);
IrisEntity zombie = new IrisEntity();
zombie.setType("minecraft:zombie");
when(entities.load("zombie")).thenReturn(zombie);
fixture.resource(SpawnResources.ENTITIES, "zombie", zombie);
when(engine.getMinHeight()).thenReturn(-64);
EntitySpawns.Plan plan = new EntitySpawning()
@@ -156,7 +146,7 @@ public class EntitySpawningTest {
@Test
public void aSpawnerThatCannotFireOrHasNoEntitiesPlansNothing() {
IrisSpawner empty = new IrisSpawner();
when(spawners.load("empty")).thenReturn(empty);
fixture.resource(SpawnResources.SPAWNERS, "empty", empty);
Optional<EntitySpawns.Plan> plan = new EntitySpawning().plan(world, new EntitySpawns.Marker(MARKER_BLOCK, "camp", "empty", false));
@@ -167,7 +157,7 @@ public class EntitySpawningTest {
public void anEntityOfThePackResolvesToTheSpecTheHostSpawns() {
IrisEntity entity = new IrisEntity();
entity.setType("minecraft:cow").setCustomName("&6Bessie").setBaby(true);
when(entities.load("cow")).thenReturn(entity);
fixture.resource(SpawnResources.ENTITIES, "cow", entity);
EntitySpec spec = new EntitySpawning().entity(world, "cow").orElseThrow();
@@ -0,0 +1,104 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.spawn;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.object.entity.IrisEntity;
import art.arcane.iris.engine.object.entity.spawn.IrisSpawner;
import art.arcane.iris.engine.object.marker.IrisMarker;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
/** Spawners, entities and markers are resource kinds of module {@code iris:spawn}, read from the folders packs have always had. */
public class SpawnResourcesTest {
@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
@Test
public void theSpawnModuleOwnsTheKinds() throws Exception {
IrisData data = IrisData.openValidation(spawnPack("owned").toFile());
try {
var catalog = data.getModules().pack().catalog();
var kinds = catalog.resourceKinds().stream().map(registration -> registration.kind())
.filter(kind -> kind.id().toString().startsWith("iris:spawn/")).toList();
assertEquals(List.of("iris:spawn/entity", "iris:spawn/marker", "iris:spawn/spawner"), kinds.stream().map(kind -> kind.id().toString()).toList());
assertEquals(List.of("entities", "markers", "spawners"), kinds.stream().map(kind -> kind.folder()).toList());
assertFalse(data.getLoaders().containsKey(IrisSpawner.class));
assertFalse(data.getLoaders().containsKey(IrisEntity.class));
assertFalse(data.getLoaders().containsKey(IrisMarker.class));
} finally {
data.close();
}
}
@Test
public void spawnersEntitiesAndMarkersAreReadThroughPackResources() throws Exception {
Path pack = spawnPack("spawns");
IrisData data = IrisData.openValidation(pack.toFile());
try {
IrisSpawner spawner = SpawnResources.spawner(data, "camp/zombies");
assertEquals("camp/zombies", spawner.getLoadKey());
assertEquals(pack.resolve("spawners/camp/zombies.json").toFile(), spawner.getLoadFile());
assertEquals("minecraft:zombie", SpawnResources.entity(data, "zombie").getType());
assertEquals(List.of("camp/zombies"), SpawnResources.marker(data, "camp").getSpawners());
assertEquals(List.of(spawner), SpawnResources.spawners(data, List.of("camp/zombies", "missing")));
assertEquals(List.of("zombie"), SpawnResources.entityKeys(data));
assertEquals(List.of("camp"), SpawnResources.markerKeys(data));
assertEquals(List.of("camp/zombies"), SpawnResources.spawnerKeys(data));
assertNull(SpawnResources.spawner(data, "missing"));
assertNull(SpawnResources.entity(data, " "));
write(pack, "entities/zombie.json", "{\"type\":\"minecraft:husk\"}");
data.dump();
assertEquals("minecraft:husk", SpawnResources.entity(data, "zombie").getType());
} finally {
data.close();
}
}
private Path spawnPack(String name) throws Exception {
File pack = temporaryFolder.newFolder(name);
write(pack.toPath(), "dimensions/main.json", "{\"regions\":[\"region\"]}");
write(pack.toPath(), "regions/region.json", "{\"landBiomes\":[\"biome\"]}");
write(pack.toPath(), "biomes/biome.json", "{\"name\":\"Biome\"}");
write(pack.toPath(), "entities/zombie.json", "{\"type\":\"minecraft:zombie\"}");
write(pack.toPath(), "spawners/camp/zombies.json", "{\"spawns\":[{\"entity\":\"zombie\"}]}");
write(pack.toPath(), "markers/camp.json", "{\"spawners\":[\"camp/zombies\"]}");
return pack.toPath();
}
private static void write(Path root, String relative, String content) throws Exception {
Path path = root.resolve(relative);
Files.createDirectories(path.getParent());
Files.writeString(path, content, StandardCharsets.UTF_8);
}
}
@@ -89,8 +89,7 @@ import static org.junit.Assert.fail;
* deleted) and {@code Particles} (Bukkit registry lookups in a static initializer).
* <p>
* <b>Deliberately not asserted:</b> method and constructor descriptors. These classes legitimately
* expose a Bukkit-typed edge that only the Bukkit adapter calls - {@code IrisEntity.spawn(Engine,
* Location)}, {@code IrisLoot.get(...) -> ItemStack}, {@code IrisObjectRotation.rotate(BlockData,
* expose a Bukkit-typed edge that only the Bukkit adapter calls - {@code IrisObjectRotation.rotate(BlockData,
* ...)}, {@code TileData.toBukkit(Block)} and ~60 more. Method descriptors are resolved at
* invocation, never at class load, field walk or equals/hashCode/toString, so they are not a modded
* boot hazard. Fields and supertypes are, and both are asserted hard below.
@@ -110,15 +109,11 @@ public class PackTypeBukkitPurityGateTest {
* #registeredRootListMatchesIrisData()} fails if the source drifts away from it.
*/
private static final List<String> GSON_REGISTERED_ROOTS = List.of(
"art.arcane.iris.engine.object.loot.IrisLootTable",
"art.arcane.iris.engine.object.entity.spawn.IrisSpawner",
"art.arcane.iris.engine.object.entity.IrisEntity",
"art.arcane.iris.engine.object.world.region.IrisRegion",
"art.arcane.iris.engine.object.world.biome.IrisBiome",
"art.arcane.iris.engine.object.mod.IrisMod",
"art.arcane.iris.engine.object.world.dimension.IrisDimension",
"art.arcane.iris.engine.object.terrain.IrisGenerator",
"art.arcane.iris.engine.object.marker.IrisMarker",
"art.arcane.iris.engine.object.material.IrisBlockData",
"art.arcane.iris.engine.object.noise.expression.IrisExpression",
"art.arcane.iris.engine.object.prefab.IrisObject",
@@ -133,7 +128,11 @@ public class PackTypeBukkitPurityGateTest {
private static final List<String> MODULE_RESOURCE_ROOTS = List.of(
"art.arcane.iris.engine.object.structure.IrisStructure",
"art.arcane.iris.engine.object.structure.jigsaw.IrisJigsawPool",
"art.arcane.iris.engine.object.structure.jigsaw.IrisJigsawPiece");
"art.arcane.iris.engine.object.structure.jigsaw.IrisJigsawPiece",
"art.arcane.iris.engine.object.loot.IrisLootTable",
"art.arcane.iris.engine.object.entity.spawn.IrisSpawner",
"art.arcane.iris.engine.object.entity.IrisEntity",
"art.arcane.iris.engine.object.marker.IrisMarker");
/**
* Types reachable from a pack that are not roots and carry no {@code @Snippet}, but are
@@ -145,8 +144,9 @@ public class PackTypeBukkitPurityGateTest {
"art.arcane.iris.engine.object.loot.IrisVanillaLootTable");
/**
* Bukkit-registry constant holders that a core pack type references, so their class initializer
* runs on the modded loaders too. {@code Particles} is statically imported by {@code IrisEntity}.
* Bukkit-registry constant holders that a core pack type may reference, so their class initializer
* must run on the modded loaders too. {@code Particles} is used by the Bukkit entity spawner now; it stays in the
* gate so that a pack type importing it again keeps working.
* ({@code Materials} and {@code Attributes} have the same shape but are only reachable from the
* Bukkit adapter, so they stay out of the gate.)
*/
@@ -1,11 +1,10 @@
package art.arcane.iris.util.project.matter;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.core.loader.IrisRegistrant;
import art.arcane.iris.core.loader.ResourceLoader;
import art.arcane.iris.core.modules.ModuleResourceFixture;
import art.arcane.iris.engine.spawn.SpawnResources;
import art.arcane.iris.engine.object.entity.spawn.IrisSpawner;
import art.arcane.iris.util.project.matter.slices.SpawnerMatter;
import art.arcane.volmlib.util.collection.KMap;
import org.junit.Test;
import java.io.ByteArrayInputStream;
@@ -18,7 +17,6 @@ import java.util.concurrent.Future;
import static org.junit.Assert.assertSame;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class RegistryMatterContextTest {
@Test
@@ -49,14 +47,9 @@ public class RegistryMatterContextTest {
}
}
@SuppressWarnings("unchecked")
private IrisData dataReturning(IrisSpawner resolved) {
ResourceLoader<IrisSpawner> loader = mock(ResourceLoader.class);
when(loader.load("test-spawner")).thenReturn(resolved);
KMap<Class<? extends IrisRegistrant>, ResourceLoader<? extends IrisRegistrant>> loaders = new KMap<>();
loaders.put(IrisSpawner.class, loader);
IrisData data = mock(IrisData.class);
when(data.getLoaders()).thenReturn(loaders);
ModuleResourceFixture.serve(data).resource(SpawnResources.SPAWNERS, "test-spawner", resolved);
return data;
}
}