Jump to content

Setting up Forge Gradle with separated workspace?


ianc1215

Recommended Posts

I am wanting to setup a Forge Gradle environment in what is best defined as the Pahimar style workspace.

 

In the old forge builds all you did was dive into the forge folder to find everything you needed. With the new system I am a little lost.

 

So where is all of the mcp files now?

 

I see the build folder has file I remember inside it but things seem to be all over the place compared to the old build system.

 

If someone has a bit of a road map I could follow I am sure I can figure it out. Can anyone give me a hand?

 

Also do I still need Gradle if I am using my own dev environment, I will be coding in straight java NOT gradle.

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.” - Linus Torvalds

Link to comment
Share on other sites

Here's a little information on ForgeGradle that will help you understand:

 

Gradle is a program used to build java and other programs by compiling the source and building your jar. ForgeGradle is a plugin for this builder which also adds some new commands (known as tasks) to Gradle such as decompiling and deobfuscating Minecraft's jars and reobfuscating your mod to srg names required by ForgeModLoader and Forge.

 

Minecraft is no longer decompiled into a folder, as it was before ForgeGradle. Currently if you run the "setupDevWorkspace" command (otherwise called a gradle task) with ForgeGradle it will get the Minecraft jars, merge them together and swap all the obfuscated names (such as ab.class) to mcp names (such as EntityPlayer.class), which is known as deobfuscating. This will create the jar ~\.gradle\caches\minecraft\net\minecraftforge\forge\1.6.4-9.11.1.964\forge-1.6.4-9.11.1.964-mcp.jar (where ~ is your user folder). This jar should be referenced like the other library jars in your project, such as gson-2.2.2.jar and lwjgl-2.9.0.jar. With this setup you will unfortunately be unable to see what lies inside of each of Forge and Minecraft's many methods and classes.

 

This is where the gradle task "setupDecompWorkspace" comes in handy. It creates the same jar as "setupDevWorkspace" but also creates a forge-1.6.4-9.11.1.964-src.jar in the same folder, which once you set it as the forge-1.6.4-9.11.1.964-mcp.jar's source, you will be able to browse the code similarly as you would with the old setup, and see how the classes tick. Do note that this source jar is read only.  After your mod is completed you will need to run the gradle task "build". This is the same as the normal gradle build task however it translates the mcp names you have referenced in the forge-1.6.4-9.11.1.964-mcp.jar to srg names (names created by the mcp developers that stay the same between each minecraft version, where mojang's obfuscations do not). You can then find your built mod in the build/libs folder inside the folder containing your build.gradle file.

 

You will need the build.gradle file to remain in your project folder for the gradle tasks (commands) to take effect. If you don't have gradle installed on your computer, you will need the gradle wrapper in your project as well as you will need to send the build command to it.

 

I am wanting to setup a Forge Gradle environment in what is best defined as the Pahimar style workspace.

Chances are you are using eclipse, which I haven't  used in a while and will make this a little difficult. When I used eclipse I found that the "Pahimar workspace" aka "the normal workspace" was best used so there wasn't several mcp setups around your computer. As ForgeGradle stores most of it's files in the ~\.gradle directory setting up multiple build directories shouldn't take long or take up much space on your computer. As each mod will need it's own build.gradle file things become a little difficult. If you want the most hastle-free modding experience I can suggest opening up two eclipse windows and coding side-by-side. If you do want to use a "Pahimar workspace" you need to ask someone other than me. I may put together a tutorial on this at a later date.

 

So where is all of the mcp files now?

The ~/.gradle folder, see the the first four paragraphs.

 

I see the build folder has file I remember inside it but things seem to be all over the place compared to the old build system.

The only thing you need to worry about in the build folder is that when you run the "build" task in gradle, your compiled mod jar will be in there. The rest of the files in the build folder should be left alone.

 

Also do I still need Gradle if I am using my own dev environment, I will be coding in straight java NOT gradle.

You don't "code gradle", see the first paragraph.

Link to comment
Share on other sites

Wow absolutely fantastic! Thank you for the detailed explanation, this helps me out a lot.

 

Curiously if you are not using eclipse, then are you using? IntelliJ, Netbeans, etc.?

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.” - Linus Torvalds

Link to comment
Share on other sites

IntelliJ IDEA, the free community edition. I got frustrated with it the first time I used it however I gave it a second chance and i'm never going back from it. This is mainly due to it giving suggestions as it predicts what you're typing (hard to explain) and the fact that it imports Gradle projects really well. All I do is click "Import project", select the build.gradle file and click next a couple of times. It sets up my src folder along with all of my dependencies leaving me ready to code around 20 seconds after the Gradle setup is complete. The only thing it doesn't do it set up the run configurations, but that's expected. I could go on for hours about how much I love it and all it's features (such as being a hell of a lot faster than eclipse and having themes!) but i'll leave it at this.

Link to comment
Share on other sites

Uh okay something is different for me.

 

The contents of my .gradle folder you are referring to is

 

1.8

  taskArtifacts

      cache.properties

      fileHashes.bin

      fileSnapshots.bin

      outFileStates.bin

      taskArtifacts.bin

 

 

There is no folder anywhere in the tree you mentioned.

 

If I look in the build folder which is only other place I see usable "built" files. There is a file in there called forge-1.6.4-9.11.1.964-srg.jar.

 

Its in a folder called decompile. I tried to reference it as a library to no avail. But there is a strong change I am doing something wrong.

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.” - Linus Torvalds

Link to comment
Share on other sites

Yeah I have used IntelliJ before but I found the learning curve a little frustrating since I am sorta new to "real" programing (I say that very loosly) as in needing a dev environment. Scripting I can do but Java is a little new to me. hmm maybe I will give IntelliJ another shot.

 

Still.... see my post above.

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.” - Linus Torvalds

Link to comment
Share on other sites

Uh okay something is different for me.

 

The contents of my .gradle folder you are referring to is

 

1.8

  taskArtifacts

      cache.properties

      fileHashes.bin

      fileSnapshots.bin

      outFileStates.bin

      taskArtifacts.bin

 

 

There is no folder anywhere in the tree you mentioned.

 

If I look in the build folder which is only other place I see usable "built" files. There is a file in there called forge-1.6.4-9.11.1.964-srg.jar.

 

Its in a folder called decompile. I tried to reference it as a library to no avail. But there is a strong change I am doing something wrong.

 

it would be the Gradle user home directory (default is USER_HOME/.gradle, which on a mac or linux would be ~/.gradle as HoBoS_TaCo mentioned) not the <project>/.gradle directory

Link to comment
Share on other sites

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.