Changes

complete the conversion
Line 42: Line 42:     
The <code>mods.toml</code> file is formatted in [https://toml.io/en/ Tom's Obvious Minimal Language], or TOML for short. The example <code>mods.toml</code> file in the MDK provides comments explaining the contents of the file. It should be stored under the <code>META-INF</code> folder in your resources directory (<code>src/main/resources/META-INF/mods.toml</code>).
 
The <code>mods.toml</code> file is formatted in [https://toml.io/en/ Tom's Obvious Minimal Language], or TOML for short. The example <code>mods.toml</code> file in the MDK provides comments explaining the contents of the file. It should be stored under the <code>META-INF</code> folder in your resources directory (<code>src/main/resources/META-INF/mods.toml</code>).
 +
 +
<br>
    
<div class="mw-collapsible mw-collapsed" style="border: solid 2px; padding: 2px 5px; margin-top: 3px">
 
<div class="mw-collapsible mw-collapsed" style="border: solid 2px; padding: 2px 5px; margin-top: 3px">
Line 88: Line 90:  
The <code>mods.toml</code> is split into three parts: the non-mod-specific properties, which are linked to the mod file; the mod properties, with a section for each mod; and dependency configurations, with a section for each mod's dependencies.
 
The <code>mods.toml</code> is split into three parts: the non-mod-specific properties, which are linked to the mod file; the mod properties, with a section for each mod; and dependency configurations, with a section for each mod's dependencies.
    +
=== Structure ===
    
{{Tree list}}
 
{{Tree list}}
* Root of the file
+
* ''root of the file''
 
** <code>modLoader</code>: '''(mandatory)''' The language loader for the mod. Used to specify an alternative language for the mod, such as Kotlin, if one exists. ''The Forge-provided Java loader is <code>javafml</code>.''
 
** <code>modLoader</code>: '''(mandatory)''' The language loader for the mod. Used to specify an alternative language for the mod, such as Kotlin, if one exists. ''The Forge-provided Java loader is <code>javafml</code>.''
 
** <code>loaderVersion</code>: '''(mandatory)''' The acceptable version range of the language loader, expressed as a [https://maven.apache.org/enforcer/enforcer-rules/versionRanges.html Maven version spec]. ''For the Forge-provided Java loader, the version is the major version of the Forge version.''
 
** <code>loaderVersion</code>: '''(mandatory)''' The acceptable version range of the language loader, expressed as a [https://maven.apache.org/enforcer/enforcer-rules/versionRanges.html Maven version spec]. ''For the Forge-provided Java loader, the version is the major version of the Forge version.''
Line 99: Line 102:  
** <code><nowiki>[[mods]]</nowiki></code>: An entry defining a new mod.
 
** <code><nowiki>[[mods]]</nowiki></code>: An entry defining a new mod.
 
*** <code>modId</code>: '''(mandatory)''' The mod's identifier (modid). This must match the following regex: <code><nowiki>^[a-z][a-z0-9_-]{1,63}$</nowiki></code> (starts with a lowercase letter; other characters must be a lowercase letter, number, underscore or hyphen; must be 2-64 characters long).  
 
*** <code>modId</code>: '''(mandatory)''' The mod's identifier (modid). This must match the following regex: <code><nowiki>^[a-z][a-z0-9_-]{1,63}$</nowiki></code> (starts with a lowercase letter; other characters must be a lowercase letter, number, underscore or hyphen; must be 2-64 characters long).  
*** <code>namespace</code>: (default: value of <code>modId</code>) : An overriding namespace for the resource pack. <span class="note_info"> Currently, there is no use for this property </span>  
+
*** <code>namespace</code>: (default: value of <code>modId</code>) : An overriding namespace for the resource pack. <span class="note_info"> Currently, there is no use for this property. </span>  
 +
*** <code>version</code>: (default: <code>"1"</code>) The version of the mod jar, used when the mod is a dependency of another mod, expressed as numbers which may be seperated by dots (<code>.</code>), ideally conforming to [[Semantic_Versioning|Semantic Versioning]]. ''(The default value in the MDK for this is <code>${file.jarVersion}</code>, which is replaced at runtime with the <code>Implementation-Version</code> found in the jar's manifest file.)''
 +
*** <code>displayName</code>: (default: value of <code>modId</code>) The display name of the mod, for use in the Mods listing screen
 +
*** <code>description</code>: (default: <code>"MISSING DESCRIPTION"</code>) The description of the mod, for use in the Mods listing screen. It's recommended to use a multiline string (surrounded by <code>'''</code>)
 +
*** <code>logoFile</code>: (default: nothing) The path of the logo file image, for use in the Mods listing screen. The image must be in the root of the jar file, not in any subfolder thereof (e.g. the file is directly in <tt>src/main/resources</tt>)
 +
*** <code>logoBlur</code>: (default: <code>true</code>) Whether to do some blurring on the mod's logo in the Mods listing screen. Has no effect if <code>logoFile</code> is not set.
 +
*** <code>updateJSONURL</code>: (default: nothing) The update JSON URL, used by the [Update_Checker update checker]. <span class="note_alert"> This should never be a blank string, as that will cause an error. </span>
 +
*** <code>modproperties</code>: (default: <code>{}</code>) A table of custom mod properties; this is not used for Forge, but is mainly for use by mods.
 +
*** <code>credits</code>: (default: nothing) Credits and acknowledgements for the mod, for use in the Mods listing screen.
 +
*** <code>authors</code> (default: nothing) Authors for the mod, for use in the Mods listing screen.
 +
*** <code>displayURL</code>: (default: nothing) A URL, displayed on the Mods listing screen.
 +
** <code><nowiki>[[</nowiki>dependencies.''<modid>''<nowiki>]]</nowiki></code>: A dependency entry for the mod with the given ''<modid>''.
 +
*** <code>modId</code>: '''(mandatory)''' The mod id of the dependency.
 +
*** <code>mandatory</code>: '''(mandatory)''' Whether to stop the game from loading if this dependency is not present and met (the version does not match the specified version).
 +
*** <code>versionRange</code>: (default: <code>""</code>) The acceptable version range of the dependency, expressed as a [https://maven.apache.org/enforcer/enforcer-rules/versionRanges.html Maven version spec]. An empty string is an unbounded version range, which matches any version.
 +
*** <code>ordering</code>: (default: <code>"NONE"</code>) Defines if the mod must load before or after this dependency. The valid values are <code>BEFORE</code> (this mod must load before), <code>AFTER</code> (this mod must load after), and <code>NONE</code> (does not care).
 +
*** <code>side</code>: (default: <code>"BOTH"</code>) Defines if this dependency needs only to be met on a specfic [[Sides|physical side]]. The valid values are <code>CLIENT</code> (present on the client), <code>SERVER</code> (present on the dedicated server), and <code>BOTH</code> (present on both sides).
 
{{Tree list/end}}
 
{{Tree list/end}}
  −
=== Mod Properties ===
  −
  −
A mod entry is defined by a new section starting with a <code><nowiki>[[mods]]</nowiki></code> header (In TOML, the <code><nowiki>[[mods]]</nowiki></code> defines an [https://toml.io/en/v1.0.0-rc.2#array-of-tables array of tables]). All properties from that line until the next header will become the properties for that mod.
  −
  −
{| class="wikitable"
  −
! Property !! Type !! Defaults
  −
! Description
  −
! Example
  −
|-
  −
| <code>version</code> || string || <code>"1"</code>
  −
| The version of the mod jar, used when the mod is a dependency of another mod, expressed as numbers seperated by dots (<code>.</code>), ideally conforming to [[Semantic_Versioning|Semantic Versioning]]. The default value in the MDK for this is <code>${file.jarVersion}</code>, which is replaced at runtime with the <code>Implementation-Version</code> found in the jar's manifest file.
  −
| <code>"0.2.4-beta1"</code>
  −
|-
  −
| <code>displayName</code> || string || value of <code>modId</code>
  −
| The display name of the mod, for use in the Mods listing screen
  −
| <code>"Example Mod"</code>
  −
|-
  −
| <code>description</code> || string || <code>"MISSING DESCRIPTION"</code>
  −
| The description of the mod, for use in the Mods listing screen. It's recommended to use a multiline string (surrounded by <code>'''<code>)
  −
| <code>"Adds things and stuff. "</code>
  −
|-
  −
| <code>logoFile</code> || string || ''nothing''
  −
| The path of the logo file image, for use in the Mods listing screen. The image must be in the root of the jar file, not in any subfolder thereof (e.g. the file is directly in <code>src/main/resources</code>)
  −
| <code>"myAwesomeLogo.png"</code>
  −
|-
  −
| <code>logoBlur</code> || boolean || <code>true</code>
  −
| Whether to do some blurring on the mod's logo in the Mods listing screen. Has no effect if <code>logoFile</code> is not set.
  −
| <code>false</code>
  −
|-
  −
| <code>updateJSONURL</code> || string || ''nothing''
  −
| The update JSON URL, used by the [Update_Checker update checker]. <inline alert> This should never be a blank string, as that will cause an error. </inline>
  −
| <code>http://myurl.me/path/to/update.json</code>
  −
|-
  −
| <code>modproperties</code> || table || <code>{}</code>
  −
| A table of custom mod properties; this is not used for Forge, but is mainly for use by mods.
  −
| <code>{ "useThing" = true }</code>
  −
|-
  −
| <code>credits</code> || string || ''nothing''
  −
| Credits and acknowledgements for the mod, for use in the Mods listing screen. Can be any string.
  −
| <code>"This person and that guy"</code>
  −
|-
  −
| <code>authors</code> || string || ''nothing''
  −
| Authors for the mod, for use in the Mods listing screen. Can be any string.
  −
| <code>"ExampleDude"</code>
  −
|-
  −
| <code>displayURL</code> || string || ''nothing''
  −
| A URL, displayed on the Mods listing screen. Can be any string.
  −
| <code>http://example.com/</code>
  −
|}
  −
  −
=== Dependency Configurations ===
  −
  −
Mods can define dependencies for their mods, which are checked by Forge before loading mods. This is used for e.g. ensuring your mod loads after another, or hard-crashing if a mod with a specified version does not exist.
  −
  −
These dependency configurations, like the mod properties, are defined by a new section starting with <code>[[dependencies.<modid>]]</code>, with <code><modid></code> being the mod id that has this dependency. All properties from that line until the next header will become the properties of that dependency configuration.
  −
  −
{| class="wikitable"
  −
! Property !! Type !! Defaults
  −
! Description
  −
! Example
  −
|-
  −
| <code>modId</code> || string || '''mandatory'''
  −
| The mod id of the dependency.
  −
| <code>examplelibrary</code>
  −
|-
  −
| <code>mandatory</code> || boolean || '''mandatory'''
  −
| Whether to crash if this dependency is not met.
  −
| <code>true</code>
  −
|-
  −
| <code>versionRange</code> || string || <code>""</code>
  −
| The acceptable version range of the dependency, expressed as a [https://maven.apache.org/enforcer/enforcer-rules/versionRanges.html Maven version spec]. An empty string is an unbounded version range, which matches any version.
  −
| <code>"[1.0,2.0)"</code>
  −
|-
  −
| <code>ordering</code> || string || <code>"NONE"</code>
  −
| Defines if the mod must load before or after this dependency. The valid values are <code>BEFORE</code> (must load before), <code>AFTER</code> (must load after), and <code>NONE</code> (does not care about order).
  −
| <code>"AFTER"</code>
  −
|-
  −
| <code>side</code> || string || <code>"BOTH"</code>
  −
| Defines if this dependency needs only to be met on a specfic [[Sides|physical side]]. The valid values are <code>CLIENT</code> (present on the client), <code>SERVER</code> (present on the dedicated server), and <code>BOTH</code> (present on both sides).
  −
| <code>"CLIENT"</code>
  −
|}
      
{{Colored box|title=Important|content=When specifying dependency ordering between two or more mods, beware of cyclic order!: ex. if mod A must load before mod B, and mod B must load before mod A, the game will crash because of the circular cycle.}}
 
{{Colored box|title=Important|content=When specifying dependency ordering between two or more mods, beware of cyclic order!: ex. if mod A must load before mod B, and mod B must load before mod A, the game will crash because of the circular cycle.}}
    
[[Category:Getting Started]]
 
[[Category:Getting Started]]
297

edits