Skip to content

Commit 2f7ef8c

Browse files
committed
Document plugin API
1 parent 0cacbbb commit 2f7ef8c

23 files changed

Lines changed: 442 additions & 142 deletions

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@ dependencies {
120120
}
121121
```
122122

123+
### Transformer Plugins
124+
125+
Developers can create addons that register their own jar transformers and Mixin method patches in addition to those
126+
provided by Connector.
127+
128+
See the [Plugins](https://moddedmc.wiki/en/project/connector/latest/docs/plugins) documentation page for a guide. Code
129+
documentation is available in the `org.sinytra.connector.transformer.api` package.
130+
123131
## ⚙️ Configuration
124132

125133
All information regarding Connector's configuration options can be found on

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ dependencies {
117117
implementation("org.sinytra.adapter:core:$versionAdapterCore") { isTransitive = false }
118118
implementation("net.fabricmc:class-tweaker:$versionClassTweaker") { isTransitive = false }
119119
implementation("org.sinytra:AutoRenamingTool:$versionAutoRenamingTool") { isTransitive = false }
120+
api(project(":transformer"))
120121
implementation(project(":transformer")) { isTransitive = false }
121122

122123
jarJar(implementation(group = "org.sinytra.adapter", name = "runtime", version = versionAdapterRuntime))
-53.7 KB
Binary file not shown.
File renamed without changes.
377 KB
Loading

docs/developers.mdx

Lines changed: 0 additions & 101 deletions
This file was deleted.

docs/_meta.json renamed to docs/docs/_meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"introduction.mdx": "Introduction",
33
"configuration.mdx": "Configuration",
44
"developers.mdx": "Developers",
5+
"plugins.mdx": "Plugins",
56
"faq.mdx": "Frequently Asked Questions"
67
}
File renamed without changes.

docs/docs/developers.mdx

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
title: Developers
3+
hide_meta: true
4+
---
5+
6+
Connector provides various APIs and configuration options for developers to make it easier to bring their mod onto
7+
the platform.
8+
9+
## Detecting Connector's presence
10+
11+
You can use the APIs provided by Fabric's `FabricLoader` and FML's `ModList` to detect Connector's presence in your
12+
mods.
13+
14+
- Connector's FML modid is `connector`.
15+
16+
- The Forgified Fabric API uses `fabric_api` as its main mod id.
17+
All of its modules follow upstream mod id's where dashes (`-`) are replaced by underscores (`_`) to comply with FML's
18+
requirements.<br/> (e.g. `fabric-transfer-api-v1` -> `fabric_transfer_api_v1`)
19+
20+
## Consider Launchpad
21+
22+
If you're a mod developer looking to make your Fabric mod run on NeoForge through Connector, we recommend using
23+
[Launchpad](https://github.com/Sinytra/Launchpad) instead.
24+
25+
Unlike Connector, Launchpad requires explicit opt-in and doesn't make any changes to the mod,
26+
keeping the developer fully in control. It offers the same features in a lighter and predictable package.
27+
28+
## Placeholder mods
29+
30+
### Motivation
31+
32+
As a developer, you may be interested in officially supporting your mod on Forge via Connector. One possibility is
33+
publishing a "Forge" labelled release to platforms such as CurseForge and Modrinth. Under the hood, this is still a
34+
Fabric mod jar, except it has an additional dependency added on Connector.
35+
36+
While this is a clever way to trick the modpack manager into running Fabric mods on Forge, it doesn't offer any way of
37+
informing the user about the Connector dependency in case it is downloaded manually. The mod file is still a Fabric jar
38+
that gets ignored by FML, leaving users potentially confused about why the "Forge" mod they installed is not loading.
39+
40+
Including a dummy FML mod metadata file might help resolve this issue, but at the same time, it would lead Connector to
41+
ignore the mod completely, as it does with all FML mod jars.
42+
43+
### Integration
44+
45+
To overcome this issue, Connector offers a placeholder mod feature that allows developers to safely depend on Connector
46+
and notify users of missing dependencies without causing issues with duplicate mod IDs. To enable this feature, include
47+
a standard FML metadata file in your Forge release modmfile with the following lines:
48+
49+
```toml copy title="neoforge.mods.toml"
50+
[properties]
51+
"connector:placeholder"=true
52+
```
53+
54+
This will let Connector know the mod's FML metadata only acts as a placeholder, and it won't consider the file a FML
55+
mod, proceeding to load it as a Fabric mod instead. You can now safely declare a dependency on Connector without having
56+
to worry about it being ignored. FML will promptly alert the user in case Connector is missing.
57+
58+
```toml copy title="neoforge.mods.toml"
59+
[[dependencies.examplemod]]
60+
modId="connector"
61+
type="required"
62+
versionRange="*"
63+
ordering="NONE"
64+
side="BOTH"
65+
```
66+
67+
<p/>
68+
69+
<details>
70+
<summary>Show full example</summary>
71+
72+
```toml {5-6,29-34} title="neoforge.mods.toml"
73+
modLoader="javafml"
74+
loaderVersion="*"
75+
license="CC0-1.0"
76+
77+
[properties]
78+
"connector:placeholder"=true
79+
80+
[[mods]]
81+
modId="examplemod"
82+
version="1.0.0"
83+
displayName="Example Mod"
84+
authors="example"
85+
description='''Example Mod'''
86+
87+
[[dependencies.examplemod]]
88+
modId="neoforge"
89+
type="required"
90+
versionRange="[26.1,)"
91+
ordering="NONE"
92+
side="BOTH"
93+
94+
[[dependencies.examplemod]]
95+
modId="minecraft"
96+
type="required"
97+
versionRange="[26.1,)"
98+
ordering="NONE"
99+
side="BOTH"
100+
101+
[[dependencies.examplemod]]
102+
modId="connector"
103+
type="required"
104+
versionRange="*"
105+
ordering="NONE"
106+
side="BOTH"
107+
```
108+
</details>
109+
110+
Here's how the resulting FML dependency error looks like:
111+
112+
<Asset width="966" title="FML Dependency Error" location="connector:placeholder_deps" />

docs/faq.mdx renamed to docs/docs/faq.mdx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ to reflect the current state of the mod. If your question is not listed, we'll b
1010
## ❌️ Backports
1111

1212
Backports to Minecraft versions older than 1.20.1 are **not planned**. Our focus is on future versions where
13-
compatibility will improve over time as major blockers are patched upstream, such as [Mixin](https://github.com/Sinytra/Connector/discussions/383) or transformable mc
14-
libraries.
13+
compatibility will improve over time as major blockers are patched upstream, such as
14+
[Mixin](https://github.com/Sinytra/Connector/discussions/383) or transformable mc libraries.
1515

1616
## ❌️ Is OptiFine compatible?
1717

@@ -26,15 +26,15 @@ Instead, we recommend using some of the available alternatives:
2626

2727
This largely depends on how the mod's codebase and API are structured.
2828

29-
#### Multiloader mods
29+
### Multiloader mods
3030

3131
Some mods use a multiloader setup in which most code is shared between platforms, including the public API.
3232
In these cases, the chances of proper cross-platform behavior are higher.
3333

3434
A good example of this is [Cloth Config](https://github.com/shedaniel/cloth-config), which only contains a platform-specific classes, none of
3535
which are considered public API.
3636

37-
#### Standalone ports
37+
### Standalone ports
3838

3939
Other mods may consist of completely independent codebases for each modloader. This may be the case if you're playing
4040
an unofficial port of the mod (such as [Farmer's Delight Fabric](https://www.curseforge.com/minecraft/mc-mods/farmers-delight-fabric)) or the author intended so themselves.
@@ -77,21 +77,23 @@ regardless of the mod, increasing the chances of getting other mods working in t
7777

7878
#### 🛠️ Modpack / general issues and crashes
7979

80-
If you're having trouble running Connector, feel free to join our community on [Discord](https://discord.sinytra.org), where we'll be happy to
81-
help you out in the [#support](https://discord.com/channels/1141048834177388746/1141062824265793650) channel. When opening a thread, please make sure
82-
to provide a description of your issue and include the necessary game logs.
80+
If you're having trouble running Connector, feel free to join our community on [Discord](https://discord.sinytra.org),
81+
where we'll be happy to help you out in the
82+
[#support](https://discord.com/channels/1141048834177388746/1141062824265793650) channel. When opening a thread, please
83+
make sure to provide a description of your issue and include the necessary game logs.
8384

8485
#### 🐞 Confirmed bugs / Forge mod interference
8586

86-
Connector bugs should be submitted on our [issue tracker](https://github.com/Sinytra/Connector/issues). Each issue is reviewed and processed equally,
87-
so even if we can't get to you immediately, please bear with us.
87+
Connector bugs should be submitted on our [issue tracker](https://github.com/Sinytra/Connector/issues). Each issue is
88+
reviewed and processed equally, so even if we can't get to you immediately, please bear with us.
8889

8990
Here's a few tips to follow when reporting issues:
9091

9192
1. Make sure you are using latest available version. Look for existing issues that might've already been
9293
answered / fixed. Think about whether the issue is caused by Connector itself and not another mod you've installed.
9394
To test this, try reproducing the same issue on Fabric.
94-
2. Navigate to [the issues tab](https://github.com/Sinytra/Connector/issues) and open a [new issue](https://github.com/Sinytra/Connector/issues/new/choose).
95+
2. Navigate to [the issues tab](https://github.com/Sinytra/Connector/issues) and open a
96+
[new issue](https://github.com/Sinytra/Connector/issues/new/choose).
9597
Select one of the available templates depending on the topic. Read the template carefully and thoroughly.
9698
Fill in the required fields. In order to increase our chances of identifying and reproducing the issue, please make sure
9799
to include as many details as possible.

0 commit comments

Comments
 (0)