概要
MOD一覧などに表示される情報を登録します。
動作確認
2020年4月1日
- Minecraft 1.14.4
- Forge 28.2.0
解説
実際に自分のMODを作る際は、「TNT Modders」などを置き換えてください。
リソースパックの情報
TitaniumMod/src/main/resources/pack.mcmeta
{
"pack": {
"pack_format": 4,
"description": "Titanium Mod Resources"
}
}
pack_format
は1.13.x~1.14.xに対応する4
を指定します。description
にはリソースパックとしての説明を記述します。
mods.toml
TitaniumMod/src/main/resources/META-INF/mods.toml
modLoader = "javafml"
loaderVersion = "[28,)"
issueTrackerURL = "https://www.tntmodders.com/tutorial/"
[[mods]]
modId = "titaniummod"
version = "${file.jarVersion}"
displayName = "Titanium Mod"
displayURL = "https://www.tntmodders.com/tutorial/"
logoFile = "logo.png"
credits = "TNT Modders"
authors = "Akasata Nahama, Tom Kate"
description = "This mod adds titanium to Minecraft world.\n\nAn example mod to show what you need to change."
[[dependencies.titaniummod]]
modId="forge"
mandatory=true
versionRange="[28.2.0,)"
ordering="NONE"
side="BOTH"
MODの読み込みや一覧表示に使われる情報を記述します。issueTrackerURL
は不具合の報告を受け付けるURL、logoFile
はロゴ画像のファイル名、credits
は謝辞をそれぞれ指定します。
issueTrackerURL
、displayURL
、logoFile
、credits
、authors
は無くても問題ありません。
description
などでTOMLの複数行文字列を使うと、改行コードをCRLFにして保存した時にCRが正常に表示されないため、LF(\n
)だけで改行しています。改行コードをLFにして保存すれば、複数行文字列も問題なく使えます。
ロゴ画像
TitaniumMod/src/main/resources/logo.png
表示される際に画面に合わせて自動で拡大・縮小されるため、解像度は制限されていません。
build.gradle
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
}
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
version = '1.0'
group = 'com.tntmodders.titaniummod'
archivesBaseName = 'titaniummod'
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
minecraft {
mappings channel: 'snapshot', version: '20190719-1.14.3'
runs {
client {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
mods {
titaniummod {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
mods {
titaniummod {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
args '--mod', 'titaniummod', '--all', '--output', file('src/generated/resources/')
mods {
titaniummod {
source sourceSets.main
}
}
}
}
}
dependencies {
minecraft 'net.minecraftforge:forge:1.14.4-28.2.0'
}
jar {
compileJava {
options.encoding = 'UTF-8'
}
manifest {
attributes([
"Specification-Title" : "Titanium Mod",
"Specification-Vendor" : "TNT Modders",
"Specification-Version" : "1",
"Implementation-Title" : "Titanium Mod",
"Implementation-Vendor" : "TNT Modders",
"Implementation-Version" : "${version}",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
def reobfFile = file("$buildDir/reobfJar/output.jar")
def reobfArtifact = artifacts.add('default', reobfFile) {
type 'jar'
builtBy 'reobfJar'
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact reobfArtifact
}
}
repositories {
maven {
url "file:///${project.projectDir}/mcmodsrepo"
}
}
}
以下、元のbuild.gradle
からの変更点を述べます。
group
をcom.tntmodders.titaniummod
に、archivesBaseName
をtitaniummod
に変更しました。ビルド時に出力されるファイルの名前は(archivesBaseName)-(version).jar
になります。
jar {
とmanifest {
との間に行を追加し、compileJava { options.encoding = 'UTF-8' }
を挿入しました。コード内コメントに日本語が入っていた時の文字化けを防ぐため、文字コードを指定しています。
jar { manifest { attributes([
内のSpecification-Title
とImplementation-Title
をTitanium Mod
に、Specification-Vendor
とImplementation-Vendor
をTNT Modders
に変更しました。jarファイル内のMETA-INF/MANIFEST.MF
に記載される情報です。