MODの情報の登録 (1.14.4)

概要

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は謝辞をそれぞれ指定します。

issueTrackerURLdisplayURLlogoFilecreditsauthorsは無くても問題ありません。

descriptionなどでTOMLの複数行文字列を使うと、改行コードをCRLFにして保存した時にCRが正常に表示されないため、LF(\n)だけで改行しています。改行コードをLFにして保存すれば、複数行文字列も問題なく使えます。

ロゴ画像

TitaniumMod/src/main/resources/logo.png

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からの変更点を述べます。

groupcom.tntmodders.titaniummodに、archivesBaseNametitaniummodに変更しました。ビルド時に出力されるファイルの名前は(archivesBaseName)-(version).jarになります。

jar {manifest {との間に行を追加し、compileJava { options.encoding = 'UTF-8' }を挿入しました。コード内コメントに日本語が入っていた時の文字化けを防ぐため、文字コードを指定しています。

jar { manifest { attributes([内のSpecification-TitleImplementation-TitleTitanium Modに、Specification-VendorImplementation-VendorTNT Moddersに変更しました。jarファイル内のMETA-INF/MANIFEST.MFに記載される情報です。

リンク


前:レシピの追加
次:ビルド

コメントはこちらです。(スパム対策の為コメントは手動承認になっています。未承認のコメントは表示されないので連投はお控え下さい。)

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください