Warn once for repeated pack warnings

- Warn once per pack, type and key for missing resources in the resource loaders
- Warn once per file for unreadable resources and report the stack only the first time
- Warn once for unknown loot materials, missing loot tables and objects without a load key
- Add IrisLogging.forgetOnceKeys(prefix) for scoped resets
- Forget a pack's warn-once keys on clearLists() and hotloaded() so a rebroken key warns again
- Add tests for scoped reset, loader misses, read failures, loot and marker warnings
This commit is contained in:
piexel committed 2026-11-14 16:06:22 +01:00
1 parent 832070cd69
commit 2adfbd4f5d
16 files changed
+705 -48

No files matched your search

@@ -30,6 +30,7 @@ import art.arcane.iris.world.loot.IrisLootTable;
import art.arcane.iris.structure.object.IrisObjectLoot;
import art.arcane.iris.structure.object.IrisObjectPlacement;
import art.arcane.iris.structure.object.IrisObjectVanillaLoot;
import art.arcane.iris.pack.loading.IrisData;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.mantle.runtime.MantleChunk;
@@ -40,6 +41,9 @@ import java.util.ArrayList;
import java.util.List;
public final class ModdedLootApplier {
private static final String LOOT_TABLE_KEY_KIND = "missing-loot-table";
private static final String VANILLA_LOOT_TABLE_KEY_KIND = "missing-vanilla-loot-table";
private ModdedLootApplier() {
}
@@ -117,7 +121,8 @@ public final class ModdedLootApplier {
}
IrisLootTable table = engine.getData().getLootLoader().load(loot.getName());
if (table == null) {
IrisLogging.warn("Couldn't find loot table " + loot.getName());
IrisLogging.warnOnce(IrisData.onceKey(engine.getData(), LOOT_TABLE_KEY_KIND, loot.getName()),
"Couldn't find loot table " + loot.getName());
continue;
}
bucket(engine, loot, new Candidate(new IrisLootSource(table), loot.getWeight()), access, exact, basic, global);
@@ -129,7 +134,8 @@ public final class ModdedLootApplier {
}
NativeContainerLoot.Table table = access.table(loot.getName());
if (table == null) {
IrisLogging.warn("Couldn't find vanilla loot table " + loot.getName());
IrisLogging.warnOnce(IrisData.onceKey(engine.getData(), VANILLA_LOOT_TABLE_KEY_KIND, loot.getName()),
"Couldn't find vanilla loot table " + loot.getName());
continue;
}
bucket(engine, loot, new Candidate(new NativeLootSource(table), loot.getWeight()), access, exact, basic, global);