Запуск NeoForge

Версия Minecraft
1.21.3
API
NeoForge
4,167
68
693
Итак! По многочисленным советам я, таки, перешёл на Intellij Idea, а, кроме того, мигрировал на NeoForge!
Так как обе приблуды для меня новые, хотелось получить магический пинок и, для начала, хотя бы просто запустить проект )
Надеюсь, на форуме уже есть знатоки )

Все ошибки в коде я исправил, neoforge.mods.toml написал, build.gradle настроил (хотя, почти ничего в нём не менял).
Но оно не запускается!
Выдаёт вот такую странную штуку (см. крашлог). Что делать?

Да, вижу, что он не можешь скопировать ресурсы. Однако, думаю, что дело не в них. Если я вообще удаляю файл enumextensions.json, то он сразу перестаёт мочь скопировать иной файл.

Возможно, что-то не так в build.gradle.

1737720906629.png

1737720974017.png
 
Краш-лог
14:58:50: Executing ':net.neoforged.devlaunch.Main.main()'...

Reusing configuration cache.
> Task :createArtifactManifest UP-TO-DATE
> Task :createMinecraftArtifacts UP-TO-DATE
> Task :generateModMetadata FAILED

> Task :compileJava FAILED
4 actionable tasks: 2 executed, 2 up-to-date
Configuration cache entry reused.
Error: Could not find or load main class worker.org.gradle.process.internal.worker.GradleWorkerMain
Caused by: java.lang.ClassNotFoundException: worker.org.gradle.process.internal.worker.GradleWorkerMain

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':generateModMetadata'.
> Could not copy file 'D:\Mods\MistyWorld\1.21.3_neo\src\main\resources\META-INF\enumextensions.json' to 'D:\Mods\MistyWorld\1.21.3_neo\build\generated\sources\modMetadata\enumextensions.json'.
> Missing property (GrassColorModifier) for Groovy template expansion. Defined keys [minecraft_version, minecraft_version_range, neo_version, neo_version_range, loader_version_range, mod_id, mod_name, mod_license, mod_version, mod_authors, mod_description].

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':compileJava'.
> Failed to run Gradle Worker Daemon
> Process 'Gradle Worker Daemon 4' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

BUILD FAILED in 271ms
14:58:50: Execution finished ':net.neoforged.devlaunch.Main.main()'.
Краш-лог:
14:58:50: Executing ':net.neoforged.devlaunch.Main.main()'...

Reusing configuration cache.
> Task :createArtifactManifest UP-TO-DATE
> Task :createMinecraftArtifacts UP-TO-DATE
> Task :generateModMetadata FAILED

> Task :compileJava FAILED
4 actionable tasks: 2 executed, 2 up-to-date
Configuration cache entry reused.
Error: Could not find or load main class worker.org.gradle.process.internal.worker.GradleWorkerMain
Caused by: java.lang.ClassNotFoundException: worker.org.gradle.process.internal.worker.GradleWorkerMain

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':generateModMetadata'.
> Could not copy file 'D:\Mods\MistyWorld\1.21.3_neo\src\main\resources\META-INF\enumextensions.json' to 'D:\Mods\MistyWorld\1.21.3_neo\build\generated\sources\modMetadata\enumextensions.json'.
   > Missing property (GrassColorModifier) for Groovy template expansion. Defined keys [minecraft_version, minecraft_version_range, neo_version, neo_version_range, loader_version_range, mod_id, mod_name, mod_license, mod_version, mod_authors, mod_description].

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':compileJava'.
> Failed to run Gradle Worker Daemon
   > Process 'Gradle Worker Daemon 4' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

BUILD FAILED in 271ms
14:58:50: Execution finished ':net.neoforged.devlaunch.Main.main()'.
Проблема со стороны Gradle. Ругается на наличие ${variable} в enumextensions.json, значение которому не присвоено.
Код:
> Could not copy file 'src\main\resources\META-INF\enumextensions.json' to 'build\generated\sources\modMetadata\enumextensions.json'.
   > Missing property (GrassColorModifier) for Groovy template expansion. Defined keys [minecraft_version, minecraft_version_range, neo_version, neo_version_range, loader_version_range, mod_id, mod_name, mod_license, mod_version, mod_authors, mod_description].
 
проверь файлик gradle.properties, у всех ли переменных корректные названия и именно ли они используются в build.gradle
Да, вроде, всё корректно.

Ругается на наличие ${variable} в enumextensions.json
Там нет таких переменных (
 
Я ж говорю, что тут не в файле дело. Если я его вообще удалю, он начнёт ругаться на следующий файл.
JSON:
{
  "entries": [
    {
      "enum": "net/minecraft/world/level/biome/BiomeSpecialEffects$GrassColorModifier",
      "name": "MIST_UP_SWAMP",
      "constructor": "(Ljava/lang/String;Lnet/minecraft/world/level/biome/BiomeSpecialEffects$GrassColorModifier$ColorModifier;)V",
      "parameters": {
        "class": "mist/init/enums/MistEnumExtensions",
        "method": "GrassColorModifier_UP_SWAMP"
      }
    },
    {
      "enum": "net/minecraft/world/level/biome/BiomeSpecialEffects$GrassColorModifier",
      "name": "MIST_UP_JUNGLE",
      "constructor": "(Ljava/lang/String;Lnet/minecraft/world/level/biome/BiomeSpecialEffects$GrassColorModifier$ColorModifier;)V",
      "parameters": {
        "class": "mist/init/enums/MistEnumExtensions",
        "method": "GrassColorModifier_UP_JUNGLE"
      }
    },
    {
      "enum": "net/minecraft/world/level/biome/BiomeSpecialEffects$GrassColorModifier",
      "name": "MIST_UP_SAVANNA",
      "constructor": "(Ljava/lang/String;Lnet/minecraft/world/level/biome/BiomeSpecialEffects$GrassColorModifier$ColorModifier;)V",
      "parameters": {
        "class": "mist/init/enums/MistEnumExtensions",
        "method": "GrassColorModifier_UP_SAVANNA"
      }
    }
  ]
}
 
Тот самый ${variable} кажись.

Покажи полностью build.gradle

UPD: Он всё подряд пытается из META-INF скопировать наверно
from "src/main/resources/META-INF"
Надо поменять путь остальных файлов или указать для from точный путь к mods.toml.
 
Последнее редактирование:
Как я и говорю, почти ничего не менял. Только accesstransformer подрубил.

Gradle (Groovy):
plugins {
    id 'idea'
    id 'java-library'
    id 'maven-publish'
    id 'net.neoforged.moddev' version '1.0.23'
}

tasks.named('wrapper', Wrapper).configure {
    // Define wrapper values here so as to not have to always do so when updating gradlew.properties.
    // Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with
    // documentation attached on cursor hover of gradle classes and methods. However, this comes with increased
    // file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards.
    // (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`)
    distributionType = Wrapper.DistributionType.BIN
}

version = mod_version
group = mod_group_id

repositories {
    mavenLocal()
}

base {
    archivesName = "${mod_name}-${minecraft_version}-${mod_version}"
}

// Mojang ships Java 21 to end users starting in 1.20.5, so mods should target Java 21.
java.toolchain.languageVersion = JavaLanguageVersion.of(21)

neoForge {
    // Specify the version of NeoForge to use.
    version = project.neo_version

    parchment {
        mappingsVersion = project.parchment_mappings_version
        minecraftVersion = project.parchment_minecraft_version
    }

    // This line is optional. Access Transformers are automatically detected
    accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')

    // Default run configurations.
    // These can be tweaked, removed, or duplicated as needed.
    runs {
        client {
            client()

            // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
            systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
        }

        server {
            server()
            programArgument '--nogui'
            systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
        }

        // 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 {
            type = "gameTestServer"
            systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
        }

        data {
            data()

            // example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
            // gameDirectory = project.file('run-data')

            // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
            programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
        }

        // applies to all the run configs above
        configureEach {
            // Recommended logging data for a userdev environment
            // The markers can be added/remove as needed separated by commas.
            // "SCAN": For mods scan.
            // "REGISTRIES": For firing of registry events.
            // "REGISTRYDUMP": For getting the contents of all registries.
            systemProperty 'forge.logging.markers', 'REGISTRIES'

            // Recommended logging level for the console
            // You can set various levels here.
            // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
            logLevel = org.slf4j.event.Level.DEBUG
        }
    }

    mods {
        // define mod <-> source bindings
        // these are used to tell the game which sources are for which mod
        // mostly optional in a single mod project
        // but multi mod projects should define one per mod
        "${mod_id}" {
            sourceSet(sourceSets.main)
        }
    }
}

// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }

// Sets up a dependency configuration called 'localRuntime'.
// This configuration should be used instead of 'runtimeOnly' to declare
// a dependency that will be present for runtime testing but that is
// "optional", meaning it will not be pulled by dependents of this mod.
configurations {
    runtimeClasspath.extendsFrom localRuntime
}

dependencies {
    // Example optional mod dependency with JEI
    // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
    // compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}"
    // compileOnly "mezz.jei:jei-${mc_version}-neoforge-api:${jei_version}"
    // We add the full version to localRuntime, not runtimeOnly, so that we do not publish a dependency on it
    // localRuntime "mezz.jei:jei-${mc_version}-neoforge:${jei_version}"

    // Example mod dependency using a mod jar from ./libs with a flat dir repository
    // This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
    // The group id is ignored when searching -- in this case, it is "blank"
    // implementation "blank:coolmod-${mc_version}:${coolmod_version}"

    // Example mod dependency using a file as dependency
    // implementation files("libs/coolmod-${mc_version}-${coolmod_version}.jar")

    // Example project dependency using a sister or child project:
    // implementation project(":myproject")

    // For more info:
    // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
    // http://www.gradle.org/docs/current/userguide/dependency_management.html
}

// This block of code expands all declared replace properties in the specified resource targets.
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
    var replaceProperties = [
            minecraft_version      : minecraft_version,
            minecraft_version_range: minecraft_version_range,
            neo_version            : neo_version,
            neo_version_range      : neo_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
    expand replaceProperties
    from "src/main/resources/META-INF"
    into "build/generated/sources/modMetadata"
}
// Include the output of "generateModMetadata" as an input directory for the build
// this works with both building through Gradle and the IDE.
sourceSets.main.resources.srcDir generateModMetadata
// To avoid having to run "generateModMetadata" manually, make it run on every project reload
neoForge.ideSyncTask generateModMetadata

// Example configuration to allow publishing using the maven-publish plugin
publishing {
    publications {
        register('mavenJava', MavenPublication) {
            from components.java
        }
    }
    repositories {
        maven {
            url "file://${project.projectDir}/repo"
        }
    }
}

tasks.withType(JavaCompile).configureEach {
    options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}

// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
idea {
    module {
        downloadSources = true
        downloadJavadoc = true
    }
}

Тот самый ${variable} кажись.
Это же просто доступ к внутреннему классу. Он тут вообще не причём.
 
UPD: Он всё подряд пытается из META-INF скопировать наверно
Надо поменять остальных файлов или указать from более точный путь.
Обновил сообщение выше.

Проще будет перенести enumextensions и других в отдельную папку или просто в resources

Это же просто доступ к внутреннему классу. Он тут вообще не причём.
> Missing property (GrassColorModifier) for Groovy template expansion
Он их по $ обнаруживает.
 
Последнее редактирование:
Надо поменять путь остальных файлов или указать для from точный путь к mods.toml.
Окей, прописал так: from "src/main/resources/META-INF/neoforge.mods.toml"
Задумался, и выдал следующее:

Код:
18:33:31: Executing ':net.neoforged.devlaunch.Main.main()'...

Calculating task graph as configuration cache cannot be reused because file 'build.gradle' has changed.
> Task :createArtifactManifest UP-TO-DATE
> Task :createMinecraftArtifacts UP-TO-DATE
> Task :generateModMetadata

> Task :compileJava FAILED
Error: Could not find or load main class worker.org.gradle.process.internal.worker.GradleWorkerMain
Caused by: java.lang.ClassNotFoundException: worker.org.gradle.process.internal.worker.GradleWorkerMain

> Task :processResources
5 actionable tasks: 3 executed, 2 up-to-date
Configuration cache entry stored.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Failed to run Gradle Worker Daemon
   > Process 'Gradle Worker Daemon 7' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 24s
18:33:56: Execution finished ':net.neoforged.devlaunch.Main.main()'.
 
Хм... А кто такое этот worker.org.gradle.process.internal.worker.GradleWorkerMain?

Код:
19:04:41: Executing ':net.neoforged.devlaunch.Main.main()'...

Calculating task graph as configuration cache cannot be reused because file 'build.gradle' has changed.
> Task :createArtifactManifest UP-TO-DATE
> Task :generateModMetadata

> Task :createMinecraftArtifacts
Loaded 138 artifacts from D:\Mods\MistyWorld\1.21.3_neo\build\moddev\nfrt_artifact_manifest.properties
*** Started working on downloadJson
 ✓ Completed downloadJson in 0.03s
*** Started working on downloadServer
*** Started working on downloadClientMappings
*** Started working on downloadClient
*** Started working on listLibraries
 ♻ Used cache of listLibraries in 0.00s
 ✓ Completed downloadServer in 0.04s
 ✓ Completed downloadClientMappings in 0.04s
 ✓ Completed downloadClient in 0.04s
*** Started working on mergeMappings
 ♻ Used cache of mergeMappings in 0.00s
*** Started working on stripClient
 ♻ Used cache of stripClient in 0.00s
*** Started working on extractServer
 ♻ Used cache of extractServer in 0.00s
*** Started working on stripServer
 ♻ Used cache of stripServer in 0.00s
*** Started working on merge
 ♻ Used cache of merge in 0.00s
*** Started working on rename
 ♻ Used cache of rename in 0.00s
*** Started working on decompile
 ♻ Used cache of decompile in 0.00s
*** Started working on inject
 ♻ Used cache of inject in 0.00s
*** Started working on patch
 ♻ Used cache of patch in 0.00s
*** Started working on applyNeoforgePatches
 ♻ Used cache of applyNeoforgePatches in 0.00s
*** Started working on transformSources
 ♻ Used cache of transformSources in 0.00s
*** Started working on recompile
 ♻ Used cache of recompile in 0.00s
*** Started working on sourcesWithNeoForge
 ♻ Used cache of sourcesWithNeoForge in 0.00s
*** Started working on compiledWithNeoForge
 ♻ Used cache of compiledWithNeoForge in 0.00s
*** Started working on sourcesAndCompiledWithNeoForge
 ♻ Used cache of sourcesAndCompiledWithNeoForge in 0.00s
Total runtime: 1.07s


> Task :compileJava FAILED
Error: Could not find or load main class worker.org.gradle.process.internal.worker.GradleWorkerMain
Caused by: java.lang.ClassNotFoundException: worker.org.gradle.process.internal.worker.GradleWorkerMain

> Task :processResources
5 actionable tasks: 4 executed, 1 up-to-date
Configuration cache entry stored.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Failed to run Gradle Worker Daemon
   > Process 'Gradle Worker Daemon 8' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 13s
19:04:55: Execution finished ':net.neoforged.devlaunch.Main.main()'.
 
А кто такое этот worker.org.gradle.process.internal.worker.GradleWorkerMain?
Класс для процессов gradle.

Попробуй ещё кэш удалить.
Gradle (Groovy):
tasks.named('wrapper', Wrapper).configure {
     distributionType = Wrapper.DistributionType.BIN
}
А здесь ALL вместо BIN поставить

UPD:
Попробуй тогда enumextsions и AT в resources перенести, а путь опять поставить "src/main/resources/META-INF".
Это пробовал?
 
Последнее редактирование:
Так, попробовал запустить чистый НеоФордж с его примером проекта.
Та же ошибка.

Что-то, видимо, с компом у меня.

JDK проверь что-ли, хз уже...
Дай, плиз, наводку, чего где проверять и что должно быть?
 
Последнее редактирование:
Назад
Сверху