mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-25 21:40:05 +00:00
Trimmed quiet ingest namespaces
- The mod ingest summary and manifest namespace list only include namespaces that produced at least one ingest item, so mods without worldgen content no longer print empty summary lines
This commit is contained in:
1 parent
506e545edf
commit
8388194129
2 files changed
+36
-2
No files matched your search
@@ -96,8 +96,19 @@ public final class ModIngester {
|
||||
items.addAll(featureItems);
|
||||
items.addAll(ModStructureIngester.ingest(request.catalog().structures(), namespaces, hostBiomes, dimension));
|
||||
pack.flush();
|
||||
IngestManifest.write(pack, request.catalog(), request.dimensionKey(), targetKey, namespaces, items);
|
||||
return new ModIngestReport(target, items, IngestManifest.summary(targetKey, pack, namespaces, items));
|
||||
Set<String> reported = reportedNamespaces(namespaces, items);
|
||||
IngestManifest.write(pack, request.catalog(), request.dimensionKey(), targetKey, reported, items);
|
||||
return new ModIngestReport(target, items, IngestManifest.summary(targetKey, pack, reported, items));
|
||||
}
|
||||
|
||||
private static Set<String> reportedNamespaces(Set<String> namespaces, List<ModIngestItem> items) {
|
||||
Set<String> reported = new TreeSet<>();
|
||||
for (ModIngestItem item : items) {
|
||||
if (namespaces.contains(item.namespace())) {
|
||||
reported.add(item.namespace());
|
||||
}
|
||||
}
|
||||
return reported;
|
||||
}
|
||||
|
||||
private static Set<String> selectNamespaces(ModIngestRequest request, Set<String> reserved) {
|
||||
|
||||
@@ -20,6 +20,8 @@ package art.arcane.iris.pack.ingest;
|
||||
|
||||
import art.arcane.iris.pack.PackValidationResult;
|
||||
import art.arcane.iris.pack.PackValidator;
|
||||
import art.arcane.iris.pack.ingest.catalog.CatalogNamespace;
|
||||
import art.arcane.iris.pack.ingest.catalog.WorldgenCatalog;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
@@ -30,6 +32,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.FileAlreadyExistsException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -203,6 +206,26 @@ public class ModIngesterPackTest {
|
||||
assertTrue(report.items().stream().noneMatch(item -> item.namespace().equals("minecraft")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void namespacesWithoutAnyIngestedContentAreLeftOutOfTheManifestAndSummary() throws Exception {
|
||||
Path root = folder.getRoot().toPath();
|
||||
Path source = ModIngestFixture.writeSourcePack(root);
|
||||
Path target = root.resolve("packs").resolve("quiet");
|
||||
WorldgenCatalog fixture = ModIngestFixture.catalog();
|
||||
List<CatalogNamespace> namespaces = new ArrayList<>(fixture.namespaces());
|
||||
namespaces.add(new CatalogNamespace("quietmod", "Quiet Mod", "1.0.0"));
|
||||
WorldgenCatalog catalog = new WorldgenCatalog(fixture.format(), fixture.minecraftVersion(), fixture.platform(),
|
||||
fixture.capturedAtEpochMillis(), fixture.contentFingerprint(), namespaces, fixture.biomes(),
|
||||
fixture.placedFeatures(), fixture.structures(), fixture.dimensionTypes(), fixture.levelStems());
|
||||
|
||||
ModIngestReport report = ModIngester.ingest(new ModIngestRequest(source, target, "overworld", catalog, Set.of(), false));
|
||||
|
||||
assertEquals(List.of("examplemod", "othermod"),
|
||||
ModIngestFixture.strings(ModIngestFixture.readJson(target.resolve("ingest/manifest.json")).get("namespaces")));
|
||||
assertTrue(report.summaryLines().stream().noneMatch(line -> line.startsWith("quietmod")));
|
||||
assertEquals(3, report.summaryLines().size());
|
||||
}
|
||||
|
||||
private static List<String> directoryNames(Path root) throws IOException {
|
||||
try (Stream<Path> entries = Files.list(root)) {
|
||||
return entries.map((Path entry) -> entry.getFileName().toString()).sorted().toList();
|
||||
|
||||
Reference in new issue
Block a user