Mod開発解説 > Forge1.18.2 > Mod情報の設定

最終更新:2024年12月08日 (日) 13時03分51秒、 - view

目次

+ ...


ゲーム内のMod一覧を開いたときに表示されるMod情報など、Modのメタデータを設定します。

mods.tomlの編集

MODのメタデータを定義するファイルです。
プロジェクトを開いて、src>main>resources>META-INF内にあります。

以下、ExampleModのmods.tomlです。
# This is an example mods.toml file. It contains the data relating to the loading mods.
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
# The overall format is standard TOML format, v0.5.0.
# Note that there are a couple of TOML lists in this file.
# Find more information on toml format here:  https://github.com/toml-lang/toml
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[40,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
license="All rights reserved"
# A URL to refer people to when problems occur with this mod
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
modId="examplemod" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata
# see the associated build.gradle script for how to populate this completely automatically during a build
version="${file.jarVersion}" #mandatory
 # A display name for the mod
displayName="Example Mod" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
# A file name (in the root of the mod JAR) containing a logo for display
logoFile="examplemod.png" #optional
# A text field displayed in the mod UI
credits="Thanks for this example mod goes to Java" #optional
# A text field displayed in the mod UI
authors="Love, Cheese and small house plants" #optional
# The description text for the mod (multi line!) (#mandatory)
description='''
This is a long form description of the mod. You can write whatever you want here

Have some lorem ipsum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed sagittis luctus odio eu tempus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque volutpat ligula eget lacus auctor sagittis. In hac habitasse platea dictumst. Nunc gravida elit vitae sem vehicula efficitur. Donec mattis ipsum et arcu lobortis, eleifend sagittis sem rutrum. Cras pharetra quam eget posuere fermentum. Sed id tincidunt justo. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
'''
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.examplemod]] #optional
    # the modid of the dependency
    modId="forge" #mandatory
    # Does this dependency have to exist - if not, ordering below must be specified
    mandatory=true #mandatory
    # The version range of the dependency
    versionRange="[40,)" #mandatory
    # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
    ordering="NONE"
    # Side this dependency is applied on - BOTH, CLIENT or SERVER
    side="BOTH"
# Here's another dependency
[[dependencies.examplemod]]
    modId="minecraft"
    mandatory=true
# This version range declares a minimum of the current minecraft version up to but not including the next major version
    versionRange="[1.18.2,1.19)"
    ordering="NONE"
    side="BOTH"

各プロパティの解説

名前 説明 デフォルトの値
modLoader string 使用するMODローダー。通常は"javafml"のままでよい。 必須
loaderVersion string MODローダーのバージョン。通常はforgeのバージョンとなる。
Maven Version Range Specificationが適用される。
必須
license string MODのライセンス。
issueTrackerURL string MODで問題が発生した際に参照されるURL。
showAsResourcePack boolean MODのリソースパックを個別に表示する。

[[mods]]ヘッダー内のプロパティ (必須)

  • [[mods]]ヘッダーの中に、mod情報を記述します。これは複数書くことができます。

名前 説明 デフォルトの値
modId string MODのID。 必須
version string MODのバージョン。 必須
displayName string MODの表示名。 必須
updateJSONURL string MODのアップデートをチェックするJSONファイルのURL。
displayURL string MODのホームページ。
logoFile string MOD説明に表示されるロゴのファイル。
画像はresourcesフォルダ直下に配置する。
credits string MODのクレジット
authors string MODの作者
description string MODの説明。「'''」で囲うと複数行書くことができる。 必須

[[mods]]ヘッダーを複数書く
このように[[mods]]ヘッダーを複数書くと複数のMOD情報を定義できます。

[[mods]]
modId = "examplemod1"

[[mods]]
modId = "examplemod2"

[[dependencies]]ヘッダー内のプロパティ (任意)

[[dependencies.<MODのID>]]で、MODごとに依存関係を設定します。
  • 複数記述することができます。
名前 説明 デフォルトの値
modId string 依存関係のMODのID。 必須
mandatory boolean この依存関係が必須かどうか。 必須
versionRange string MODのバージョン。
Maven Version Range Specificationが適用される。
必須
ordering string 依存関係のMODの前・後にメインのMODを読み込む。
"NONE" "BEFORE" "AFTER"が指定できる。
"NONE"
side string この依存関係がクライアント・サーバーのどちらに適用されるか。
"BOTH" "CLIENT" "SERVER"が指定できる。
"BOTH"

pack.mcmetaの編集

リソースパック一覧に表示されるMODリソースパックの情報を定義します。基本的には普通のMinecraftのpack.mcmetaと同じです。

{
    "pack": {
        "description": "examplemod resources",
        "pack_format": 9,
        "forge:resource_pack_format": 8,
        "forge:data_pack_format": 9
    }
}

変更できるのはdescriptionのみ。
名前 説明
description string リソースパックの説明
pack_format int パックフォーマット。変更できない。
forge:resource_pack_format int リソースパックのフォーマット。8で固定。
forge:data_pack_format int データパックのフォーマット。9で固定。

参考文献

最終更新:2024年12月08日 13:03