Compare commits
1 commit
de85222cbf
...
6eeade90b0
Author | SHA1 | Date | |
---|---|---|---|
6eeade90b0 |
|
@ -19,8 +19,7 @@ jobs:
|
||||||
- name: Check Gradle Setup
|
- name: Check Gradle Setup
|
||||||
run: |
|
run: |
|
||||||
chmod +x ./gradlew
|
chmod +x ./gradlew
|
||||||
cat ./settings.gradle.kts | sed "s/^.*:minecraft.*$//g" > settings.gradle.kts1
|
cat ./settings.gradle.kts | sed "s/^.*:minecraft.*$//g" > settings.gradle.kts
|
||||||
mv settings.gradle.kts1 settings.gradle.kts
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
./gradlew :publishMavenJavaPublicationToFrogMCSnapshotsMavenRepository \
|
./gradlew :publishMavenJavaPublicationToFrogMCSnapshotsMavenRepository \
|
||||||
|
|
|
@ -3,11 +3,11 @@ plugins {
|
||||||
`java-library`
|
`java-library`
|
||||||
id("io.freefair.lombok") version "8.+"
|
id("io.freefair.lombok") version "8.+"
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
id("dev.frogmc.meta-update") version "0.0.1-alpha.7"
|
id("dev.frogmc.meta-update") version "0.0.1-alpha.3"
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "dev.frogmc"
|
group = "dev.frogmc"
|
||||||
version = "0.0.1-alpha.14"
|
version = "0.0.1-alpha.2"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
@ -24,17 +24,14 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(libs.thyroxine)
|
implementation(libs.thyroxine){
|
||||||
|
isTransitive = false
|
||||||
|
}
|
||||||
compileOnly("org.apache.logging.log4j:log4j-slf4j2-impl:2.22.1")
|
compileOnly("org.apache.logging.log4j:log4j-slf4j2-impl:2.22.1")
|
||||||
compileOnly("org.apache.logging.log4j:log4j-api:2.22.1")
|
compileOnly("org.apache.logging.log4j:log4j-api:2.22.1")
|
||||||
compileOnly("org.apache.logging.log4j:log4j-core:2.22.1")
|
compileOnly("org.apache.logging.log4j:log4j-core:2.22.1")
|
||||||
compileOnly("com.google.code.gson:gson:2.0")
|
|
||||||
compileOnly("com.google.guava:guava:21.0") // Lowest possible version for our code
|
|
||||||
|
|
||||||
api(libs.mixin) {
|
api(libs.mixin)
|
||||||
exclude(group = "com.google.code.gson")
|
|
||||||
exclude(group = "com.google.guava")
|
|
||||||
}
|
|
||||||
api(libs.mixinextras)
|
api(libs.mixinextras)
|
||||||
api(libs.nightconfig)
|
api(libs.nightconfig)
|
||||||
api(libs.annotations)
|
api(libs.annotations)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
thyroxine = "0.0.1-alpha.6"
|
thyroxine = "0.0.1-alpha.3"
|
||||||
nightconfig = "3.7.3"
|
nightconfig = "3.7.2"
|
||||||
mixin = "0.14.0+mixin.0.8.6"
|
mixin = "0.14.0+mixin.0.8.6"
|
||||||
annotations = "24.1.0"
|
annotations = "24.1.0"
|
||||||
mixinextras = "0.3.6"
|
mixinextras = "0.3.6"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
id("dev.frogmc.phytotelma") version "0.0.1-alpha.15"
|
id("dev.frogmc.phytotelma") version "0.0.1-alpha.10"
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -20,9 +20,7 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
phytotelma {
|
phytotelma {
|
||||||
minecraft {
|
minecraft("1.21", "1.20.6")
|
||||||
version = "1.21"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
|
|
|
@ -148,7 +148,7 @@ public class FrogLoaderImpl implements FrogLoader {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<ModProperties> getModProperties(String id) {
|
public Optional<ModProperties> getModProperties(String id) {
|
||||||
return mods.values().stream().map(m -> m.get(id)).filter(Objects::nonNull).findFirst();
|
return mods.values().stream().flatMap(m -> m.values().stream()).filter(m -> m.id().equals(id)).findFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Collection<String> collectModIds() {
|
private Collection<String> collectModIds() {
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package dev.frogmc.frogloader.impl;
|
package dev.frogmc.frogloader.impl;
|
||||||
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
import dev.frogmc.frogloader.api.FrogLoader;
|
import dev.frogmc.frogloader.api.FrogLoader;
|
||||||
import dev.frogmc.frogloader.api.mod.ModProperties;
|
import dev.frogmc.frogloader.api.mod.ModProperties;
|
||||||
|
@ -26,7 +24,7 @@ public class PluginLoader {
|
||||||
|
|
||||||
List<ModProvider> providers = new ArrayList<>(ServiceLoader.load(ModProvider.class).stream().map(ServiceLoader.Provider::get).toList()); // we need mutability & random access
|
List<ModProvider> providers = new ArrayList<>(ServiceLoader.load(ModProvider.class).stream().map(ServiceLoader.Provider::get).toList()); // we need mutability & random access
|
||||||
Map<String, Collection<ModProperties>> properties = new HashMap<>();
|
Map<String, Collection<ModProperties>> properties = new HashMap<>();
|
||||||
int[] size = new int[]{providers.size()}; // use a separate size variable to not have to iterate over the list over and over again
|
int[] size = new int[providers.size()]; // use a separate size variable to not have to iterate over the list over and over again
|
||||||
for (int i = 0; i < size[0]; i++) {
|
for (int i = 0; i < size[0]; i++) {
|
||||||
ModProvider plugin = providers.get(i); // use random access to work around concurrent access (through modifications during iteration)
|
ModProvider plugin = providers.get(i); // use random access to work around concurrent access (through modifications during iteration)
|
||||||
LOGGER.debug("Found mod provider: {}", plugin.getClass().getName());
|
LOGGER.debug("Found mod provider: {}", plugin.getClass().getName());
|
||||||
|
@ -35,7 +33,6 @@ public class PluginLoader {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
LOGGER.debug("Initialising mod provider: {}", plugin.id());
|
LOGGER.debug("Initialising mod provider: {}", plugin.id());
|
||||||
Files.createDirectories(gameDir.resolve(plugin.loadDirectory()));
|
|
||||||
Collection<ModProperties> loadedMods = plugin.loadMods(Discovery.find(gameDir.resolve(plugin.loadDirectory()),
|
Collection<ModProperties> loadedMods = plugin.loadMods(Discovery.find(gameDir.resolve(plugin.loadDirectory()),
|
||||||
plugin::isDirectoryApplicable,
|
plugin::isDirectoryApplicable,
|
||||||
plugin::isFileApplicable),
|
plugin::isFileApplicable),
|
||||||
|
@ -50,14 +47,12 @@ public class PluginLoader {
|
||||||
providers.add(provider);
|
providers.add(provider);
|
||||||
size[0]++;
|
size[0]++;
|
||||||
}));
|
}));
|
||||||
modProviders.add(plugin);
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
LOGGER.error("Error during plugin initialisation: ", e);
|
LOGGER.error("Error during plugin initialisation: ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Collection<ModProperties> flattened = Stream.concat(properties.values().stream().flatMap(Collection::stream),
|
Collection<ModProperties> flattened = properties.values().stream().flatMap(Collection::stream).toList();
|
||||||
mods.values().stream().map(Map::values).flatMap(Collection::stream)).toList();
|
|
||||||
try {
|
try {
|
||||||
Collection<ModProperties> solved = new ModDependencyResolver(flattened).solve();
|
Collection<ModProperties> solved = new ModDependencyResolver(flattened).solve();
|
||||||
properties.forEach((s, c) -> c.retainAll(solved));
|
properties.forEach((s, c) -> c.retainAll(solved));
|
||||||
|
@ -66,6 +61,7 @@ public class PluginLoader {
|
||||||
c.forEach(p -> map.put(p.id(), p));
|
c.forEach(p -> map.put(p.id(), p));
|
||||||
});
|
});
|
||||||
modIds.addAll(solved.stream().map(ModProperties::id).toList());
|
modIds.addAll(solved.stream().map(ModProperties::id).toList());
|
||||||
|
modProviders.addAll(providers);
|
||||||
} catch (ModDependencyResolver.UnfulfilledDependencyException e) {
|
} catch (ModDependencyResolver.UnfulfilledDependencyException e) {
|
||||||
LoaderGui.execUnfulfilledDep(CrashReportGenerator.writeReport(e, flattened), e, false);
|
LoaderGui.execUnfulfilledDep(CrashReportGenerator.writeReport(e, flattened), e, false);
|
||||||
} catch (ModDependencyResolver.BreakingModException e) {
|
} catch (ModDependencyResolver.BreakingModException e) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class UnfulfilledDepPage extends JScrollPane {
|
||||||
} else {
|
} else {
|
||||||
description.append("a Mod with id ").append(entry.dependency());
|
description.append("a Mod with id ").append(entry.dependency());
|
||||||
}
|
}
|
||||||
description.append(" with a version matching range:\n").append(entry.range().toString(" or ")).append("\nNo matching version is currently available.");
|
description.append(" with a version matching range:\n").append(entry.range().toString(" or ")).append("\nNo version is currently available.");
|
||||||
}
|
}
|
||||||
description.append("\nSuggested Solution: Install ")
|
description.append("\nSuggested Solution: Install ")
|
||||||
.append(
|
.append(
|
||||||
|
|
|
@ -15,14 +15,7 @@ public class ModUtil {
|
||||||
return "No mods loaded.";
|
return "No mods loaded.";
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, ModProperties> modIdMap = new HashMap<>();
|
Map<String, ModProperties> modIdMap = mods.stream().collect(Collectors.toMap(ModProperties::id, m -> m));
|
||||||
|
|
||||||
for (ModProperties p : mods) {
|
|
||||||
if (!modIdMap.containsKey(p.id()) || modIdMap.get(p.id()).version().compareTo(p.version()) < 0) {
|
|
||||||
modIdMap.put(p.id(), p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AtomicInteger indent = new AtomicInteger(1);
|
AtomicInteger indent = new AtomicInteger(1);
|
||||||
Map<ModProperties, Collection<String>> parentToChildIdMap = getParentMods(mods);
|
Map<ModProperties, Collection<String>> parentToChildIdMap = getParentMods(mods);
|
||||||
Collection<String> containedIds = parentToChildIdMap.values().stream().flatMap(Collection::stream).collect(Collectors.toUnmodifiableSet());
|
Collection<String> containedIds = parentToChildIdMap.values().stream().flatMap(Collection::stream).collect(Collectors.toUnmodifiableSet());
|
||||||
|
|
Loading…
Reference in a new issue