User Tools

Site Tools


format:modjson

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
format:modjson [2019/03/04 22:02]
asie document latest additions
format:modjson [2019/03/06 09:31] (current)
asie new initializer definition
Line 15: Line 15:
  
 ==== Types ==== ==== Types ====
- 
-=== ClassEntry === 
- 
-A string of one of the following formats: 
- 
-  * ''​%%package.subpackage.class%%'',​ 
-  * ''​%%adapter:​package.subpackage.class%%''​. 
- 
-Using a namespaced string with an "​adapter"​ namespace makes it use a specific language adapter for locating that class. 
  
 === ContactInformation === === ContactInformation ===
Line 39: Line 30:
 There are no mandatory keys. There are no mandatory keys.
  
-The list is not exhaustive - mods may provide additional, non-standard keys (such as **discord**,​ **slack**, **twitter**) - if possible, they should be valid URLs. +The list is not exhaustive - mods may provide additional, non-standard keys (such as **discord**,​ **slack**, **twitter**) - if possible, they should be valid URLs
 + 
 +=== InitializerEntry === 
 + 
 +Fundamentally,​ an initializer entry is an object with the following keys, of which "​method"​ is the only mandatory one: 
 + 
 +  * "​type":​ The type of the initializer - a string. Fabric defines "​main"​ as the default, as well as "​client"​ and "​server"​ for client-side and dedicated-server-side initializers. 
 +  * "​adapter":​ The language adapter type - a string. If not provided, the default Java language adapter is used. 
 +  * "​method":​ A handle to a static method of the form "​mypackage.subpackage.MyClass::​myMethod"​. There must be only one method with a given name; the method must return void, but can take any number of arguments - however, it cannot take varargs. 
 + 
 +(Non-format-specific note: In general, the method strings are sorted according to the types (with order preserved within a type - Fabric will run all "​main"​ initializers,​ and all "​client"​ or "​server"​ initializers after that; mods can run their initializers at an arbitrary time) passed to the language adapter, which then calls the method. Initializers are not re-entrant, and the default loader implementation enforces this.) 
 + 
 +Alternatively,​ it can be represented as a string of one of the following formats: 
 + 
 +  * ''​%%method%%''​ 
 +  * ''​%%adapter/​method%%''​ 
 +  * ''​%%type:​method%%''​ 
 +  * ''​%%type:​adapter/​method%%''​ 
 + 
 +where each word corresponds to the matching string above.
  
 === Person === === Person ===
Line 78: Line 88:
     * "​client"​ - the game client,     * "​client"​ - the game client,
     * "​server"​ - the game dedicated server (integrated servers are not included here).     * "​server"​ - the game dedicated server (integrated servers are not included here).
-  * **initializers**:​ Contains an array of "​initializer"​ classes - an array of ClassEntry ​elements. If not present, assume empty array.+  * **initializers**:​ Contains an array of InitializerEntry ​elements. If not present, assume empty array.
   * **jars**: Contains an array of either strings or objects with a string-valued "​file"​ key; these point to paths from the root of the mod to nested JARs which should be loaded alongside the outer mod JAR.   * **jars**: Contains an array of either strings or objects with a string-valued "​file"​ key; these point to paths from the root of the mod to nested JARs which should be loaded alongside the outer mod JAR.
   * **languageAdapters**:​ A string->​string dictionary, connecting namespaces to LanguageAdapter implementations.   * **languageAdapters**:​ A string->​string dictionary, connecting namespaces to LanguageAdapter implementations.
format/modjson.txt · Last modified: 2019/03/06 09:31 by asie