Skip to content

Commit d41ac45

Browse files
committed
Add fabric.mod.json generator
1 parent a52dbaa commit d41ac45

File tree

3 files changed

+143
-1
lines changed

3 files changed

+143
-1
lines changed

public/mcdoc/fabric.mcdoc

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
// Sources:
2+
// - https://wiki.fabricmc.net/documentation:fabric_mod_json
3+
// - https://wiki.fabricmc.net/documentation:fabric_mod_json_spec
4+
// - https://github.com/FabricMC/fabric-loader/blob/master/src/main/java/net/fabricmc/loader/impl/metadata/V1ModMetadataParser.java
5+
dispatch minecraft:resource[fabric:fabric_mod_json] to struct FabricModJson {
6+
/// Needed for internal mechanisms. Must always be `1`.
7+
schemaVersion: 1,
8+
/// The mod's identifier of Latin letters, digits, or underscores.
9+
id: string,
10+
/// The mod's version. Optionally matching the [Semantic Versioning 2.0.0](https://semver.org/) specification.
11+
version: string @ 1..,
12+
/// User-friendly mod's name. Defaults to `id`.
13+
name?: string,
14+
/// The mod's description. Defaults to an empty string.
15+
description?: string,
16+
/// Authors of the mod.
17+
authors?: People,
18+
/// Contributors to the mod.
19+
contributors?: People,
20+
/// Contact information for the project
21+
contact?: ContactInfo,
22+
/// Licensing information.
23+
/// Should provide the complete set of preferred licenses conveying the entire mod package. In other words, compliance with all listed licenses should be sufficient for usage, redistribution, etc. of the mod package as a whole.
24+
/// For cases where a part of code is dual-licensed, choose the preferred license. The list is not exhaustive, serves primarily as a kind of hint, and does not prevent you from granting additional rights/licenses on a case-by-case basis.
25+
/// To aid automated tools, it is recommended to use [SPDX License Identifiers](https://spdx.org/licenses/) for open-source licenses.
26+
license?: License,
27+
/// The mod's icon file. Should be a square PNG image.
28+
/// Resource packs use 128×128, but that is not a hard requirement. A power of two is recommended.
29+
/// Can also be provided as a dictionary of images widths to their file paths.
30+
icon?: Icon,
31+
/// Defines the list of ids of the mod. It can be seen as the aliases of the mod.
32+
/// Fabric Loader will treat these ids as mods that exist.
33+
/// If there are other mods using that id, they will not be loaded.
34+
provides?: [string],
35+
/// Defines where the mod runs: only on the client side (client mod), only on the dedicated server side (plugin) or on both sides (regular mod).
36+
environment?: EnvironmentType,
37+
/// Main classes of the mod that will be loaded.
38+
entrypoints?: Entrypoints,
39+
/// Nested JARs inside your mod's JAR to load.
40+
jars?: [Jar],
41+
/// Adapters for used languages to their adapter classes full names.
42+
languageAdapters?: LanguageAdapters,
43+
/// List of mixin configuration files. Each entry is the path to the mixin configuration file inside your mod's JAR.
44+
mixins?: Mixins,
45+
/// Access widener configuration file.
46+
accessWidener?: string,
47+
/// Dependencies required to run. Without them a game will crash.
48+
depends?: Dependencies,
49+
/// Dependencies not required to run. Without them a game will log a warning.
50+
recommends?: Dependencies,
51+
/// Dependencies not required to run. Use this as a kind of metadata.
52+
suggests?: Dependencies,
53+
/// Mods whose together with yours might cause a game crash. With them a game will crash.
54+
breaks?: Dependencies,
55+
/// Mods whose together with yours cause some kind of bugs, etc. With them a game will log a warning.
56+
conflicts?: Dependencies,
57+
/// Custom fields. It is recommended to namespace fields to avoid conflicts.
58+
custom?: CustomValues,
59+
}
60+
61+
enum(string) EnvironmentType {
62+
Universal = "*",
63+
Client = "client",
64+
Server = "server",
65+
}
66+
67+
struct Entrypoints {
68+
[string]: (string | Entrypoint),
69+
}
70+
71+
struct Entrypoint {
72+
value: string,
73+
/// Defaults to `default`.
74+
adapter?: string,
75+
}
76+
77+
struct Jar {
78+
/// Path inside your mod's JAR to the nested JAR.
79+
file: string,
80+
}
81+
82+
type Mixins = [(string | Mixin)]
83+
84+
struct Mixin {
85+
/// The path to the mixin configuration file inside your mod's JAR.
86+
config: string,
87+
/// Defaults to universal (`*`).
88+
environment?: EnvironmentType,
89+
}
90+
91+
struct Dependencies {
92+
[string]: (string | [string]),
93+
}
94+
95+
type People = [(string | Person)]
96+
97+
struct Person {
98+
/// The real name, or username of the person.
99+
name: string,
100+
/// The person's contact information.
101+
contact?: ContactInfo,
102+
}
103+
104+
struct ContactInfo {
105+
/// Contact e-mail address.
106+
email?: #[email] string,
107+
/// IRC channel.
108+
irc?: string,
109+
/// Link to the project or user homepage.
110+
homepage?: #[url] string,
111+
/// Link to the project's issue tracker.
112+
issues?: #[url] string,
113+
/// Link to the project's source code repository
114+
sources?: string,
115+
[string]: string,
116+
}
117+
118+
type License = (string | [string])
119+
120+
type Icon = (string | IconMap)
121+
122+
struct IconMap {
123+
[#[integer(min=1)] string]: string,
124+
}
125+
126+
struct LanguageAdapters {
127+
[string]: string,
128+
}
129+
130+
struct CustomValues {
131+
[string]: any,
132+
}

src/config.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,14 @@
605605
"minVersion": "1.21.2",
606606
"wiki": "https://minecraft.wiki/w/Shader#Post-processing_effects"
607607
},
608+
{
609+
"id": "fabric:fabric_mod_json",
610+
"url": "fabric/fabric-mod-json",
611+
"noPath": true,
612+
"tags": ["partners"],
613+
"dependency": "fabric",
614+
"wiki": "https://wiki.fabricmc.net/documentation:fabric_mod_json"
615+
},
608616
{
609617
"id": "immersive_weathering:block_growth",
610618
"url": "immersive-weathering/block-growth",

src/locales/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"generator.equipment": "Equipment",
7575
"generator.error_max_version": "This generator is not available in versions above %0%",
7676
"generator.error_min_version": "The minimum version for this generator is %0%",
77+
"generator.fabric:fabric_mod_json": "fabric.mod.json",
7778
"generator.font": "Font",
7879
"generator.immersive_weathering:block_growth": "Block Growth",
7980
"generator.instrument": "Instrument",
@@ -95,7 +96,7 @@
9596
"generator.neoforge:structure_modifier": "Structure Modifier",
9697
"generator.not_found": "Cannot find generator \"%0%\"",
9798
"generator.ohthetreesyoullgrow:configured_feature": "OTTYG Feature",
98-
"generator.pack_mcmeta": "Pack.mcmeta",
99+
"generator.pack_mcmeta": "pack.mcmeta",
99100
"generator.painting_variant": "Painting Variant",
100101
"generator.post_effect": "Post Effect",
101102
"generator.predicate": "Predicate",
@@ -180,6 +181,7 @@
180181
"normalize": "Normalize",
181182
"not_found.description": "The page you were looking for does not exist.",
182183
"output_settings": "Output settings",
184+
"partner.fabric": "Fabric",
183185
"partner.immersive_weathering": "Immersive Weathering",
184186
"partner.lithostitched": "Lithostitched",
185187
"partner.neoforge": "NeoForge",

0 commit comments

Comments
 (0)