02. Basic Looks

Open your eyes

Ok, so this lesson doesn’t do anything with the MCP, but it’s great that you’ve set it up so you don’t waste time in later lessons. Setting up after you started this set of lessons will be frustrating, especially since you don’t want to go back to the beginning to do everything all over again.

Great, you’ve made it this far. In this lessons we will learn as much as there is to know about the minecraft.jar file. That’s where your world exists, Minecraft world, that is. The minecraft.jar file is simply a zipped up file with a bunch of other files and folders that contain information about how to build your minecraft world. It’s like the DNA and the RNA used to build an entire living being. Screw up the code, and you get a nasty mutant.

Minecraft.jar file in game folder

Minecraft.jar file in game folder

First thing in this lesson is to extract the contents of our minecraft.jar file. You can simply do this from your game folder. This assumes that you have done no other mods to the code. Basically, you want to modify the last good working copy of the minecraft.jar file. If you’ve modified your files around, and have fiddled around in your working environment you set up already, for this lesson, you need the last modified copy of your minecraft.jar file that works.

Before you extract this file, it’s ALWAYS a good idea to back up your original files, no matter what. In this case go ahead and copy the minecraft.jar file to something that makes sense, like minecraft.jar.bkp for backup. It’s ok if you change the extension. The data inside won’t be damaged. You simply painted its shell a different color.

Minecraft.jar backup file in main game folder

Minecraft.jar backup file in main game folder

Now, use a program like 7-Zip, or WinRAR. For this lesson, I will use WinRAR.

Use WinRAR to extract minecraft.jar into minecraft folder

Use WinRAR to extract minecraft.jar into minecraft folder

Extract the files to “minecraft” folder.

Extracting files from minecraft.jar file to minecraft folder

Extracting files from minecraft.jar file to minecraft folder

And the folder…

The extracted minecraft folder in the game folder

The extracted minecraft folder in the game folder

In this folder, look for a file called “terrain.png”.

Terrain file in extracted minecraft folder

Terrain file in extracted minecraft folder

Here’s the kicker. You need a software program that can view, edit, and save .PNG image files. You can use open source software such as Paint.Net or GIMP. You can find them here respectively:
http://www.getpaint.net/
and
http://www.gimp.org/

First step, ALWAYS backup your original files. You will need to get your “terrain.png” file backed up. Make a copy and put it in a safe place. I made a folder in “My Documents\My Dropbox” that deals with keeping any file backed up and as safe as it could be.

Terrain.png

This file may look different depending on the version of your game and other modifications.

Now, you’re ready to make changes. Open your terrain file with your preferred image editor, and while staying within the lines, modify your “dirt” block. Why the “dirt” block? It’s the most commonly seen when you start out.

Terrain.png modified

Terrain.png modified

Here’s another closeup look of the modification.

Now, to re-compile the minecraft.jar file. All you have to do is use your zipping program to create a compressed file, but with a .jar extension. You can simply just compile the file contents and then rename the file.

* Keep in mind to compile the CONTENTS of the minecraft folder, NOT the folder itself.

Here’s what I did: I selected all of the files in the minecraft folder, right clicked, and selected to add files to a ┬ácompressed file.

Re-compressing the minecraft.jar file. Selecting and adding to archive

Re-compressing the minecraft.jar file. Selecting and adding to archive

When compressing, I chose ZIP format, then renamed the file extension to .jar.

ZIP format selected and file extension changed to .jar

ZIP format selected and file extension changed to .jar

Creating the archive file

Creating the archive file - jar stands for java archive

Zip file ready

Zip file ready

When all said and done, move the newly created minecraft.jar file into your minecraft game folder. Make sure you backup your original file, as you don’t want to lose a working copy of your game.

New jar file to be used during game - Notice file size difference

New jar file to be used during game - Notice file size difference

If you did everything right, when you play your game, you should see your changes.

Before:

Original dirt look

Original dirt look

After:

All of your non grassy dirt blocks will now have smiley faces on them

All of your non grassy dirt blocks will now have smiley faces on them

Happy gaming.

Summary

In this lesson, you learned how to modify your terrain texture file to change the look of your world. You’ve also learned a little about the minecraft.jar file and how it’s compressed and structured.

Advertisements

01. The Setup

In the beginning, there was Java

If you’ve always wanted to make your own custom minecraft, but never really had the know-how, or all of those tutorials out there are outdated, or confusing, this blog was specifically made for you. Screenshots to help you on your way, and no more video tutorials that take hours to go through. Right to the point!

First, you will need some files. Download the latest and greatest of the following:

The JDK and JRE platforms from here:
http://www.oracle.com/technetwork/java/javase/downloads/index.html

Download JDK and JRE

Click download for each platform and find your platform (click to enlarge)

You also need to download and install the MCP, or Minecraft Coder Pack. You can either google for Minecraft MCP, Minecraft Code Pack, or simply follow this link:
http://mcp.ocean-labs.de/index.php/MCP_Releases

Create a working environment for yourself. This will be your sandbox where you can extract files, re-compile them, write your code, edit your images, and essentially build your mods. I would suggest to build a separate folder for each mod you wish to create.

There will be several simple mod lessons for your to go through to get used to modding minecraft. Just like any complex system, there are many simple parts to it.

In this lesson, we will simply set up our working environment. In the next lesson, we will play with the image files so you can modify minecraft to look like Mario’s World if you wish.

Advice

Assuming that you’ve installed the Java packs mentioned above, let’s move onto your working environment. I have set up my working folder to be in my dropbox folder. If you don’t know what Dropbox is, it’s a great way to keep your files synced no matter where you are, as long as you have internet connection, you can keep up to 2 GB of space synced. Their desktop app makes everything even easier without messing around with web browsers. Download dropbox here:
┬╗ Download Dropbox

In your working folder, unpack the MCP file you downloaded. I use WinRAR for zipping and unzipping.

minecraft coder pack unzipped

Minecraft Coder Pack Unzipped (click to enlarge)

You will need a text editor. For these lessons, I will use Notepad++. It’s free, it’s customizeable through various plugins, and it’s very light weight. You can chose other editors if you wish. There are several good ones with Java in mind. There are JCreator and Eclipse just to name a few. Download Notepad++ here
http://notepad-plus-plus.org/

JCreator and Eclipse can be downloaded respectively here
http://www.jcreator.com/
and here
http://www.eclipse.org/

You will of course, need to get Minecraft from here
http://www.minecraft.net/

I have purchased the beta version for the desktop. You will need to get the desktop version of the game. As soon as you play the game for the first time, minecraft game files will be created.

Finding The Game Files

On Windows XP you can usually find your minecraft files here
C:\Documents and Settings\[USERNAME]\Application Data\.minecraft

On Windows Vista, you can usually find them here
C:\Users\[USERNAME]\AppData\Roaming.minecraft

In this folder, you will have a “bin” folder where you will find the most important file of the game… the “minecraft.jar” file. This file is simply a zipped up file with a different extension. This file contains all of the necessary code / images to run your game.

Right now, we’re simply concerned with setting up our basic environment where we will be modifying game files to suit our needs.

Getting your folders straightened out

While in your game “.minecraft” folder, you need to copy both the “bin” and “resources” folder into your MCP working directory under the “jars” folder.

Copying bin and resources folders into MCP folder

Copying bin and resources folders into MCP folder (click to enlarge)

Now, go back into the game’s “bin” folder and copy out the “minecraft.jar” file into the MCP working directory “jars” folder.

Copy minecraft file into the jars folder

Copy minecraft file into the jars folder (click to expand)

Now, go back to the parent folder where you set up your MCP environment and run the “decompile.bat” file

The decompile file to run (click to enlarge)

You should see a similar screen

Decompile minecraft.jar

When you run decompile.bat, you will see a similar screen. (click to enlarge)

After this screen finishes running, there will be a prompt to press any key to continue. Pressing any key on your keyboard will close this command window. You should now see new folders in your development environment as such.

New folders after running decompile.bat

New folders after running decompile.bat (click to enlarge)

The “src” folder above will hold other folders nested as as “minecraft\net\minecraft\src” all of your source files that you need to modify to alter your new minecraft world.

Source folder containing all of the .java files necessary for modifications

Source folder containing all of the .java files necessary for modifications (click to enlarge)

Now, all you need is to set up your text editor in order to modify these files. In my case, I used Notepad++.

Notepad++ setup screenshot

Notepad++ setup screenshot (click to enlarge)

Summary

This is the end of the first lesson. Now you should be comfortable to set up your work environment in order to alter the minecraft game to your liking. Next lesson, we will look at modifying texture of object to customize the look and feel of your environment.