mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
Fix applying mods to server libraries.
This commit is contained in:
@@ -125,35 +125,28 @@ public class MinecraftLibraryProvider {
|
||||
|
||||
private void applyClientLibrary(Library library) {
|
||||
switch (library.target()) {
|
||||
case COMPILE -> {
|
||||
addLibrary(Constants.Configurations.MINECRAFT_CLIENT_COMPILE_LIBRARIES, library);
|
||||
}
|
||||
case RUNTIME -> {
|
||||
addLibrary(Constants.Configurations.MINECRAFT_CLIENT_RUNTIME_LIBRARIES, library);
|
||||
}
|
||||
case NATIVES -> {
|
||||
addLibrary(Constants.Configurations.MINECRAFT_NATIVES, library);
|
||||
}
|
||||
case LOCAL_MOD -> {
|
||||
ExternalModuleDependency dependency = (ExternalModuleDependency) project.getDependencies().create(library.mavenNotation());
|
||||
dependency.setTransitive(false);
|
||||
project.getDependencies().add("modLocalRuntime", dependency);
|
||||
}
|
||||
case COMPILE -> addLibrary(Constants.Configurations.MINECRAFT_CLIENT_COMPILE_LIBRARIES, library);
|
||||
case RUNTIME -> addLibrary(Constants.Configurations.MINECRAFT_CLIENT_RUNTIME_LIBRARIES, library);
|
||||
case NATIVES -> addLibrary(Constants.Configurations.MINECRAFT_NATIVES, library);
|
||||
case LOCAL_MOD -> applyLocalModLibrary(library);
|
||||
}
|
||||
}
|
||||
|
||||
private void applyServerLibrary(Library library) {
|
||||
switch (library.target()) {
|
||||
case COMPILE -> {
|
||||
addLibrary(Constants.Configurations.MINECRAFT_SERVER_COMPILE_LIBRARIES, library);
|
||||
}
|
||||
case RUNTIME -> {
|
||||
addLibrary(Constants.Configurations.MINECRAFT_SERVER_RUNTIME_LIBRARIES, library);
|
||||
}
|
||||
default -> throw new IllegalStateException("Target not supported for server library");
|
||||
case COMPILE -> addLibrary(Constants.Configurations.MINECRAFT_SERVER_COMPILE_LIBRARIES, library);
|
||||
case RUNTIME -> addLibrary(Constants.Configurations.MINECRAFT_SERVER_RUNTIME_LIBRARIES, library);
|
||||
case LOCAL_MOD -> applyLocalModLibrary(library);
|
||||
default -> throw new IllegalStateException("Target not supported for server library: %s".formatted(library));
|
||||
}
|
||||
}
|
||||
|
||||
private void applyLocalModLibrary(Library library) {
|
||||
ExternalModuleDependency dependency = (ExternalModuleDependency) project.getDependencies().create(library.mavenNotation());
|
||||
dependency.setTransitive(false);
|
||||
project.getDependencies().add("modLocalRuntime", dependency);
|
||||
}
|
||||
|
||||
private void addLibrary(String configuration, Library library) {
|
||||
addDependency(configuration, library.mavenNotation());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user