add included mod ids to manifest

This commit is contained in:
moehreag 2024-05-27 12:04:30 +02:00
parent dde054f6a9
commit f8c6b88d8f
2 changed files with 12 additions and 55 deletions

View file

@ -4,7 +4,7 @@ import java.util.*;
import org.jetbrains.annotations.NotNull;
public final class ModCredits implements Map<String, Collection<String>> {
public final class ModCredits {
public static ModCredits of(Map<String, Collection<String>> credits){
return new ModCredits(credits);
@ -23,63 +23,15 @@ public final class ModCredits implements Map<String, Collection<String>> {
return credits.getOrDefault(name, Collections.emptySet());
}
@Override
public int size() {
return credits.size();
}
@Override
public boolean isEmpty() {
return credits.isEmpty();
}
@Override
public boolean containsKey(Object key) {
return credits.containsKey(key);
}
@Override
public boolean containsValue(Object value) {
return credits.containsValue(value);
}
@Override
public Collection<String> get(Object key) {
return credits.get(key);
}
@Override
public Collection<String> put(String key, Collection<String> value) {
return List.of();
}
@Override
public Collection<String> remove(Object key) {
return List.of();
}
@Override
public void putAll(@NotNull Map<? extends String, ? extends Collection<String>> m) {
}
@Override
public void clear() {
}
@Override
public @NotNull Set<String> keySet() {
return credits.keySet();
}
@Override
public @NotNull Collection<Collection<String>> values() {
return credits.values();
}
@Override
public @NotNull Set<Entry<String, Collection<String>>> entrySet() {
public @NotNull Set<Map.Entry<String, Collection<String>>> entrySet() {
return credits.entrySet();
}
}

View file

@ -118,16 +118,21 @@ public class Minecraft implements NonsensePlugin {
if (opt.isPresent()) {
ModProperties p = opt.get();
modProperties.add(p);
List<String> jars = p.extensions().getOrDefault(BuiltinExtensions.INCLUDED_JARS, Collections.emptyList());
List<List<Map<String, String>>> entries = p.extensions().getOrDefault(BuiltinExtensions.INCLUDED_JARS, Collections.emptyList());
if (entries.isEmpty()){
return;
}
try (FileSystem fs = FileSystems.newFileSystem(mod)){
for (String jar : jars) {
Path path = fs.getPath(jar);
for (var jars : entries) {
for (Map<String, String> jar : jars) {
Path path = fs.getPath(jar.get("path"));
mods.add(path);
findJiJMods(path, mods);
}
}
}
}
}
@Override
public Collection<ModProperties> getMods() {