Pokechu22 / WorldDownloader

Makes a copy of parts of a multiplayer world for singleplayer use (EG, for backups or renders)
https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/2520465-world-downloader-mod-create-backups-of-your-builds
Other
571 stars 135 forks source link

Compile from sources from MC 1.7.10 #27

Closed Stoakes closed 8 years ago

Stoakes commented 8 years ago

Hi,

I'd like to compile a custom version of WorldDownloader for Minecraft 1.7.10. I am experienced in java but not that much in minecraft modding, so I set up my environnement following this tutorial. Set up seems to be ok (net.minecraft.* packages are resolved), but I have some issues especially with GUI package and unresolved methods on every event (onMouseRelease, isMouseOver .. )

I'm interested to know how you proceed to compile the mod, which tool you use or if you had some tips to help me compile the mod.

Thanks

Pokechu22 commented 8 years ago

Hi! I've been hoping people would get interested in developing the mod.

Right now, it's unfortunately a bit of a pain to compile (I've been trying to make it easier, but it hasn't gotten too much simpler yet). So just keep that in mind - it's not currently set up in a way where it's easy to figure out everything by yourself.

Now that I've said that, I should note: the mod doesn't use forge. It's a direct base edit, meaning that you need only MCP, not forge. You can get MCP from their website. MCP is the toolkit used to decompile and deobfuscate Minecraft, which forge builds upon. You would want to download MCP for 1.7.10.

This is where the process gets a bit annoying. WDL's code is split between patches for the base code (located in the MCP folder) and the main code. But they can't be directly intermixed immediately since MCP's decompile process overwrites some of the files, but WDL also needs to overwrite some MCP files.

Here's a process that would work if you're using the git command line (there are other ways of doing this, too):

First, clone WDL's code (if you haven't already). Switch to the 1.7.10 branch. Then, extract the MCP zip inside of your clone (overwriting the contents of the MCP folder - we'll recover it next). Run the following commands to reuse the modified MCP configurations:

git checkout -- mcp/conf/asyle.cfg
git checkout -- mcp/conf/fields.csv
git checkout -- mcp/conf/methods.csv
git checkout -- mcp/conf/params.csv

Now that those configurations and mappings are correct, you can run decompile.bat in the MCP folder to decompile the game. This might take a little while, but not too long. Once it's finished, you'll want to overwrite a few of the decompiled files with the modified versions WDL uses:

git checkout -- mcp/src/minecraft/net/minecraft/client/ClientBrandRetriever.java
git checkout -- mcp/src/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java
git checkout -- mcp/src/minecraft/net/minecraft/client/gui/GuiIngameMenu.java
git checkout -- mcp/src/minecraft/net/minecraft/client/multiplayer/WorldClient.java

Once you've done that, you can use createSymLinks.bat in the root folder to make MCP find the main WDL code. You should now be able to edit the code in the src folder (WDL's code) and everything will work. To launch the game, you can run startclient.bat in the MCP folder. Alternatively, if you want to use eclipse, you can switch to the workspace that MCP generates in the eclipse folder of MCP (this includes launching the game within eclipse).


As I mentioned, I'm working on trying to simplify this process (also, hopefully I'll be able to put all minecraft versions on one branch). So eventually this will get easier.

Stoakes commented 8 years ago

Thanks a lot for your answer. That works fine !

I played a little with the code and it works in the test client. I tried to export it as a "standalone" mod to use it in my real minecraft. So I execute recompile.bat and then reobfuscate.bat. I get no special warnings. Then I add assets folder distributed with World Downloader to reobf/minecraft content and zip them all.

However, I LiteModer doesn't seems to recognize my export mod, while it's ok with your released version. More tricky : if I just grab your source and compile it, it works.

Pokechu22 commented 8 years ago

Ah, again, this is the repo for the base edit build - using reobfuscate.bat generates the set of class changes that would be needed to create the base edit build (and would be inserted directly into the minecraft jar). The liteloader build is maintained by @uyjulian.

Unfortunately, there isn't an updated 1.7.10 or 1.8 liteloader build, only 1.8.9, 1.9, and 1.9.4. I'm not entirely sure how the liteloader builds are done, but I think gradle is used (it also looks like there is eclipse project information in 1.7.10 and 1.8). You can find the repos for it at uyjulian/LiteModWDL for 1.7.10 and 1.8, and uyjulian/WorldDownloader for 1.8.9, 1.9, and 1.9.4.

Again, hopefully the build process can be improved in the future.

Stoakes commented 8 years ago

Hi,

I've been looking at @uyjulian /LiteModWDL and I saw ant script for build.

However, it lacks of informations about setting the dev environnment up. As LiteModWDL issues point there, if someone has some infos on how can I proceed to build a litemod compliant version of WDL.

Thanks

uyjulian commented 8 years ago

@Stoakes It's easy to build using ant; just change mcp.dir and python properties to the correct values in the ant file, then run the ant file.

Also, uyjulian/LiteModWDL is the old repo, you should be cloning the uyjulian/WorldDownloader repo and checking out the liteloader1.7.10 branch.

Stoakes commented 8 years ago

Hi Thanks for your reply. I didn't know it was an old repo.

However, my question was more about what shall I do before building ? Is there some litemod related stuff to download/install ? How to go from the source to a folder ready to build ? For instance, I use MCP to decompile Minecraft, then proceed as Pokechu said before, when I run the ant script, I have some md5 missings. Could not find client_liteloader.md5 to copy

uyjulian commented 8 years ago

@Stoakes Sorry, the 1.7.10/lower versions use the old, complex build system. I have no idea if it works on Windows.
You need to check out liteloader from the old svn. Open a command line then svn checkout https://subversion.assembla.com/svn/liteloader/LiteLoader/tags/1.7.10 ll1.7.10
After that edit some variables in the ll1.7.10/ant/build_liteloader.xml file with your favorite text editor to what is correct for your setup, then open another command line then cd ll1.7.10/ant;ant build_liteloader.xml.
After that is done, open up a new command line then git clone https://github.com/uyjulian/WorldDownloader.git lmwdl1.7.10;cd lmwdl1.7.10;git checkout liteloader1.7.10
Now go into the lmwdl1.7.10/ant folder and edit build.xml with your favorite text editor so that the variables point to the correct path.
Now, in a new command line, cd lmwdl1.7.10/ant;ant build.xml
Your litemod files should be located in ${mcp.dir}/build/dist