Forge 1.12.2-14.23.5.2838 mcmod.info 加载不正确
Forge 1.12.2-14.23.5.2838 mcmod.info not load correctly
我已经为我的 mod 提供了 mcmod.info,但是在 运行 Minecraft Client in IntelliJ 之后,mod 确实加载了,但是它无法加载 mcmod.info 正确。 Minecraft Client 启动过程中,出现一个警告:
[Client thread/WARN] [FML]: Mod testforge is missing the required element 'version' and no fallback can be found. Substituting '1.0'.
在我进入 mod 按钮并查找 mod 信息后,我的 mod 出现在 mod 列表中,但它显示以下内容:
testforge
Version:1.0
Mod State: Available
No mod information found
Ask your mod author to provide a mod mcmod.info file
我尝试了很多方法来调试它,但都失败了。
我尝试过的:
- 我已经解压缩了构建的 jar 文件,mcmod.info 正确地放置在根文件夹中。
- 我已经将我的 mcmod.info 提交给 json 验证器,它说内容是正确的。
build.gradle
buildscript {
repositories {
jcenter()
maven { url = "https://files.minecraftforge.net/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
version = "1.0.0"
group = "com.galaxy.forge"
archivesBaseName = "Test Forge"
sourceCompatibility = targetCompatibility = '1.8'
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
minecraft {
version = "1.12.2-14.23.5.2838"
runDir = "run"
mappings = "snapshot_20171003"
}
dependencies {
}
processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version':project.version, 'mcversion':project.minecraft.version
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
src/main/resources/mcmod.info
[{
"modid": "testforge",
"name": "TestForge",
"description": "Test description",
"version": "1.0.0",
"mcversion": "1.12.2",
"url": "minecraftforge.net/",
"authorList": ["GalaxyIT"],
"credits": "I'd like to thank anyone who can help me >.<"
}]
src/main/java/com/galaxy/forge/testforge/TestForge.java
package com.galaxy.forge.testforge;
import net.minecraftforge.fml.common.Mod;
@Mod(modid = "testforge", useMetadata = true)
public class TestForge {
}
您必须mod在TestForge.java 中修改@Mod
注释。您错过了 mod 版本 但 FML 从 mcmod.info
获取并使用它。
由于这个原因,只抛出一个警告。
要修复它,您必须将参数添加到 @Mod(modid="testforge",useMetadata=true)
version="1.0.0"
结果 @Mod(modid="testforge",useMetadata=true,version="1.0.0")
我已经为我的 mod 提供了 mcmod.info,但是在 运行 Minecraft Client in IntelliJ 之后,mod 确实加载了,但是它无法加载 mcmod.info 正确。 Minecraft Client 启动过程中,出现一个警告:
[Client thread/WARN] [FML]: Mod testforge is missing the required element 'version' and no fallback can be found. Substituting '1.0'.
在我进入 mod 按钮并查找 mod 信息后,我的 mod 出现在 mod 列表中,但它显示以下内容:
testforge
Version:1.0
Mod State: Available
No mod information found
Ask your mod author to provide a mod mcmod.info file
我尝试了很多方法来调试它,但都失败了。
我尝试过的:
- 我已经解压缩了构建的 jar 文件,mcmod.info 正确地放置在根文件夹中。
- 我已经将我的 mcmod.info 提交给 json 验证器,它说内容是正确的。
build.gradle
buildscript {
repositories {
jcenter()
maven { url = "https://files.minecraftforge.net/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
version = "1.0.0"
group = "com.galaxy.forge"
archivesBaseName = "Test Forge"
sourceCompatibility = targetCompatibility = '1.8'
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
minecraft {
version = "1.12.2-14.23.5.2838"
runDir = "run"
mappings = "snapshot_20171003"
}
dependencies {
}
processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version':project.version, 'mcversion':project.minecraft.version
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
src/main/resources/mcmod.info
[{
"modid": "testforge",
"name": "TestForge",
"description": "Test description",
"version": "1.0.0",
"mcversion": "1.12.2",
"url": "minecraftforge.net/",
"authorList": ["GalaxyIT"],
"credits": "I'd like to thank anyone who can help me >.<"
}]
src/main/java/com/galaxy/forge/testforge/TestForge.java
package com.galaxy.forge.testforge;
import net.minecraftforge.fml.common.Mod;
@Mod(modid = "testforge", useMetadata = true)
public class TestForge {
}
您必须mod在TestForge.java 中修改@Mod
注释。您错过了 mod 版本 但 FML 从 mcmod.info
获取并使用它。
由于这个原因,只抛出一个警告。
要修复它,您必须将参数添加到 @Mod(modid="testforge",useMetadata=true)
version="1.0.0"
结果 @Mod(modid="testforge",useMetadata=true,version="1.0.0")