Results 1 to 2 of 2
  1. #1
    D.N.A's Avatar
    Join Date
    Jun 2011
    Gender
    male
    Location
    https://www.mpgh.net/forum/175-crossfire/
    Posts
    15
    Reputation
    10
    Thanks
    3
    My Mood
    Asleep

    Lightbulb D.N.A's Beginner guide to Minecraft Modding

    Hey guys im releasing first tutorial for you guys.


    A Beginner Guide to Minecraft Modding
    by D.N.A



    So you want to get into Minecraft modding but you don't know where to start?

    No problem, in this guide I'll take you through the process of creating a texture pack for Minecraft with a detailed explanation for each step.

    Notch is (understandably) not very fond of java class mods but I'll explain in the bottom of the guide how to decompile java classes and then recompile them.

    so let's get started!

    Contents:

    [*:3mwgtywl]1. Setting up a good modding workspace
    [*:3mwgtywl]2. Creating a texture mod
    [*:3mwgtywl]3. Working with class files



    1. Setting up a good modding workspace

    Then first thing you need to do is get a hold of the original data file for Minecraft, that includes all textures, java classes and whatnot.

    So go ahead and open up explorer (assuming that you're using Windows) and type the following into the address bar,%appdata% then click enter:

    [IMG]https://i16.photobucke*****m/albums/b14/Exorince/Minecraft/Tutorials/965807cd.jpg[/IMG]

    Now you should see a folder there called .minecraft. This is the place where Minecraft stores all its data. Open the folder. Then the bin folder.

    You should see something similar to the image below but don't worry if you don't have as many files, I've been using plenty of mods, including the HD Patcher and MrM's AO patch.

    [IMG]https://i16.photobucke*****m/albums/b14/Exorince/48d82817.jpg[/IMG]

    The one file you need to worry about now is the minecraft.jar, if you don't have it you need to run Minecraft once from the executable you downloaded.

    A quick lesson about the jar files JAR files are built on the same technology as ZIP files, the have a very similar data structure except JAR files are engineered to work better with java classes. This means that you can open and modify JAR files in the same way you could with a ZIP file.

    So open up minecraft.jar with 7zip, WinRAR or any other similar program. You should see a few folders and a whole bunch of files.

    [IMG]https://i16.photobucke*****m/albums/b14/Exorince/Minecraft/Tutorials/391406d7.jpg[/IMG]

    [IMG]https://i16.photobucke*****m/albums/b14/Exorince/Minecraft/Tutorials/f8c4c02a.jpg[/IMG]

    ----------------------------------------------------------------------------------->


    Before you go any further you should create a directory where you'd like to keep all of your Minecraft-modding-related files and folders. Mine is D:\Games\Minecraft I suggest you choose a similar location.

    In this folder you've created you should also create a few folders:

    [*:3mwgtywl]Data Files
    [*:3mwgtywl]Resources
    [*:3mwgtywl]Projects
    [*:3mwgtywl]Mods

    Data Files: This is where you will store all of the original Minecraft data files.

    Resources: Here you keep all texture resources, code examples and other things that you might need when creating a mod.

    Projects: Here you will keep all of your modding projects, in subfolders of their own.

    Mods: Here you can keep downloaded mods and texture packs for Minecraft, created by others. Not a necessary folder by any means but I think it's nice to have it all in one place.

    ----------------------------------------------------------------------------------->


    Now we can continue. So start by extracting every single file from the minecraft.jar file you opened earlier into the new Minecraft\Data Files folder you created.

    [censored]... that's a lot of files.

    DON'T PANIC

    [IMG]https://i16.photobucke*****m/albums/b14/Exorince/Minecraft/Tutorials/d78a7727.jpg[/IMG]

    The .class files are Java Class files, these files contain the raw code that Minecraft runs on.



    Congratulations! You now have a proper Minecraft modding workspace on your computer and you're ready to dive into the world of MC modding!


    ----------------------------------------------------------------------------------->

    2. Creating a texture mod


    Creating a texture pack, the easiest Minecraft mod you will ever create. However... it may be a bit intimidating for people who are new to modding. So I'm going to break it down for you in to 3 easy steps.


    Step 1. Finding the files you need

    Let's go ahead and open our newly created Data Files folder.

    The only files you need to worry about at this point are the textures files, in other words the files ending with .png and .gif

    Here is a list of the most important ones and what they do.

    [*:3mwgtywl]particles.png <-- The in-game particle effects (explosions, etc)
    [*:3mwgtywl]terrain.png <-- The main texture file for the environment, this is the most important texture in this guide.


    [*:3mwgtywl]armor\chain_1.png <-- Armour textures, pretty self-explanatory I think.
    [*:3mwgtywl]armor\chain_2.png
    [*:3mwgtywl]armor\cloth_1.png
    [*:3mwgtywl]armor\cloth_2.png
    [*:3mwgtywl]armor\diamond_1.png
    [*:3mwgtywl]armor\diamond_2.png
    [*:3mwgtywl]armor\gold_1.png
    [*:3mwgtywl]armor\gold_2.png
    [*:3mwgtywl]armor\iron_1.png
    [*:3mwgtywl]armor\iron_2.png


    [*:3mwgtywl]art\kz.png <-- The paintings you can create in-game.


    [*:3mwgtywl]environment\clouds.png <-- Cloud textures. The file may look 'empty' to you but that's just because it's a transparent PNG file and the clouds are white.
    [*:3mwgtywl]environment\rain.png <-- Rain texture
    [*:3mwgtywl]environment\snow.png <-- Snow Texture


    [*:3mwgtywl]font\default.png <-- The default font


    [*:3mwgtywl]gui\background.png <-- The main menu background
    [*:3mwgtywl]gui\container.png <-- Container texture
    [*:3mwgtywl]gui\crafting.png <-- Crafting window
    [*:3mwgtywl]gui\furnace.png <-- Furnace window
    [*:3mwgtywl]gui\gui.png <-- GUI
    [*:3mwgtywl]gui\icons.png <-- GUI elements (health, armor, etc)
    [*:3mwgtywl]gui\inventory.png <-- Your inventory window
    [*:3mwgtywl]gui\items.png <-- The icons for all items you can pick up
    [*:3mwgtywl]gui\unknown_pack.png <-- A default image for texture packs that don't have a pack.png file.


    [*:3mwgtywl]item\arrows.png <-- Arrow texture
    [*:3mwgtywl]item\boat.png <-- Boat Texture
    [*:3mwgtywl]item\cart.png <-- Cart texture
    [*:3mwgtywl]item\door.png <-- Door texture
    [*:3mwgtywl]item\sign.png <-- Sign texture


    [*:3mwgtywl]misc\dial.png <-- The 'watch' texture
    [*:3mwgtywl]misc\foliagecolor.png <-- A gradient texture file applied as an overlay on the tree leave texture found in terrain.png. This is what causes trees to change colour in different biomes.
    [*:3mwgtywl]misc\grasscolor.png <-- A gradient texture file applied as an overlay on the grass texture found in terrain.png. This is what causes grass to change colour in different biomes.
    [*:3mwgtywl]misc\pumpkinblur.png <-- An on-screen overlay that is applied when the pumpkin helmet is equipped.


    [*:3mwgtywl]mob\char.png <-- The default character texture
    [*:3mwgtywl]mob\chicken.png <-- Monster textures, self-explanatory.
    [*:3mwgtywl]mob\cow.png
    [*:3mwgtywl]mob\creeper.png
    [*:3mwgtywl]mob\ghast.png
    [*:3mwgtywl]mob\ghast_fire.png
    [*:3mwgtywl]mob\pig.png
    [*:3mwgtywl]mob\pigman.png
    [*:3mwgtywl]mob\pigzombie.png
    [*:3mwgtywl]mob\saddle.png
    [*:3mwgtywl]mob\sheep.png
    [*:3mwgtywl]mob\sheep_fur.png
    [*:3mwgtywl]mob\skeleton.png
    [*:3mwgtywl]mob\slime.png
    [*:3mwgtywl]mob\spider.png
    [*:3mwgtywl]mob\spider_eyes.png <-- New texture for the spider eyes, possibly a glow-map.
    [*:3mwgtywl]mob\zombie.png


    [*:3mwgtywl]terrain\moon.png <-- Moon texture
    [*:3mwgtywl]terrain\sun.png <-- Sun texture




    OK, not so scary now eh? The file structure Minecraft uses is very simple and easy to work with.

    So go into your Project folder and create a new folder called MyFirstMod
    Now go back into the Data Files folder, locate the texture files you want to edit and COPY them to MyFirstMod


    Step 2. Modifying the files

    I'm not going to go into detail in this section because it's entirely up to the artist how he modifies these files.

    Basically, these are image files, they can be opened by any image viewer and any image editor. You can open them up in Paint and modify them but I don't recommend it.

    I suggest you get Photoshop, Photoshop Elements (A cheaper version of photoshop, has most of the important features though), GIMP or Paint.net

    You open the files you want to edit in your image editor and modify it in any way you want.

    There are two types of files that you need to understand how they work. The first is terrain.png. It's a 32 bit .png file and it's split into 16 lines with 16 squares in each line. Each square represents a particular texture in-game.

    The file can be resized if you want to but it has to be in the power of 2. So the 256x256 (which is a 16x16 texture, since each square is 16 pixels * 16 pixels) can be resized to... 2048x2048 for example, where each square is 128x128.

    Texture packs are usually 16^2, 32^2. 64^2, 128^2 or 256^2 and if you are going to create a texture larger than 16^2 you need to resize the entire file accordingly. It's easiest to use 16 * n where n is the individual texture size you want.

    The second file type is basically any other texture than terrain.png. Those textures don't have squares in them, they only correspond to one element in-game. But the same rules still apply, they need to be a ^2 texture.

    Remember that only .png supports transparency! Saving a file as .jpg or any other format will a) Remove all transparency will not work in-game.

    Now save the files you edited in the MyFirstMod folder. Never save them in your Data Files folder as that will overwrite the original file, and you don't want that.

    Congratulations! You've created your first Minecraft mod!


    3. Working with .class files


    Step 1. Decompiling

    Get the required software: Java DecompilerJD | Java Decompiler

    Open up JD (Java Decompiler) after you've extracted the archive you downloaded.

    Go to File -> Open File... and navigate to your Minecraft\Data Files directory. Now open the class file you want to edit.
    [IMG]https://i16.photobucke*****m/albums/b14/Exorince/Minecraft/Tutorials/1ee6fdb3.jpg[/IMG]

    Now you have the class file loaded and you can see that on the left you have every single class file in your Data Files directory. Now you can go to File -> Save Source and save the opened class file as a .java file which can then be edited in any Code Editor for Java.

    You can even go to File -> Save all sources to decompile all the class files at once.


    Step 2. Compiling


    First go and download the Java Development Kit (Java SE Downloads - Sun Developer Network (SDN))

    Now open up the command prompt and navigate to the location or your .java file. Then type in
    Code:
    javac filename.java
    If you get an error you probably need to set your CLASSPATH to include the java directory. I'm not going to go into detail on this because messing with global system variables on your computer is not a good idea if you don't know what you doing. Use Google if you're determined to change it.

    ----------------------------------------------------------------------------------->



    That's it for now! Hope you learned something from this guide. If you have any questions just post them here and I'll try to answer them as fast as possible.

  2. #2
    xACIDx's Avatar
    Join Date
    May 2011
    Gender
    male
    Posts
    3
    Reputation
    9
    Thanks
    6
    My Mood
    Bitchy
    Good Tut, helped me some what.

  3. The Following User Says Thank You to xACIDx For This Useful Post:

    D.N.A (06-05-2011)