Skip to content
rutgerkok edited this page Nov 23, 2012 · 24 revisions

This page is made for plugin developers. It explains how to compile Terrain Control.

Code structure

Terrain Control has been divided in three parts: Forge, Common and Bukkit. Common contains almost all generation code. It hasn't any dependencies, besides the standard class libary of Java 6. The Bukkit part uses the code from the Common part to generate a world. The Forge part does the same, but for Forge. This setup prevents having a lot of duplicated code.

Setting up your workspace

To compile Terrain Control, I (rutgerkok) am using a setup with two Eclipse workspaces. It's not a very nice setup, so if anyone else has a suggestion, I'd be happy to hear it.

First of all, make sure that Eclipse is downloaded and installed. Create a new workspace or use an existing one, if you already have one. Download the Terrain Control source from here (if you know how to use Git, you can also use that). Extract it and create a new project in Eclipse, with the location pointing to the Terrain Control source:

Set the location of the project to TerrainControl

Adding Craftbukkit

After you have created the project, a lot of errors will show up. You need to add CraftBukkit and Forge to the project. You can download the latest development of CraftBukkit here. Right-click the project, select Build Path and click Configure Build Path. Click Add External JARs... and select the file you just downloaded.

Build path

Adding Forge

There are still errors in the Forge version. As you might know, the Minecraft source is obfuscated: every class, field and method has been renamed to a meaningless term, like a or nb. The MCP team has given many of those a meaningful name, to help modders. Using MCP you can get a nice, deobfuscated source code. MCP has also made a script to convert the deobfuscated names back to the original, so that it works with Minecraft again.

The Bukkit team is directly distributing an already deobfucated JAR file, made with their own tools. They don't reobfuscate it, so that plugins working with Bukkit also don't need to. For Forge, will we have to create a JAR file similar to the Craftbukkit one by ourselves, and we will also have to reobfuscate our mod.

Create a new folder and extract all files from MCP in it. Download the latest Forge build (use the source) and extract everything into the MCP folder. There should now be a forge folder in the MCP folder.

Download the minecraft_server.jar and place it in the jars folder (inside the MCP folder). Go to the .minecraft folder on your computer and copy the whole bin folder to the jars folder. Make sure that all files aren't modded! The folder structure should look like this:

MCP folder

Open the forge folder and run install.cmd (Windows) or install.sh (Mac and Linux). This can take a while. After everything is installed, open Eclipse and set the workspace to the eclispe folder inside the MCP folder. You now have two different workspaces. The first one contains Terrain Control, the second one MCP. In the second workspace you should now see one project: Minecraft (with a lot of files inside it). Choose File, Export, JAR file and export everything. This is the jar file we need to add to the Terrain Control project in the first workspace. It contains the deobfuscated Minecraft source along with the Forge files.

Compiling

For Craftbukkit it's easy: just (in the first workspace) select Export, Java, JAR file and include the bukkit and common files.

For Forge it's more complicated. We need to get the compiled classes obfuscated, so that it works with the original Minecraft classes. Copy the forge and common classes to the MCP src/Minecraft folder. You can now run reobfuscate.bat (Windows) or reobfuscate.sh (Mac or Linux). It will output all Terrain Control files to reofb/Minecraft. You can add them to the JAR file of the Craftbukkit version to create a universal build, or you can put them in a ZIP file.

Clone this wiki locally