Здравствуйте, возникла проблема с запуском задачи runClient. При запуске не подгружаются требуемые зависимости.
Кратко по build.gradle:
в блоке dependencies подгружаю либы
includeNames - список названий jar файлов которые нужно подгрузить в jar и runClient
includePaths - список jar файлов которые нужно подгрузить в jar и minecraft.runs
в блоке afterEvaluate создаю includePaths по includeNames, после чего добавляю includePaths во все minecraft.runs по токену minecraft_classpath
Что есть на данный момент в build.gradle:
Кратко по build.gradle:
в блоке dependencies подгружаю либы
includeNames - список названий jar файлов которые нужно подгрузить в jar и runClient
includePaths - список jar файлов которые нужно подгрузить в jar и minecraft.runs
в блоке afterEvaluate создаю includePaths по includeNames, после чего добавляю includePaths во все minecraft.runs по токену minecraft_classpath
Что есть на данный момент в build.gradle:
Java:
plugins {
id 'eclipse'
id 'idea'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
}
group = mod_version
version = mod_group_id
base {
archivesName = mod_id
}
java {
toolchain.languageVersion = JavaLanguageVersion.of(17)
}
minecraft {
mappings channel: mapping_channel, version: mapping_version
copyIdeResources = true
runs {
// applies to all the run configs below
configureEach {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
mods {
"${mod_id}" {
source sourceSets.main
}
}
}
client {
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', mod_id
}
server {
property 'forge.enabledGameTestNamespaces', mod_id
args '--nogui'
}
// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
property 'forge.enabledGameTestNamespaces', mod_id
}
data {
// example of overriding the workingDirectory set in configureEach above
workingDirectory project.file('run-data')
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
}
}
}
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
}
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
implementation('org.bytedeco.javacpp-presets:ffmpeg-platform:4.1-1.4.4')
implementation('org.bytedeco.javacpp-presets:ffmpeg:4.1-1.4.4')
implementation('org.bytedeco:javacv:1.4.4')
}
def includePaths
def includeNames = new ArrayList<String>()
includeNames.addAll(Arrays.asList(
"ffmpeg-platform-4.1-1.4.4.jar",
"javacv-1.4.4.jar",
"javacpp-1.4.4.jar",
"ffmpeg-4.1-1.4.4.jar",
"ffmpeg-4.1-1.4.4-linux-x86_64.jar",
"ffmpeg-4.1-1.4.4-linux-armhf.jar",
"ffmpeg-4.1-1.4.4-linux-ppc64le.jar",
"ffmpeg-4.1-1.4.4-macosx-x86_64.jar",
"ffmpeg-4.1-1.4.4-windows-x86_64.jar",
))
afterEvaluate {
println "afterEvaluate"
includePaths = configurations.runtimeClasspath.collect {
includeNames.contains(it.name) ? (it.isDirectory() ? it : zipTree(it)) : null
}
includePaths.removeIf(Objects::isNull)
minecraft.runs.each { run ->
run.token 'minecraft_classpath', (includePaths - configurations.minecraft).join(';')
}
}
tasks.named('processResources', ProcessResources).configure {
var replaceProperties = [
minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range,
forge_version : forge_version, forge_version_range: forge_version_range,
loader_version_range: loader_version_range,
mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
mod_authors : mod_authors, mod_description: mod_description,
]
inputs.properties replaceProperties
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
expand replaceProperties + [project: project]
}
}
// Example for how to get properties into the manifest for reading at runtime.
tasks.named('jar', Jar).configure {
manifest {
attributes([
"Specification-Title" : mod_id,
"Specification-Vendor" : mod_authors,
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : project.jar.archiveVersion,
"Implementation-Vendor" : mod_authors,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from{includePaths}
finalizedBy 'reobfJar'
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}