LoginSignup
0
0

More than 1 year has passed since last update.

MinecraftでMODを開発したい#4

Posted at

MinecraftでMODの開発をします
試行錯誤を書いていくだけのものになります

概要

MOD一覧などに表示される情報の登録

動作環境 2021/05/12

Version
Mac OS Big Sur 11.1
IntelliJ IDEA 2021.1.1
AdoptOpenJDK (HotSpot) 1.8.0_282
Minecraft 1.16.5
Forge 36.1.0

目次

- リソースパックの情報
- mods.toml
- ロゴ画像
- build.gradle

リソースパックの情報

src/main/resources/pack.mcmeta
{
    "pack": {
        "description": "Example Mod Resources",
        "pack_format": 6
    }
}

mods.toml

src/main/resources/META-INF/mods.toml

modLoader = "javafml"
loaderVersion = "[36,)"
license = "The Unlicense"
issueTrackerURL = "https://www.xxxxxx.com

[[mods]]
modId = "examplemod"
version = "${file.jarVersion}"
displayName = "Example Mod"
displayURL = "https://www.xxxxxxxxxx.com
logoFile = "logo.png"
credits = "xxx"
authors = "xxxxx"
description = "練習用MOD"

[[dependencies.examplemod]]
modId = "forge"
mandatory = true
versionRange = "[36,)"
ordering = "NONE"
side = "BOTH"

[[dependencies.examplemod]]
modId = "minecraft"
mandatory = true
versionRange = "[1.16.5,1.17)"
ordering = "NONE"
side = "BOTH"

MODの読み込みや一覧表示に使われる情報を記述

licenseはMODの利用条件を指定
このMODは例なので「Unlicense」という極めて緩いライセンスを採用
デフォルトはAll rights reserved(すべての権利を留保する)で、著作権法上の例外や別途の許諾を除き、複製や再配布などを禁止
Modpackでの利用や改変、再配布などをどこまで許容するか考え、自分で利用条件を決めたり、既存のライセンスを選ぶ

issueTrackerURLは不具合の報告を受け付けるURL、logoFileはロゴ画像のファイル名、creditsは謝辞をそれぞれ指定
issueTrackerURL、displayURL、logoFile、credits、authorsは無くても問題なし

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

ロゴ画像

src/main/resources/logo.png

build.gradle

元のbuild.gradleからの変更点

  • groupをcom.ドメイン名.examplemodに、archivesBaseNameをexamplemodに変更
    ビルド時に出力されるファイルの名前は(archivesBaseName)-(version).jar

  • minecraft { runs {内の4つのexamplemodをexamplemodに置換(今回は同じのため置換なし)
    JSONファイルの自動生成を行う時に必要になる設定

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

  • jar { manifest { attributes([内のSpecification-TitleとImplementation-TitleをExample Modに、Specification-VendorとImplementation-Vendorを任意のものに変更
    jarファイル内のMETA-INF/MANIFEST.MFに記載される情報

確認

スクリーンショット 2021-05-13 18.37.19.png

参考文献

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0