mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-30 17:54:56 +00:00
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:
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.maxDistanceHorizontal()),
|
||||||
boxed(overrides.maxDistanceVertical()),
|
boxed(overrides.maxDistanceVertical()),
|
||||||
overrides.useExpansionHack().orElse(null),
|
overrides.useExpansionHack().orElse(null),
|
||||||
overrides.projectStartToHeightmap().name(),
|
overrides.projectStartToHeightmap().map(Enum::name).orElse(NativeJigsawOverrides.SOURCE),
|
||||||
boxed(overrides.dimensionPaddingBottom()),
|
boxed(overrides.dimensionPaddingBottom()),
|
||||||
boxed(overrides.dimensionPaddingTop()),
|
boxed(overrides.dimensionPaddingTop()),
|
||||||
overrides.liquidSettings().name());
|
overrides.liquidSettings().map(Enum::name).orElse(NativeJigsawOverrides.SOURCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Integer boxed(OptionalInt value) {
|
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,
|
* 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
|
* 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(
|
public record NativeJigsawOverrides(
|
||||||
String startPool,
|
String startPool,
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ public final class BukkitItemStacks {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
long combined = (long) source.tableRarity() * source.entryRarity();
|
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) + ")");
|
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\"}}}"));
|
() -> values("{\"mossValues\": {\"jigsaw\": {\"liquidSettings\": \"WET\"}}}"));
|
||||||
|
|
||||||
assertTrue(failure.getMessage(), failure.getMessage().contains(
|
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) {
|
private ValuesSettings values(String json) {
|
||||||
|
|||||||
@@ -127,12 +127,14 @@ public class LootItemsTest {
|
|||||||
public void debugItemsSayWhereTheyCameFrom() {
|
public void debugItemsSayWhereTheyCameFrom() {
|
||||||
LootTable table = table("{\"name\": \"dungeon\", \"rarity\": 4, \"minPicked\": 1, \"maxPicked\": 1, \"loot\": [{\"type\": \"diamond\", \"rarity\": 3}]}");
|
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) {
|
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
|
@Test
|
||||||
|
|||||||
Reference in new issue
Block a user