Jump to content

Setup multiple forge version environment for a single mod in IntelliJ IDEA


Recommended Posts

Posted

I want to set up an IntelliJ project where I can manage multiple versions of my mod for different versions of forge. For this, I am currently using different modules in IntelliJ where each module is a sub-folder with the corresponding forge MDK extracted there for whichever forge version the module is supposed to run. However, my mods generally have some common code that is used in all versions independent of the forge version. This requires every IntelliJ module to share a common source folder where these common .java files reside. So far this approach is working fine for be but IntelliJ occasionally pops an error saying that different modules cannot have a common source folder, which I simply disregard.

To assign an additional common source folder to every module, I modify the `build.gradle` file in every module by adding the following code to it,
 

// Add common code to sourceSets
sourceSets.each {
    it.java.srcDirs += '../common/java'
    it.resources.srcDirs += '../common/resources'
}

 

This, however, means that I must manually ensure that the common code compiles for every version of forge. It would be great if I can have some form of automation that at least warns me when some of my common code is incompatible with one of my forge versions in my modules.

Since I am very new to Gradle and Minecraft codding in general, I would like to ask if there is an alternative method to achieve what I want or if ForgeGradle provides a feature to have such a multi-version setup.

You can see my current setup here: ServerPropertiesLAN

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.