Mods/Creating mods/Setting up the MCP workspace

From Minecraft Wiki
Jump to: navigation, search
The contents of this page are not supported by Mojang AB, the Minecraft Wiki, the Minecraft IRC channel or the Minecraft Forums.
This tutorial requires launching Batch/Shell files, and if you do not have a fair amount of knowledge about these files, your system could be damaged.
Please read carefully when following the instructions below.

To begin modding, you must first download a few programs. A list of tools needed for these tutorials is above. A step-by-step tutorial for installing the programs and setting up the modding workspace is below (If instructions are different for a certain operating system in a step, there will be instructions provided for Windows, Mac OS X, and Linux).

  1. Windows Linux First, download the most recent version of Java SE Development Kit for your system. You must know your operating system and whether it is 32-bit or 64-bit (if you are unsure of if you have a 32-bit or 64-bit system, see the Troubleshooting section of this page). Clicking the button for the Java Platform (JDK) <version> will take you to the page where you select the package for your system. You have to click the button "Accept License Agreement" to be able to start the download. When you have an installation package downloaded, launch it and follow the instructions for installation.
    macOS Skip to step number 2. Note that if you have a J2EE dev kit installed you are already good to go .. you do not need the SE JDK.
  2. Once you have the Java SE Development Kit (JDK) installed, download the Minecraft Coder Pack for the version of Minecraft you want to mod. The file should be a compressed folder (.zip). Leave this file on your desktop for now. Now, create a new folder for wherever you would like to have all of your modding workspaces. Drag the compressed folder you downloaded into this new folder. In this new folder, create another folder. Here, you will store the files for your first mod.
  3. Now, direct yourself back to the first folder you created in this tutorial. Open the compressed folder. In this folder, you should see many Batch (.bat) and Shell (.sh) files. Select everything in the compressed folder, and extract it to the most recent folder you created.
  4. Close the compressed file. Do not delete it, as if you ever plan to create another modding workspace, you will need to extract its contents to that workspace. Now, you will need to retrieve a clean (no mods) minecraft_server.jar.
  5. Copy the downloaded "minecraft_server.jar" to the "jars" folder under your mod folder.
  6. There are two files you will need to run. Follow the instructions below for your system.
    Windows Open "updatemcp.bat" like you would open any other file. A new Command Prompt window should open. This window should have the MCP version and Minecraft version in the first line. If updates are available, you will see a line saying "You are going to update MCP. Are you sure you want to continue? If you really want to update, enter "Yes"". Type in "Yes" (without quotation marks). Let it run until it says "Press any key to continue...". Press any key. The window should close. If updates are not available, it will say "No new updates found. Press any key to continue...". Press any key. The window should close. Next, run the "decompile.bat" file. This may take a long time, yet let it run until it says "Press any key to continue...". Press any key. The window should close.
    macOS Open Terminal. Type cd . Include the space! Now drag your mod's folder into Terminal and press Enter. Then type, bash updatemcp.sh. Then, the window should have the MCP version and Minecraft version in the next line. If updates are available, you will see a line saying "You are going to update MCP. Are you sure you want to continue? If you really want to update, enter "Yes"". Type in "Yes" (without quotation marks). Let it run until it says "Press any key to continue...". Press any key. The window should close. If updates are not available, it will say "No new updates found. Press any key to continue...". Press any key. The window should close. Open Terminal again. Type cd . Include the space! Now drag your mod's folder into Terminal and press Enter. Then type, bash decompile.sh. This may take a long time, yet let it run until it says "Press any key to continue...". Press any key. The window should close.
    Linux NOTE: There are two ways to open the files on Linux. The easier method is described here. Right-click on "updatemcp.sh". Click on "Properties". Click on the "Permissions" tab. Tick the "Allow executing file as program" checkbox. Click "Close". Then, open "updatemcp.sh" like any other file. A Terminal window should appear. This window should have the MCP version and Minecraft version in the first line. If updates are available, you will see a line saying "You are going to update MCP. Are you sure you want to continue? If you really want to update, enter "Yes"". Type in "Yes" (without quotation marks). Let it run until it says "Press any key to continue...". Press any key. The window should close. If updates are not available, it will say "No new updates found. Press any key to continue...". Press any key. The window should close. Next, do the same as written above to "decompile.sh". Next, open the file like any other file. This may take a long time, yet let it run until it says "Press any key to continue...". Press any key. The window should close.
    Note: "updatemcp" updates any MCP files that can be updated. This is very important to run, as it could fix major bugs. "decompile" decompiles the Minecraft JAR and minecraft_server.jar. This allows you to see the source code of Minecraft and mod it. Note that while decompiling, some warnings or errors may appear. An example of a warning that may appear includes "Modified jar detected! Unpredictable results!!" This warning should appear, as ModLoader is installed. Do not worry about this. An error that may occur includes "1 out of 1 hunks failed". This error also should appear, and will not damage any files or do anything to disrupt the decompiling process.
  7. Now, you will need to access the source code. Create a new folder for all of your files for the program you will be downloading. Download Eclipse for your system. Open it.
  8. This is the last step for this tutorial. If you have not already, launch Eclipse. Then, go to your mod's folder. Open the folder titled "eclipse". Copy the file path for this folder. Then, go back to your Eclipse window. The window, once it has loaded, should say "Select a workspace". In the box titled "Workspace:", paste the file path. If you had trouble copying the file path, you can also click "Browse..." and direct the program the "eclipse" folder in your mod's folder. Once you have retrieved the file path, click "OK". Wait for Eclipse to load. On the left, a window titled "Package Explorer" should contain two folders, "Client" and "Server". Click the arrow next to "Client". Then, click the arrow next to "src". Next, click the arrow next to net.minecraft.src. If you see several .java files, you have successfully decompiled Minecraft.

Troubleshooting[edit | edit source]

  • If you are unsure of whether your system is 32-bit or 64-bit, follow the instructions below for your system.
    • Windows Click on the Start button. Right-click "Computer". Click "Properties". Under the "System" section, look for "System type:". Next to this should say whether you have a 32-bit or 64-bit system.
    • macOS See this link to see if your system is 64-bit or 32-bit.
    • Linux Open Terminal. Run the following command: " uname -a" (without quotation marks). The output should be a long line. Somewhere in the line, there should be either "x86_64 GNU/Linux" or "i386/i486/i586/i686". The first one means your system is 64-bit. The second means it is 32-bit.
  • If you receive the following error when decompiling:
== MCP x.x (data: x.x, client: 1.x.x, server: 1.x.x) ==
> Searching for <file name> in <file path>
!! java check FAILED !!
Command '"<file path>" -version' returned non-zero exit status 1

You forgot to install JDK or installed it incorrectly. Repeat Step 1 above.

  • If you receive the following error when decompiling:
!! Modified jar detected. Unpredictable results !!
'runtime\bin\applydiff.exe -p1 -u -i ..\..\temp\temp.patch -d src\minecraft' failed : 1

== ERRORS FOUND ==
When decompiling with ModLoader a single hunk failure in RenderBlocks is expected and is not a problem

2 out of 2 hunk FAILED -- saving rejects to file 'net\minecraft\src\RenderBlocks.#'
==================

This error is supposed to occur, as you installed ModLoader. Ignore it, it will not disrupt anything.

See also[edit | edit source]