How to use WorldEdit (or any mod) in your testing environment [Tutorial]

Started by Kuba4ful on Fri, 06/11/2021 - 16:44

Topic category: User side tutorials

Last seen on 18:23, 20. Jun 2021
Joined Jun 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How to use WorldEdit (or any mod) in your testing environment [Tutorial]
Fri, 06/11/2021 - 16:44

Hi. Today I've spent 7 hours trying to use WorldEdit in my testing (mdk) environment to make structures, but now I've managed to make it work and wanted to share with you how to do it, in a simple three setp guide. (You can make it work with any mod that has it's deobf version online or is open source. You will just need to change a few lines in build.gradle file).

First of all, go to https://maven.enginehub.org/repo/com/sk89q/worldedit/ and find the version you're developing the mod for (in this tutorial I'll use 1.16.5 since it's the newest MCreator version). Remember that with MCreator we're using Forge, so the link you want to find will look like this: "worldedit-forge-mc*version*".

(Side note: Mods for 1.16.3 are compatible with 1.16.5, that's why there's no 1.16.5 in that directory).

Choose the version without "SNAPSHOT" at the end, because these versions may be unstable and may lead to crashes.

Now you will see a few jar files with very similar names. Download the one ending with "-dev", because this one is the deobfuscated (deobf) version.

(Explanation, no need to read it if you're not interested in it. Because it's easy to decompile java appliactions and see their source code, Mojang implemented obfuscations of names to make it harder for data miners. So for example a method called "generateChunk" (idk if there's really a method like that, I just made it up) after obfuscating would have a name "_gfdhg1434" (basically a random string). Forge testing environment uses deobfuscated names, however compiled mods ready for distribution call methods with obfuscated names, since normal Forge environment also uses obfuscated names. Thankfully, many mods also provide deobfuscated versions of themselves (usually called deobf or dev). But even if a mod author doesn't provide deobf version, as long as it's open source, you can compile it yourself. I won't go into detail here how to do it, but it's not that complicated even if you don't understand java).

 

That was the first step. Now, onto the second step.

Put the .jar file you downloaded into "McreatorWorkspace/run/mods". 

That was simple, but it's still not the end. If you try running the testing environment now, it will just crash and give you an error like "Class not found SessionOwner" or something else. That's because we still need to add dependencies into our gradle file.

This is the part that took me the longest to figure out, because I have literally no idea how to work with gradle, and there wasn't a simple tutorial on the internet. But using the method of trial and error, I finally succeeded.

 

Third step, go to folder "MCreatorWorkspace" and open file gradle.build with Notepad++ (or any other text editor. Yes you can even use basic notepad if you want to)

Scroll down to the bottom until you see something that looks like this:

dependencies {
    minecraft 'net.minecraftforge:forge:1.16.5-36.1.0'
}

It's important to note that this file has two "dependencies" sections. We're interested in the most bottom one. Here you need to add three dependencies, one to slf4j-api, second to worldedit-core, and third to worldedit-forge. You have no idea what I just said? Don't worry, 7 hours ago I also wouldn't know. That's why I present you a working code, that you just need to change a little bit.

repositories {
    maven{ url 'https://maven.enginehub.org/repo/' }
	}
	
dependencies {
	implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30' /*It's best to always use the newest release. You can check the newest version by googling slf4j-api*/
	implementation group: "com.sk89q.worldedit", name: "worldedit-core", version: "7.2.0", changing: true /*change 7.2.0 to the worldedit(!) version you downloaded the jar for before*/
    minecraft 'net.minecraftforge:forge:1.16.5-36.1.0' /*don't change this line from your original build.gradle file. It specifies what forge version you're using. If you accidentally changed it, you can see what version you used in Workspace -> Workspace Settings */
	
    compile fg.deobf('com.sk89q.worldedit:worldedit-forge-mc1.16.3:7.2.0:dev') /*change 7.2.0 to the worldedit(!) version you downloaded the jar for before. change 1.16.3 to the version of minecraft you're using (but not to 1.16.5, because as I explained before, 1.16.3 mods work in 1.16.5)*/

And that's all. You just need to paste it where the bottom one "dependencies" section is, change a few values, and you're done. You can now use worldedit in your testing environment. I can't believe myself that it actually took me so long to figure that out, but that's what you get for trying to do things out of your reach. But in the end I made it, so you can take it as a lesson to never give up, even if you completely don't understand something.

Last seen on 22:47, 29. Jul 2021
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Kuba4ful, have you tried…
Wed, 07/21/2021 - 07:59

Kuba4ful, have you tried using fabric and litematica to build? You can copy and paste walls and floors really fast etc. Then you can transfer the save file to Mcreator save folder.