This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
api:migration:neoforge [2023/11/16 15:50] – created shedaniel | api:migration:neoforge [2024/05/11 12:37] (current) – clarify file paths in forge-like section juuz | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== NeoForge Migration ===== | + | ====== NeoForge Migration ====== |
+ | Since an Architectury Loom 1.4 update, NeoForge 1.20.2 support has been introduced into Architectury. This page serves as a tutorial on how to migrate to NeoForge, depending on your current project, and your goals. The tutorials can be applied in reverse if needed. | ||
+ | |||
+ | __We assume the migration is not easy, please feel free to step by the Discord server for assistance.__ | ||
+ | |||
+ | == Acknowledgments == | ||
+ | The bulk of the work on porting Architectury Loom is done by [[https:// | ||
+ | |||
+ | ==== About MinecraftForge ==== | ||
+ | |||
+ | To learn more about our support on MinecraftForge and NeoForge, you may read on the [[api: | ||
+ | |||
+ | ==== About Yarn ==== | ||
+ | |||
+ | Architectury Loom had always supported Yarn as a mappings option for Forge, and will continue to do so for NeoForge. NeoForge has removed srg mappings as intermediary, | ||
+ | |||
+ | Architectury Loom 1.4 adds " | ||
+ | |||
+ | - Write ATs in Mojang Mappings | ||
+ | - Don't use JS coremods | ||
+ | - Don't use reflection to access Minecraft internals (while we have a solution to remap reflection, it is not yet in Architectury Loom because we really **really** don't want to use it) | ||
+ | - MixinExtras may not function properly if you use Yarn (We have ditched refmaps for mixins, and our remapper is currently not capable of remapping MixinExtras) | ||
+ | |||
+ | ===== Migrate your Forge-only project to NeoForge ===== | ||
+ | |||
+ | **1. Update to latest Gradle & Architectury Loom 1.4** | ||
+ | |||
+ | On the top of '' | ||
+ | |||
+ | **2. Modify '' | ||
+ | |||
+ | <code properties> | ||
+ | loom.platform = neoforge | ||
+ | </ | ||
+ | |||
+ | **3. Add the NeoForge maven** | ||
+ | |||
+ | Add '' | ||
+ | |||
+ | **4. Remove the '' | ||
+ | |||
+ | The mixins declared should go directly to '' | ||
+ | |||
+ | Custom AT paths can be modified in the '' | ||
+ | |||
+ | **5. Replace the Forge dependency** | ||
+ | |||
+ | <code groovy> | ||
+ | neoForge " | ||
+ | </ | ||
+ | |||
+ | **6. Make sure your project' | ||
+ | |||
+ | You should have something similar to this, change the version to 17. | ||
+ | |||
+ | <code groovy> | ||
+ | tasks.withType(JavaCompile) { | ||
+ | // ensure that the encoding is set to UTF-8, no matter what the system default is | ||
+ | // this fixes some edge cases with special characters not displaying correctly // see [http:// | ||
+ | // If Javadoc is generated, this must be specified in that task too. | ||
+ | options.encoding = " | ||
+ | options.release = 17 | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | **7. Refresh Gradle & Run Configs, Fix Errors & META-INF/ | ||
+ | |||
+ | ===== Migrate your Architectury project to NeoForge ===== | ||
+ | |||
+ | |||
+ | NeoForge can be added as an additional subproject for any Architectury Projects. | ||
+ | |||
+ | While Forge-like setups are possible (where Forge and NeoForge projects share common code), it is **not recommended** since you will need to do manual remapping configuration, | ||
+ | |||
+ | The following section is split between three variants: | ||
+ | |||
+ | - Migrate your Forge subproject to NeoForge | ||
+ | - Add a NeoForge subproject independent of the Forge subproject | ||
+ | - Add a Forge-like subproject, and a NeoForge subproject | ||
+ | |||
+ | ==== Migrate your Forge subproject to NeoForge ==== | ||
+ | |||
+ | **1. Update to latest Gradle & Architectury Loom 1.4** | ||
+ | |||
+ | On the top of '' | ||
+ | |||
+ | **2. Modify '' | ||
+ | |||
+ | <code properties> | ||
+ | loom.platform = neoforge | ||
+ | </ | ||
+ | |||
+ | **3. Add the NeoForge maven** | ||
+ | |||
+ | Add '' | ||
+ | |||
+ | **4. Remove the '' | ||
+ | |||
+ | The mixins declared should go directly to '' | ||
+ | |||
+ | Custom AT paths can be modified in the '' | ||
+ | |||
+ | **5. Replace the Forge dependency in '' | ||
+ | |||
+ | <code groovy> | ||
+ | neoForge " | ||
+ | </ | ||
+ | |||
+ | If you are using Architectury API, make sure to change '' | ||
+ | |||
+ | **6. Make sure your project' | ||
+ | |||
+ | You should have something similar to this, change the version to 17. | ||
+ | |||
+ | <code groovy> | ||
+ | tasks.withType(JavaCompile) { | ||
+ | // ensure that the encoding is set to UTF-8, no matter what the system default is | ||
+ | // this fixes some edge cases with special characters not displaying correctly // see [http:// | ||
+ | // If Javadoc is generated, this must be specified in that task too. | ||
+ | options.encoding = " | ||
+ | options.release = 17 | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | **7. Add NeoForge as a compile target in '' | ||
+ | |||
+ | <code groovy> | ||
+ | architectury { | ||
+ | common(" | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | **8. Modify '' | ||
+ | |||
+ | First, change '' | ||
+ | |||
+ | <code groovy> | ||
+ | architectury { | ||
+ | platformSetupLoomIde() | ||
+ | neoForge() | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | **Optional: | ||
+ | |||
+ | <code groovy> | ||
+ | // In common/ | ||
+ | architectury { | ||
+ | common(" | ||
+ | // This means map neoforge to forge | ||
+ | it.platformPackage " | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // In forge/ | ||
+ | architectury { | ||
+ | platformSetupLoomIde() | ||
+ | neoForge { | ||
+ | platformPackage = " | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Then, modify your configurations, | ||
+ | |||
+ | <code groovy> | ||
+ | configurations { | ||
+ | common | ||
+ | shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. | ||
+ | compileClasspath.extendsFrom common | ||
+ | runtimeClasspath.extendsFrom common | ||
+ | developmentNeoForge.extendsFrom common | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Now, in your dependencies block, change '' | ||
+ | |||
+ | <code groovy> | ||
+ | dependencies { | ||
+ | // ... | ||
+ | shadowCommon(project(path: | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | **9. Check usages of '' | ||
+ | |||
+ | ArchitecturyTarget.getCurrentTarget() will return " | ||
+ | |||
+ | **10. Refresh Gradle & Run Configs, Fix Errors & forge/ | ||
+ | |||
+ | ==== Add a NeoForge subproject independent of the Forge subproject ==== | ||
+ | |||
+ | **1. Initial Setup** | ||
+ | |||
+ | Create a '' | ||
+ | |||
+ | Then in '' | ||
+ | |||
+ | **2. Setup NeoForge** | ||
+ | |||
+ | Follow the steps above in " | ||
+ | |||
+ | Also remember, in your '' | ||
+ | |||
+ | <code groovy> | ||
+ | architectury { | ||
+ | common(" | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ==== Add a Forge-like subproject, and a NeoForge subproject ==== | ||
+ | |||
+ | **1. Initial Setup** | ||
+ | |||
+ | * Create a '' | ||
+ | * Copy your '' | ||
+ | * Copy your '' | ||
+ | * Copy your '' | ||
+ | * In '' | ||
+ | * In '' | ||
+ | |||
+ | **2. Setup NeoForge** | ||
+ | |||
+ | Follow the steps above in " | ||
+ | |||
+ | Make sure you do the " | ||
+ | |||
+ | <code groovy> | ||
+ | architectury { | ||
+ | common(" | ||
+ | it.platformPackage " | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | **3. Setup Forge-Like** | ||
+ | |||
+ | In '' | ||
+ | <code groovy> | ||
+ | architectury { | ||
+ | forgeLike([" | ||
+ | it.platformPackage " | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Then, remove the dependency on Fabric Loader, and add the dependency on MinecraftForge, | ||
+ | |||
+ | <code groovy> | ||
+ | dependencies { | ||
+ | forge " | ||
+ | compileOnly(project(path: | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | **4. Setup Forge** | ||
+ | |||
+ | In '' | ||
+ | |||
+ | <code groovy> | ||
+ | dependencies { | ||
+ | forge " | ||
+ | |||
+ | common(project(path: | ||
+ | common(project(path: | ||
+ | shadowCommon(project(path: | ||
+ | shadowCommon(project(path: | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | **5. Setup NeoForge** | ||
+ | |||
+ | First, we need to add the forgeLike configuration, | ||
+ | |||
+ | <code groovy> | ||
+ | configurations { | ||
+ | common | ||
+ | forgeLike | ||
+ | shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. | ||
+ | compileClasspath.extendsFrom common, forgeLike | ||
+ | runtimeClasspath.extendsFrom common, forgeLike | ||
+ | developmentNeoForge.extendsFrom common | ||
+ | developmentForgeLike.extendsFrom forgeLike | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Then, similar to above, we will add the dependency on Forge-Like' | ||
+ | |||
+ | <code groovy> | ||
+ | dependencies { | ||
+ | neoforge " | ||
+ | |||
+ | common(project(path: | ||
+ | forgeLike(project(path: | ||
+ | shadowCommon(project(path: | ||
+ | shadowCommon(project(path: | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | **6. Setup NeoForge remaps** | ||
+ | |||
+ | Since there are class renames in NeoForge, we will want to remap them. Architectury Plugin automatically added remaps to NeoForge' | ||
+ | |||
+ | Here's an example on remapping '' | ||
+ | |||
+ | <code groovy> | ||
+ | // In forgelike/ | ||
+ | architectury { | ||
+ | forgeLike([" | ||
+ | it.platformPackage " | ||
+ | it.remapForgeLike " | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // In neoforge/ | ||
+ | architectury { | ||
+ | neoForge { | ||
+ | platformPackage = " | ||
+ | remapForgeLike " | ||
+ | } | ||
+ | } | ||
+ | </ |