Follow the loot source id and the explicit jigsaw overrides

Debug lore names the table by its path. The native structure start plan keeps
SOURCE for an option the pack left out, as before.
This commit is contained in:
piexel committed 2026-10-28 04:16:10 +01:00
1 parent b48192d355
commit 5e2eaba07e
5 files changed
+11 -8

No files matched your search

@@ -230,10 +230,10 @@ public final class ModuleVanillaStructures {
boxed(overrides.maxDistanceHorizontal()),
boxed(overrides.maxDistanceVertical()),
overrides.useExpansionHack().orElse(null),
overrides.projectStartToHeightmap().name(),
overrides.projectStartToHeightmap().map(Enum::name).orElse(NativeJigsawOverrides.SOURCE),
boxed(overrides.dimensionPaddingBottom()),
boxed(overrides.dimensionPaddingTop()),
overrides.liquidSettings().name());
overrides.liquidSettings().map(Enum::name).orElse(NativeJigsawOverrides.SOURCE));
}
private static Integer boxed(OptionalInt value) {
@@ -3,7 +3,8 @@ package art.arcane.iris.engine.framework;
/**
* Changes a module makes to a jigsaw structure's registered definition before the platform assembles a start of it,
* as the platform code applies them: a blank text or a null value keeps the definition's own. The heightmap and liquid
* settings are the names of the API's {@code JigsawOverrides} constants ({@code SOURCE} keeps the definition's).
* settings are the names of the API's {@code JigsawOverrides} constants, or {@code SOURCE} to keep the definition's (the
* API leaves such an option out instead).
*/
public record NativeJigsawOverrides(
String startPool,
@@ -205,7 +205,7 @@ public final class BukkitItemStacks {
return;
}
long combined = (long) source.tableRarity() * source.entryRarity();
lore.add(C.GRAY + "From: " + source.table().get() + " (" + Form.pc(1D / source.tableRarity(), CHANCE_DIGITS) + ")");
lore.add(C.GRAY + "From: " + source.table().get().path() + " (" + Form.pc(1D / source.tableRarity(), CHANCE_DIGITS) + ")");
lore.add(C.GRAY + "1 in " + combined + " Chance (" + Form.pc(1D / combined, CHANCE_DIGITS) + ")");
}
}
@@ -241,7 +241,7 @@ public class ModuleSettingsDecoderTest {
() -> values("{\"mossValues\": {\"jigsaw\": {\"liquidSettings\": \"WET\"}}}"));
assertTrue(failure.getMessage(), failure.getMessage().contains(
"\"WET\" is not one of [SOURCE, IGNORE_WATERLOGGING, APPLY_WATERLOGGING]"));
"\"WET\" is not one of [IGNORE_WATERLOGGING, APPLY_WATERLOGGING]"));
}
private ValuesSettings values(String json) {
@@ -127,12 +127,14 @@ public class LootItemsTest {
public void debugItemsSayWhereTheyCameFrom() {
LootTable table = table("{\"name\": \"dungeon\", \"rarity\": 4, \"minPicked\": 1, \"maxPicked\": 1, \"loot\": [{\"type\": \"diamond\", \"rarity\": 3}]}");
List<ItemDrop> drops = new LootItems(registry, true, ModuleLogs.discarding()).draw("dungeon", table, LOOT_SEED, 0, 64, 0);
ResourceId dungeon = ResourceId.parse("test:dungeon");
List<ItemDrop> drops = new LootItems(registry, true, ModuleLogs.discarding()).draw(dungeon, table, LOOT_SEED, 0, 64, 0);
for (ItemDrop drop : drops) {
assertEquals(Optional.of(new ItemDrop.Source(Optional.of("dungeon"), 4, 3)), drop.source());
assertEquals(Optional.of(new ItemDrop.Source(Optional.of(dungeon), 4, 3)), drop.source());
}
assertTrue(new LootItems(registry, false, ModuleLogs.discarding()).draw("dungeon", table, LOOT_SEED, 0, 64, 0).stream().allMatch(drop -> drop.source().isEmpty()));
assertTrue(new LootItems(registry, false, ModuleLogs.discarding()).draw(dungeon, table, LOOT_SEED, 0, 64, 0).stream().allMatch(drop -> drop.source().isEmpty()));
}
@Test