Topic category: User side tutorials
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.
You could pack this into a plugin :)
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.
This is a really old topic but I have a simpler way of doing things and it's done using CurseMaven.
What you would want to do is add CurseMaven as a repository (it's already mentioned how to do that in the tutorial).
The URL for that is https://cursemaven.com/.
Next thing you want to do is add WorldEdit as a dependency and this time it's even simpler thanks to ForgeGradle's built-in deobfuscate method.
All you have to do is add this to your dependencies:
The file it's adding is 7.2.8 for 1.18. It's determined by the third part of the string (3559499 in this case)
To change the version that's used all you need to do is go to CurseForge, select the desired WorldEdit version, right click the download button and select "Copy Link Address". After that, paste the copied link somewhere and copy the digits after "download/". Then replace 3559499 with the copied digits.
Sounds complicated but it really isn't and it doesn't involve any downloading.
I'm 100% sure if it works with MCreator but it should in theory.
I Make It More Easy
Doesn't work on 1.17
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\45435354\MCreatorWorkspaces\addons\build.gradle' line: 60
* What went wrong:
A problem occurred evaluating root project 'addons'.
> Could not find method compile() for arguments [DefaultExternalModuleDependency{group='com.sk89q.worldedit', name='worldedit-forge-mc1.17.1', version='7.2.7', configuration='default'}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
Never mind just followed what uSkizzik said. Here's an image of what the build_gradle should look like. All you gotta do is write down the stuff in the red area excpet that apply from mcreator gradle. https://ibb.co/Nj7XJJZ
There's no -dev version of worldedit for 1.20.1 forge. I can't use this tutorial.
Yes PercyJames with the plugin that I just made, there is the worldedit API and more, here is the link of my first version:
https://mega.nz/file/P0N02T5S#bAsSZUJM3b7j71VLKO8Af5gDr9FdexftcDLq1TtY-ww
In addition you also have an API to be able to make larger structures, one to use shaders, and StructureGel which is good too and many others.
I haven't sorted it out yet.
uSkizzik either I'm blind or your just stupid there's no download link to my knowledge
@Doo89 the plugin isn't working, its in my plugin folder but it doesn't give me the option to load it
@Axeldactyl If you are using Neoforge, you just need to put the WorldEdit Mod in the Minecraft Mods folder.