- The quick and easy guide to modding Modding isn't easy, but I'll make it easier
I will not be updating or adding more tutorials. However, it is likely that if the tutorial is only a few versions outdated it will likely work the same, if not, you will only need to make some small changes. If you would like to, you can write a tutorial for me, and I will add it here in one of the reserved spots(Giving credit to you of coarse), or, I will add a link in the contents to your post with the tutorial. Please message me if you create a tutorial.
So, I realize that there are other tutorials out there, but i've noticed they often drag things out, or they sum it up too much. My goal is to write a tutorial that is efficient, and explains things as simply and quickly as possible, saving everyone time. This is currently basically something that gets you started and then gives you references to where you can go to progress, and take the next steps, however, this may eventually change, and I may add my own advanced tutorials. I have helped out many friends with modding, and I figured, I'll just make a tutorial I can put them on instead. I plan to make a youtube video tutorial of this when I get around to it, because seeing things always works better.
Setting Up MCP
The first thing you need to do is set up MCP. This section is only for windows, however the rest of the tutorial your computer will not matter. Now, i want you to follow these steps:
Goto start, and right click on My Computer. Then click properties. Then advanced computer settings
Click environmental variables
Is there a Path variable at the top? As the value does it say "C:\Program Files\Java\jdk1.6.0_24\bin", or something similar??? If it does, then you can skip the rest of this. If you don't have that as the value, or you don't have the Path thing at all, then continue.
Open your web browser, and download jdk SE. Do not download jdk EE
Once that downloads, and is set up, open C:\Program Files(may have x86)\java\jdk1.6.0_24\bin, if the location is slightly different that is OK, that is why we are doing this, to make sure we have the right location. You should see a bunch of exe files. Right click on any one of them, and click properties, then copy the location.
Navigate back to environmental variables(the first 2 steps)
Click new, type "Path" (the capitalization matters) as the name
Paste the location as the value.
You are now completely finished setting up JDK
If you wish to make sure you did this properly, search CMD, and open CMD.exe, and type in javac, push enter. If it gives you an error, then you did something wrong, if it gives you a long list of commands then, CONGRATS!!!
We now have jdk, which is important for all java programming, but we don't actually have MCP, this part should be quite quick.
Now once you get the zip to open up, extract this to a new folder on your desktop called MCP (well it doesn't have to be on your desktop, or called MCP, I just suggest it). You should have several folders, and several bats.
You need to put minecraft's files into this so that MCP can decompile minecraft. To do this follow these steps:
Open my computer
Type in %appdata% in the address bar. You could also do this by searching run, which will open a window, in which you type %appdata%.
Open .minecraft
Now it is important that you have an unmodded version of minecraft. If it is modded, simply cut your current .minecraft folder onto your desktop, and run your minecraft.exe. Then go back to this file, and copy the "bin" and "resources" folders.
Now, open up your MPC folder, and open the "jars" folder
Add your bin and resources folder to this location.
Get a clean unmodded minecraft_server.jar, and put it in this location as well.
Run decompile.bat
If this works right, you shouldn't get any errors, except maybe one. If you get an error it should say something about hunks 2 out of 2 failing. It doesn't change anything, just ignore it. But there is one thing I want you to do. I want you to go through the entire process without a mod in it. Just as a test. So run these bats in this order:
1. Decompile
2. Recompile
3. startclient
4. Reobfuscate
Then check to see if you have some files in your reobf folder. If you do, then everything works.
The last thing we need it a text editor. Notepad would work, however, it is much better to have one that is designed for coding. I suggest notepad++, however, you can also use programs like eclipse. You should be able to download one of these programs by yourself.
Allright, well, you have now finished setting up, however you may have had problems, I will list those in the next section.
Setup problems :sad.gif:
If you followed my tutorial you should have everything correct, there is only 1 thing that may be incorrect that is not your fault. And that is .NET framework. I have an older computer, and it didn't have .NET framework, but most people have newer computers so they never mention this in most tutorials.
So, if you are ABSOLUTELY POSITIVE, that you did every single step of my tutorial correctly, you need to google ".NET framework 2.0", and 4.0" I do not know for sure if you need both, but I downloaded both, so if someone would comment telling me if it's necessary, i'd be grateful.
If your problem still insists, delete MCP, and re-instal following my steps.
Reporting probmems - Please read before reporting one
It's likely you'll run into a problem with your code. Work with it a little yourself first. If you can' figure it out that is fine. I want two things from you though. I want your code for your block (only the code that is error-ed, if the command prompt gives you an error in the block class, only give me your blocks lines of code from that class.) I also want the full error report.
To copy the error report do this while in the black window:
1. Right click
2. Select the "select all" option
3. Push enter
4. Paste in your report
Thank you for reading this, it saves us both time.
Suggested Tutorials:
I took the time to list some of my favorite tutorials here, I would suggest you take them in this order, after taking mine.
== MCP v3.3 ==[14:59] java.lang.NoClassDefFoundError: Start[14:59] Caused by: java.lang.ClassNotFoundException: Start[14:59] at java.net.URLClassLoader$1.run(Unknown Source)[14:59] at java.security.AccessController.doPrivileged(Native Method)[14:59] at java.net.URLClassLoader.findClass(Unknown Source)[14:59] at java.lang.ClassLoader.loadClass(Unknown Source)[14:59] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)[14:59] at java.lang.ClassLoader.loadClass(Unknown Source)[14:59] Could not find the main class: Start. Program will exit.[14:59] Exception in thread "main"java.lang.NoClassDefFoundError: StartCaused by: java.lang.ClassNotFoundException: Startat java.net.URLClassLoader$1.run(Unknown Source)at java.security.AccessController.doPrivileged(Native Method)at java.net.URLClassLoader.findClass(Unknown Source)at java.lang.ClassLoader.loadClass(Unknown Source)at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)at java.lang.ClassLoader.loadClass(Unknown Source)Could not find the main class: Start. Program will exit.Exception in thread "main"Press any key to continue . . .
You had an error in recompilation. Startclient, and reobfuscate will not work if recompile.bat has not been ran, with no errors.
In reobfuscate
== MCP v3.3 ==
== Reobfuscating client ==
!! Can not find client bins !!
== Reobfuscating server ==
> Gathering md5 checksums> Compacting server bin directory> Reobfuscating server jar> Extracting modified classes
Press any key to continue . . .
You had an error in recompilation. Startclient, and reobfuscate will not work if recompile.bat has not been ran, with no errors.
Errors in:
Decompile:
-jdk set up incorrectly
-Put incorrect files in the jars folder
-You put in minecraft files for a version not supported by your version of MCP
-Problem with MCP download
-Need .netFramework (I mention this somewhere else on this post, old computers)
Recompile:
-Error in code
-I suppose it's possible you could have a problem with MCP
-Failed Decompilation
-Need .netFramework(Old computers)
Startclient:
-Problem with recompile
-Problem with MCP
-Need .netFramework(Old computers)
Reobfuscate:
-Problem with recompile
-Problem with MCP
-Need .netFramework(Old computers)
Errors in syntax:
Most lines will end in a ; Certain lines like if, and for don't(The have a {} instead). If you get an error about expecting an end of line, find the line number, and class(shown in the error report) and add a ; on the end.
Everything is case sensitive!!!
Public class BlockWhateverBlock should be delcared in a file called BlockWhateverBlock.java
You need to name the file the exact same thing you named the class. (For modloader it would be mod_something) Back to top
Support:
Well hopefully some of you awesome folks our there will help my mod get a little more popular, by adding my banner to your sig!
Making a video game mod for minecraft. Going great. The idea? blocks when clicked open up a minigame that rewards you with ores and such based on your ingame score. Almost finished with beta version, which features a very basic pong game.
Basic Modding
In this tutorial we are going to make... Super Block!!! It is basically a block that glows to the maximum, is partially transparent, and it has an odd property. It tends to make to accelerate to unbelievable speeds. Warning, this will not be modloader compatible, that is in the next tutorial. Doing it this way does make it easier to understand though.
We will do all of these these things:
-Make a block (OMG really??? WOW!!! THAT'S JUST AMAZING!!!)
-Make that block have customized properties (hardness, light value)
-Make a texture for that block
-Make an ingame name for that block
-And make it accelerate you.
-Make a recipe for this block.
So, lets start with... making the block, since we can't do anything without making it. You should have decompiled minecraft by now. So, you now have the source code. Do these steps:
-Open your text editor
-Click open file
-Navigate to MCP\src\minecraft\net\minecraft\src
-You should see several .java class files.
-Open BlockDirt.java
Now, lets have a peek at it's code. I have inserted comments to briefly explain each line.
package net.minecraft.src; \\This just says where this is located
public class BlockDirt extends Block \\this tells the computer what this program does, and things as such
{ \\public says this can be seen by all other classes
\\and extends Block just says that we are going to be part of the
\\block class
protected BlockDirt(int i, int j) \\int i, is the item ID, and int j, is the picture location...
{
super(i, j, Material.ground); \\Super just says look at the class we extend
}
}
That isn't that bad, only 15 lines. You probably don't understand this, THAT IS FINE!!! I will explain later.
So, what you need to do, is create your own class. So, in your text editor, click new. Then paste this. We do of coarse have to make some changes.
Just change anything that says dirt, to whatever you want our block to be called. I'll change it to super block. This is what it should look like when your done.
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
public class BlockSuperBlock extends Block
{
protected BlockSuperBlock(int i, int j)
{
super(i, j, Material.ground);
}
}
Not to hard ;p
Now, how the nether are we supposed to change it's properties? Well, since it extends Block.java, lets look there. Open up Block.java with your text editor. Wow this one is a lot bigger than dirt... Ignore most of it. Block contains most of the code you need for a block, and that way we can just make blocks that use Block.java's code, instead of having to re-type the code for each block.
So, scroll down until you see several lines that look like this:
public static final Block dirt;
It looks like all the other blocks do that same thing, so lets make ours say that.
Add this to the bottum of the list:
public static final Block SuperBlock;
You don't really need to know what that means, just know that it tells the computer, hey this block exists, and it has certain java properties(like the ones in blockdirt.java).
Now, we still don't know how to change the blocks properties... *scrolls down some more*, well look at this, this looks like the right spot! Scroll down until you see this type code, I just picked dirt, because that is what be based Super Block's class off of.
dirt = (new BlockDirt(3, 2)).setHardness(0.5F).setStepSound(soundGravelFootstep).setBlockName("dirt");
Well lets add our block to the bottum of the list. Lets copy and paste that.
So first we need to change dirt, and BlockDirt, to SuperBlock, and BlockSuperBlock.
What are those 2 numbers, (3, 2)? Well those are variables, and int means they are integers. That means whole numbers. Right there we are saying "int i=3", and "int j=2".
int i is the blocks ID number, and no blocks can have the same ID number, so scroll to the bottum, and you'll see the highest ID number is 95. Well, we could make ours 96, but lets make it 100 just in case. Now, the second one is the texture location.
int j is the blocks location on the texture. If you have ever open terrain.png, then you know what it looks like. If not, have a peek at this pict, warning this is not exactly what yours should look like, this is an older version, and does not have all blocks:
The top left square is 0, the one right of it is 1, and the next 2, and so on. That number is what you use as int j.
Open MCP\temp\bin, and find the file "terrain.png". You can edit this image to include your own texture. Just open this up with a image editor (NOT PAINT), and find an empty spot. I found spot 39, right next to bleeding obsidian(the wierd block next to obsidian). I chose that one, cause it was the first empty spot, so I didn't have to count as far. (If you don't edit this u'll have a pink block...) You'll have to put the same new edited PNG in MCP\jars\bin\minecraft.jar
Now, what's left? All of these ".setSomething()" things. Well feal free to edit these... After looking at the torches code you will find ".setLightValue()". Add that in, and set it to (1.0F). Now our block glows. Lets also add in the transparency, ".setLightOpacity()"The acceration property is NOT on one of these things though. Your code for this line should look something like this when you are done(things like hardness and sound can be different, I don't care)
SuperBlock = (new BlockSuperBlock(100, 39)).setHardness(1.5F).setLightValue(1.0F).setLightOpacity(3).setStepSound(soundGravelFootstep).setBlockName("SuperBlock");
We're gonna look at ice's code...
So after looking at ice's code you see 1 thing, well only 1 thing that matters...
slipperiness = 0.98F;
Now, how come we want that? I took birjolaxew's tutorial a bit ago, and I, being me decided to make this block super slippery, and I set it to 1.5F; Well, when I went to test... I suddenly wasn't on the block anymore. It accelerated me at very high rates. 1.5F is great, if you want to test that, but we're going to amp it up(well down, but the effect is up), and set it to 0.1F. This is Super Block After all.
And now lets test... but how do we get it? We add a recipe. If you open craftingmanager.java, you will find that there is a list of things like this:
addRecipe(new ItemStack(Item.paper, 3), new Object[] {
"###", Character.valueOf('#'), Item.reed
});
Let me explain this. addRecipe, and ItemStack are self explanitary. (Item.paper, 3) is what you get from this recipe, and how much. In this case you get 3 paper. We need to change that too (Block.SuperBlock, 16), we are only testing right now, so I set it to 16. The next part is the recipe itself.
Each set of "" is 1 row in the workbench. So if I have "x" then that means I need 1 of whatever we set x to. If I have "xxx", "xxx", "xxx", that would mean, it requires 9 of x. Lets set it to "x" for now. Next we are saying, when we see the x in the recipe, I am talking about this item.
Character.valueOf('x'), <your block or item>.
We will change that to Block.dirt. Again this is testing only.
Your recipe should look like this:
addRecipe(new ItemStack(Block.SuperBlock, 16), new Object[] {
"x", Character.valueOf('x'), Block.dirt
});
And now, after all this, we finally get to test our product. *You excitedly run recompile.bat, and then startclient.bat* you gather 4 dirt, get 64 Super Block, and... It works!!! Hopefully. You may get some errors during recompilation, that is fine, it just means you need to fix some of your code.
Yes!!! But how do we put this on our original minecraft? We have to obfuscate it. Now, if you actaully read the readme you would know how to do this, but if your like most of the population of this world, then you problably didn't. I'll explain it here.
The process:
Open MCP\conf
:smile.gif: open client_obfuscation.txt
:biggrin.gif: Delete whatever words are inside of it
Put in the names of all the java files you edited, and want obfuscated. (don't put the .java on the end)
The newest MCP just detects to see which files have been edited.
Run reobfuscate.bat
Open MCP\reobf
Open minecraft
There are your obfuscated files.
Yay, everything seems right... except how does the rest of the world know the name of this block? It doesn't show it in game! This is a disaster! Our block is a nameless failure. But wait, the smart guy writing this tutorial might have the answer! Shockingly I do have the answer the this apocalyptic problem.
Open: C:\Documents and Settings\Owner\Desktop\MCP\temp\minecraft\lang
Then edit: en_US.lang using notepad++
Scroll down until you see this format of wording:
tile.dirt.name=Dirt
tile.dirt.desc=
Well that would appear to be naming our block, and... adding a description? Well, I guess that hasn't been implemented. So, lets just copy that for our block, and put it at the top of the list. Now save and run the game.
And remember to rate it 1-10 diamonds so the world knows what you think about this.
Rollback Post to RevisionRollBack
Making a video game mod for minecraft. Going great. The idea? blocks when clicked open up a minigame that rewards you with ores and such based on your ingame score. Almost finished with beta version, which features a very basic pong game.
Our block is awesome! But... Well it's not modloader compatible... THIS IS WORSE THAN WHEN OUR BLOCK WAS NAMELESS!!! This is truly the apocalypse... Or we could just make it modloader compatible...
If its modloader compatible, how would we make it run without modloader?
So, do you remember how we needed an un-modded minecraft for MCP? The one you put in the jars folder? Well we are now going to mod it...
So do these steps:
Download ModLoader Open it with winrar
Open MCP\jars\bin then open minecraft.jar with winrar
Drag modloaders class files into minecraft.jar
Thats all you have to do.
Now on to the coding!
Well we can't edit any of minecraft's default classes if this is gonna be compatible with other mods.
So, we edited block.java, and craftingmanager.java. Well, lets start with block.java.
So, right now this is our code:
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
public class BlockSuperBlock extends Block
{
protected BlockSuperBlock(int i, int j)
{
super(i, j, Material.ground);
slipperiness = 0.1F;
}
}
Well, we are going to add all of our code to this class, and change a few things... This is what the code needs to look like:
package net.minecraft.src;
public class mod_OurMods extends BaseMod //Note It extends basemod (part of modloader) not block
{
public static final Block SuperBlock; //Static? Thats new, just go with it okay?
static
{
SuperBlock = (new Block(100, ModLoader.addOverride("/terrain.png", "/yournewfolder/SuperBlock.png"), Material.rock)).setHardness(1.5F).setLightValue(1.0F).setStepSound(Block.soundGravelFootstep).setBlockName("SuperBlock");
} //Those are the properties, should be familiar
public mod_OurMods()
{
ModLoader.AddName(SuperBlock, "Super Block"); //This is setting the ingame hover name.
ModLoader.RegisterBlock(SuperBlock); //Don't question, just do
ModLoader.AddRecipe(new ItemStack(SuperBlock, 1), new Object[] {
"x", Character.valueOf('x'), Block.dirt
}); //That should look familiar, it's the recipe
}
public String Version()
{
return "1.5_01";
}
}
Well, there you have it. if you read the comments you should understand it pretty well. Thats how easy it is to make it modloader compatible. There is only a few things u'll have to do to make this work. First you have to remove the code you made allready from block, and crafting manger. Second you have to rename your file mod_SuperBlock.java. Third... Look at this code:
SuperBlock = (new BlockSuperBlock(100, ModLoader.addOverride("/terrain.png", "/yournewfolder/SuperBlock.png")
That is different isn't it...Everything is the same actually, except the image. See, we can't put our blocks image on the terrain.png. So we have to create a new png just for this block. You will have to create a new folder in MCP\temp\bin\minecraft. Call it whatever you want(most people call it their forum name, for example, I would call it Mr. Hobo), but whatever you do call it, change "/yournewfolder" into "/whateveryoucallit" Then make a 16x16 pixle PNG for your block. Put that in your folder, call it SuperBlock.png (or change the code where it says /SuperBlock.png, to whatever the blocks img file is called.) Also add the same exact folder to your MCP\jars\bin\minecraft.jar
Now, run startclient.bat. And guess what it works!!! (Assuming you didn't make any mistakes)
To finish this block all you have to do is reobfuscate it.
Pretty simple, just run reobfuscate.bat, then look in the reobf folder. If there is more than 1 class, you must have edited some of the other java classes. Thats ok, just don't give people those classes. The only class we want is: mod_SuperBlock.class
Putting that class in a minecraft.jar in %appdata%\.minecraft\bin will make minecraft have that mod. You will also have you copy your folder with the PNG. You probably shouldn't release this on the forum, because, it's a super basic mod, and it'd just cloud it up. Lets add to it first.
But wait, Huston we have a problem! Our block doesn't accelerate us!
Well, lets get started. The apocalypse will have to wait for another day, we'll fix it real quick and easy. The first thing we are going to have to change is we are going to have to make this stop looking at rock when making this block. That probably doesn't make sense, so let me clarify. We added "Material.rock" after the item ID, and PNG location. We need to remove that. Then, where it says
SuperBlock = (new Block(
change it to
SuperBlock = (new SuperBlock(
Now we have to create a custom class for our block. This should be simple and easy, we've done it before. Just make it the same way we made it before we made it modloader compatible.
package net.minecraft.src;
public class SuperBlock extends Block
{
protected SuperBlock(int i, int j)
{
super(i, j, Material.rock);
}
}
Well now it should run and compile fine. If not, please check the FAQ before posting in the forum. So it works, but do you understand why we have 2 classes? We have 2 classes, because that first class is our mods main class. We can introduce several more blocks from that exact same class. But to customize the block we have to make it's own class. Now if you simply wanted to add, say, stone. But this stone looks different, because maybe you can only find it in a new dimension your mod adds similar to the nether. In that case you don't have to add a second class, and you can just keep those old settings, "Material.rock" and "(new Block("
One more thing, the other day I found a mod someone made, and they actually put my name in the credits for teaching them how to mod. I loved that(not just my name in the credits, but seeing the results of my tutorial). I've found another mod made by one of the first people to take my tutorials. But the point is, if you make a downloadable mod, and u learned from my tutorial, please tell me, so I can check it out, and I'll add a new section to this forum that links to all the mod pages made by people who took my tutorial.
Rollback Post to RevisionRollBack
Making a video game mod for minecraft. Going great. The idea? blocks when clicked open up a minigame that rewards you with ores and such based on your ingame score. Almost finished with beta version, which features a very basic pong game.
WARNING: I am still writing this tutorial, you will find a dead end on this unfinished tutorial. Also, I mention and FAQ, that is something I desperately need to make, I just haven't yet.
Please realize I just barely wrote this tutorial. I'm sure it will have a problem somewhere. Just post it in the forum if you find one, and I'll fix it.
Well, we are here now, moving on to TOOLS!!! Well this is going to be a longer tutorial.
Lets have a peek at what we need to do:
-New Ore
-Making the Ore generate naturally
-New Item dropped by our ore -I'll come back and do that after I finish most of the first part.
-Making the Ore smeltable
-Making the Tools
-Making the Sword, bow, and arrows
-Making a new tool
Allright lets get started. Hm.. New ore. Well you know how to make a block by now, make one for our ore! I'm just gonna call it Emerald Ore, and make it fast as diamond, and gold and almost as long lasting as diamond. But at this point, that doesn't matter.
SAVE THIS AS mod_OurMods.java
package net.minecraft.src;
import java.util.Random;
public class mod_OurMods extends BaseMod
{
public static final Block EmeraldOre;
static
{
EmeraldOre = (new EmeraldOre(110, ModLoader.addOverride("/terrain.png", "/MrHobo/EmeraldOre.png"))).setHardness(10.0F).setResistance(3.0F).setStepSound(Block.soundStoneFootstep).setBlockName("EmeraldOre");
ModLoader.RegisterBlock(EmeraldOre);
}
public mod_OurMods()
{
ModLoader.AddName(EmeraldOre, "Emerald Ore"); //Would only possible to get in inventory using world edit...
}
public void GenerateEmeraldOre(World world, Random rand, int chunkX, int chunkZ){ //Here comes the gen
for (int i = 0; i < 64; i++) //How many times the process is repeated, up to 64 of this block
{
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(4);
int randPosZ = chunkZ + rand.nextInt(16);
(new WorldGenMinable(EmeraldOre.blockID, 8)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
public String Version()
{
return "1.5_01 Our tutorial mod!!! Put whatever you want here, this is what comes up on errors";
}
}
And this is BlockEmeraldOre.java:
package net.minecraft.src;
public class Lyrium extends Block
{
protected Lyrium(int i, int j)
{
super(i, j, Material.rock);
}
}
Coming soon.
Rollback Post to RevisionRollBack
Making a video game mod for minecraft. Going great. The idea? blocks when clicked open up a minigame that rewards you with ores and such based on your ingame score. Almost finished with beta version, which features a very basic pong game.
Making a video game mod for minecraft. Going great. The idea? blocks when clicked open up a minigame that rewards you with ores and such based on your ingame score. Almost finished with beta version, which features a very basic pong game.
Making a video game mod for minecraft. Going great. The idea? blocks when clicked open up a minigame that rewards you with ores and such based on your ingame score. Almost finished with beta version, which features a very basic pong game.
This is the best tutorial EVER! Birj and Simo have good ones, but theirs drags out way to long. i mean like Birj has like 8 pages just to make what this one does.
Thanks m8, i'm glad you liked it. I might end up re-reading it and shortening some parts.
But, yeah, thanks for rating it in diamonds like I asked as well.
I will have modloader compatibility up soon, but it will be a really short tutorial compared to the other one, but that's a good thing :wink.gif:, it's not hard, you just have to put stuff in different places.
Rollback Post to RevisionRollBack
Making a video game mod for minecraft. Going great. The idea? blocks when clicked open up a minigame that rewards you with ores and such based on your ingame score. Almost finished with beta version, which features a very basic pong game.
Making a video game mod for minecraft. Going great. The idea? blocks when clicked open up a minigame that rewards you with ores and such based on your ingame score. Almost finished with beta version, which features a very basic pong game.
Great thanks :wink.gif: your rating put my average higher than 10 :wink.gif:.
Rollback Post to RevisionRollBack
Making a video game mod for minecraft. Going great. The idea? blocks when clicked open up a minigame that rewards you with ores and such based on your ingame score. Almost finished with beta version, which features a very basic pong game.
ANd try googling "Java Programming Tutorial -1- Setting up JDK by thenewboston.
It's good, and btw, did you just copy and paste my location for the C\program files\ stfufF? Because you probably have like Program Files x84 or whatever.
Rollback Post to RevisionRollBack
Making a video game mod for minecraft. Going great. The idea? blocks when clicked open up a minigame that rewards you with ores and such based on your ingame score. Almost finished with beta version, which features a very basic pong game.
i got the game running and everything but...
my block (commong block) wouldnt work
its is crafted like this
i put the java files and every thing but its fine ill just stick to making texture packs
I suggest for testing purposes you simply set it to:
Then change the recipe. Tell me if that doesn't work.
Also, the person with JDK problems, did you do this: try googling "Java Programming Tutorial -1- Setting up JDK by thenewboston." It's on youtube
Rollback Post to RevisionRollBack
Making a video game mod for minecraft. Going great. The idea? blocks when clicked open up a minigame that rewards you with ores and such based on your ingame score. Almost finished with beta version, which features a very basic pong game.
The quick and easy guide to modding
Modding isn't easy, but I'll make it easier
I will not be updating or adding more tutorials. However, it is likely that if the tutorial is only a few versions outdated it will likely work the same, if not, you will only need to make some small changes. If you would like to, you can write a tutorial for me, and I will add it here in one of the reserved spots(Giving credit to you of coarse), or, I will add a link in the contents to your post with the tutorial. Please message me if you create a tutorial.
So, I realize that there are other tutorials out there, but i've noticed they often drag things out, or they sum it up too much. My goal is to write a tutorial that is efficient, and explains things as simply and quickly as possible, saving everyone time. This is currently basically something that gets you started and then gives you references to where you can go to progress, and take the next steps, however, this may eventually change, and I may add my own advanced tutorials. I have helped out many friends with modding, and I figured, I'll just make a tutorial I can put them on instead. I plan to make a youtube video tutorial of this when I get around to it, because seeing things always works better.
Table of contents:
Setting Up
Set up problems
Reporting ProblemsSuggested Tutorials
Basic Modding
ModLoader Compatibility
FAQ
SUPPORT
Setting Up MCP
The first thing you need to do is set up MCP. This section is only for windows, however the rest of the tutorial your computer will not matter. Now, i want you to follow these steps:
Goto start, and right click on My Computer. Then click properties. Then advanced computer settings
Click environmental variables
Is there a Path variable at the top? As the value does it say "C:\Program Files\Java\jdk1.6.0_24\bin", or something similar??? If it does, then you can skip the rest of this. If you don't have that as the value, or you don't have the Path thing at all, then continue.
Open your web browser, and download jdk SE. Do not download jdk EE
Once that downloads, and is set up, open C:\Program Files(may have x86)\java\jdk1.6.0_24\bin, if the location is slightly different that is OK, that is why we are doing this, to make sure we have the right location. You should see a bunch of exe files. Right click on any one of them, and click properties, then copy the location.
Navigate back to environmental variables(the first 2 steps)
Click new, type "Path" (the capitalization matters) as the name
Paste the location as the value.
You are now completely finished setting up JDK
If you wish to make sure you did this properly, search CMD, and open CMD.exe, and type in javac, push enter. If it gives you an error, then you did something wrong, if it gives you a long list of commands then, CONGRATS!!!
We now have jdk, which is important for all java programming, but we don't actually have MCP, this part should be quite quick.
Goto this link: http://mcp.ocean-labs.de/index.php/MCP_Releases
Download the newest version.
Now once you get the zip to open up, extract this to a new folder on your desktop called MCP (well it doesn't have to be on your desktop, or called MCP, I just suggest it). You should have several folders, and several bats.
You need to put minecraft's files into this so that MCP can decompile minecraft. To do this follow these steps:
Open my computer
Type in %appdata% in the address bar. You could also do this by searching run, which will open a window, in which you type %appdata%.
Open .minecraft
Now it is important that you have an unmodded version of minecraft. If it is modded, simply cut your current .minecraft folder onto your desktop, and run your minecraft.exe. Then go back to this file, and copy the "bin" and "resources" folders.
Now, open up your MPC folder, and open the "jars" folder
Add your bin and resources folder to this location.
Get a clean unmodded minecraft_server.jar, and put it in this location as well.
Run decompile.bat
If this works right, you shouldn't get any errors, except maybe one. If you get an error it should say something about hunks 2 out of 2 failing. It doesn't change anything, just ignore it. But there is one thing I want you to do. I want you to go through the entire process without a mod in it. Just as a test. So run these bats in this order:
1. Decompile
2. Recompile
3. startclient
4. Reobfuscate
Then check to see if you have some files in your reobf folder. If you do, then everything works.
The last thing we need it a text editor. Notepad would work, however, it is much better to have one that is designed for coding. I suggest notepad++, however, you can also use programs like eclipse. You should be able to download one of these programs by yourself.
Allright, well, you have now finished setting up, however you may have had problems, I will list those in the next section.
Back to top
Setup problems :sad.gif:
If you followed my tutorial you should have everything correct, there is only 1 thing that may be incorrect that is not your fault. And that is .NET framework. I have an older computer, and it didn't have .NET framework, but most people have newer computers so they never mention this in most tutorials.
So, if you are ABSOLUTELY POSITIVE, that you did every single step of my tutorial correctly, you need to google ".NET framework 2.0", and 4.0" I do not know for sure if you need both, but I downloaded both, so if someone would comment telling me if it's necessary, i'd be grateful.
If your problem still insists, delete MCP, and re-instal following my steps.
Back to top
Reporting probmems - Please read before reporting one
It's likely you'll run into a problem with your code. Work with it a little yourself first. If you can' figure it out that is fine. I want two things from you though. I want your code for your block (only the code that is error-ed, if the command prompt gives you an error in the block class, only give me your blocks lines of code from that class.) I also want the full error report.
To copy the error report do this while in the black window:
1. Right click
2. Select the "select all" option
3. Push enter
4. Paste in your report
Thank you for reading this, it saves us both time.
Suggested Tutorials:
I took the time to list some of my favorite tutorials here, I would suggest you take them in this order, after taking mine.
simo415's "Create custom world generation"
Back to topprowne's mob making tutorial
Will list more, just not right now.
FAQ
In startclient
You had an error in recompilation.
Startclient, and reobfuscate will not work if recompile.bat has not been ran, with no errors.
In reobfuscate
You had an error in recompilation.
Startclient, and reobfuscate will not work if recompile.bat has not been ran, with no errors.
Errors in:
Decompile:
-jdk set up incorrectly
-Put incorrect files in the jars folder
-You put in minecraft files for a version not supported by your version of MCP
-Problem with MCP download
-Need .netFramework (I mention this somewhere else on this post, old computers)
Recompile:
-Error in code
-I suppose it's possible you could have a problem with MCP
-Failed Decompilation
-Need .netFramework(Old computers)
Startclient:
-Problem with recompile
-Problem with MCP
-Need .netFramework(Old computers)
Reobfuscate:
-Problem with recompile
-Problem with MCP
-Need .netFramework(Old computers)
Errors in syntax:
Most lines will end in a ; Certain lines like if, and for don't(The have a {} instead). If you get an error about expecting an end of line, find the line number, and class(shown in the error report) and add a ; on the end.
Everything is case sensitive!!!
Public class BlockWhateverBlock should be delcared in a file called BlockWhateverBlock.java
You need to name the file the exact same thing you named the class. (For modloader it would be mod_something)
Back to top
Support:
Well hopefully some of you awesome folks our there will help my mod get a little more popular, by adding my banner to your sig!
Back to top
In this tutorial we are going to make... Super Block!!! It is basically a block that glows to the maximum, is partially transparent, and it has an odd property. It tends to make to accelerate to unbelievable speeds. Warning, this will not be modloader compatible, that is in the next tutorial. Doing it this way does make it easier to understand though.
We will do all of these these things:
-Make a block (OMG really??? WOW!!! THAT'S JUST AMAZING!!!)
-Make that block have customized properties (hardness, light value)
-Make a texture for that block
-Make an ingame name for that block
-And make it accelerate you.
-Make a recipe for this block.
So, lets start with... making the block, since we can't do anything without making it. You should have decompiled minecraft by now. So, you now have the source code. Do these steps:
-Open your text editor
-Click open file
-Navigate to MCP\src\minecraft\net\minecraft\src
-You should see several .java class files.
-Open BlockDirt.java
Now, lets have a peek at it's code. I have inserted comments to briefly explain each line.
That isn't that bad, only 15 lines. You probably don't understand this, THAT IS FINE!!! I will explain later.
So, what you need to do, is create your own class. So, in your text editor, click new. Then paste this. We do of coarse have to make some changes.
Just change anything that says dirt, to whatever you want our block to be called. I'll change it to super block. This is what it should look like when your done.
Not to hard ;p
Now, how the nether are we supposed to change it's properties? Well, since it extends Block.java, lets look there. Open up Block.java with your text editor. Wow this one is a lot bigger than dirt... Ignore most of it. Block contains most of the code you need for a block, and that way we can just make blocks that use Block.java's code, instead of having to re-type the code for each block.
So, scroll down until you see several lines that look like this:
It looks like all the other blocks do that same thing, so lets make ours say that.
Add this to the bottum of the list:
You don't really need to know what that means, just know that it tells the computer, hey this block exists, and it has certain java properties(like the ones in blockdirt.java).
Now, we still don't know how to change the blocks properties... *scrolls down some more*, well look at this, this looks like the right spot! Scroll down until you see this type code, I just picked dirt, because that is what be based Super Block's class off of.
Well lets add our block to the bottum of the list. Lets copy and paste that.
So first we need to change dirt, and BlockDirt, to SuperBlock, and BlockSuperBlock.
What are those 2 numbers, (3, 2)? Well those are variables, and int means they are integers. That means whole numbers. Right there we are saying "int i=3", and "int j=2".
int i is the blocks ID number, and no blocks can have the same ID number, so scroll to the bottum, and you'll see the highest ID number is 95. Well, we could make ours 96, but lets make it 100 just in case. Now, the second one is the texture location.
int j is the blocks location on the texture. If you have ever open terrain.png, then you know what it looks like. If not, have a peek at this pict, warning this is not exactly what yours should look like, this is an older version, and does not have all blocks:
The top left square is 0, the one right of it is 1, and the next 2, and so on. That number is what you use as int j.
Open MCP\temp\bin, and find the file "terrain.png". You can edit this image to include your own texture. Just open this up with a image editor (NOT PAINT), and find an empty spot. I found spot 39, right next to bleeding obsidian(the wierd block next to obsidian). I chose that one, cause it was the first empty spot, so I didn't have to count as far. (If you don't edit this u'll have a pink block...) You'll have to put the same new edited PNG in MCP\jars\bin\minecraft.jar
Now, what's left? All of these ".setSomething()" things. Well feal free to edit these... After looking at the torches code you will find ".setLightValue()". Add that in, and set it to (1.0F). Now our block glows. Lets also add in the transparency, ".setLightOpacity()"The acceration property is NOT on one of these things though. Your code for this line should look something like this when you are done(things like hardness and sound can be different, I don't care)
We're gonna look at ice's code...
So after looking at ice's code you see 1 thing, well only 1 thing that matters...
Now, how come we want that? I took birjolaxew's tutorial a bit ago, and I, being me decided to make this block super slippery, and I set it to 1.5F; Well, when I went to test... I suddenly wasn't on the block anymore. It accelerated me at very high rates. 1.5F is great, if you want to test that, but we're going to amp it up(well down, but the effect is up), and set it to 0.1F. This is Super Block After all.
And now lets test... but how do we get it? We add a recipe. If you open craftingmanager.java, you will find that there is a list of things like this:
Let me explain this. addRecipe, and ItemStack are self explanitary. (Item.paper, 3) is what you get from this recipe, and how much. In this case you get 3 paper. We need to change that too (Block.SuperBlock, 16), we are only testing right now, so I set it to 16. The next part is the recipe itself.
Each set of "" is 1 row in the workbench. So if I have "x" then that means I need 1 of whatever we set x to. If I have "xxx", "xxx", "xxx", that would mean, it requires 9 of x. Lets set it to "x" for now. Next we are saying, when we see the x in the recipe, I am talking about this item.
Character.valueOf('x'), <your block or item>.
We will change that to Block.dirt. Again this is testing only.
Your recipe should look like this:
And now, after all this, we finally get to test our product. *You excitedly run recompile.bat, and then startclient.bat* you gather 4 dirt, get 64 Super Block, and... It works!!! Hopefully. You may get some errors during recompilation, that is fine, it just means you need to fix some of your code.
Yes!!! But how do we put this on our original minecraft? We have to obfuscate it. Now, if you actaully read the readme you would know how to do this, but if your like most of the population of this world, then you problably didn't. I'll explain it here.
The process:
Open MCP\conf:smile.gif: open client_obfuscation.txt
:biggrin.gif: Delete whatever words are inside of it
Put in the names of all the java files you edited, and want obfuscated. (don't put the .java on the end)
The newest MCP just detects to see which files have been edited.
Run reobfuscate.bat
Open MCP\reobf
Open minecraft
There are your obfuscated files.
Yay, everything seems right... except how does the rest of the world know the name of this block? It doesn't show it in game! This is a disaster! Our block is a nameless failure. But wait, the smart guy writing this tutorial might have the answer! Shockingly I do have the answer the this apocalyptic problem.
Open: C:\Documents and Settings\Owner\Desktop\MCP\temp\minecraft\lang
Then edit: en_US.lang using notepad++
Scroll down until you see this format of wording:
Well that would appear to be naming our block, and... adding a description? Well, I guess that hasn't been implemented. So, lets just copy that for our block, and put it at the top of the list. Now save and run the game.
Here's a download for my code files, that does work.
Back to top
And remember to rate it 1-10 diamonds so the world knows what you think about this.
Our block is awesome! But... Well it's not modloader compatible... THIS IS WORSE THAN WHEN OUR BLOCK WAS NAMELESS!!! This is truly the apocalypse... Or we could just make it modloader compatible...
If its modloader compatible, how would we make it run without modloader?
So, do you remember how we needed an un-modded minecraft for MCP? The one you put in the jars folder? Well we are now going to mod it...
So do these steps:
Download ModLoader Open it with winrar
Open MCP\jars\bin then open minecraft.jar with winrar
Drag modloaders class files into minecraft.jar
Thats all you have to do.
Now on to the coding!
Well we can't edit any of minecraft's default classes if this is gonna be compatible with other mods.
So, we edited block.java, and craftingmanager.java. Well, lets start with block.java.
So, right now this is our code:
Well, we are going to add all of our code to this class, and change a few things... This is what the code needs to look like:
Well, there you have it. if you read the comments you should understand it pretty well. Thats how easy it is to make it modloader compatible. There is only a few things u'll have to do to make this work. First you have to remove the code you made allready from block, and crafting manger. Second you have to rename your file mod_SuperBlock.java. Third... Look at this code:
That is different isn't it...Everything is the same actually, except the image. See, we can't put our blocks image on the terrain.png. So we have to create a new png just for this block. You will have to create a new folder in MCP\temp\bin\minecraft. Call it whatever you want(most people call it their forum name, for example, I would call it Mr. Hobo), but whatever you do call it, change "/yournewfolder" into "/whateveryoucallit" Then make a 16x16 pixle PNG for your block. Put that in your folder, call it SuperBlock.png (or change the code where it says /SuperBlock.png, to whatever the blocks img file is called.) Also add the same exact folder to your MCP\jars\bin\minecraft.jar
Now, run startclient.bat. And guess what it works!!! (Assuming you didn't make any mistakes)
To finish this block all you have to do is reobfuscate it.
Pretty simple, just run reobfuscate.bat, then look in the reobf folder. If there is more than 1 class, you must have edited some of the other java classes. Thats ok, just don't give people those classes. The only class we want is: mod_SuperBlock.class
Putting that class in a minecraft.jar in %appdata%\.minecraft\bin will make minecraft have that mod. You will also have you copy your folder with the PNG. You probably shouldn't release this on the forum, because, it's a super basic mod, and it'd just cloud it up. Lets add to it first.
But wait, Huston we have a problem! Our block doesn't accelerate us!
Well, lets get started. The apocalypse will have to wait for another day, we'll fix it real quick and easy. The first thing we are going to have to change is we are going to have to make this stop looking at rock when making this block. That probably doesn't make sense, so let me clarify. We added "Material.rock" after the item ID, and PNG location. We need to remove that. Then, where it says
change it to
Now we have to create a custom class for our block. This should be simple and easy, we've done it before. Just make it the same way we made it before we made it modloader compatible.
Well now it should run and compile fine. If not, please check the FAQ before posting in the forum. So it works, but do you understand why we have 2 classes? We have 2 classes, because that first class is our mods main class. We can introduce several more blocks from that exact same class. But to customize the block we have to make it's own class. Now if you simply wanted to add, say, stone. But this stone looks different, because maybe you can only find it in a new dimension your mod adds similar to the nether. In that case you don't have to add a second class, and you can just keep those old settings, "Material.rock" and "(new Block("
One more thing, the other day I found a mod someone made, and they actually put my name in the credits for teaching them how to mod. I loved that(not just my name in the credits, but seeing the results of my tutorial). I've found another mod made by one of the first people to take my tutorials. But the point is, if you make a downloadable mod, and u learned from my tutorial, please tell me, so I can check it out, and I'll add a new section to this forum that links to all the mod pages made by people who took my tutorial.
WARNING: I am still writing this tutorial, you will find a dead end on this unfinished tutorial. Also, I mention and FAQ, that is something I desperately need to make, I just haven't yet.
Please realize I just barely wrote this tutorial. I'm sure it will have a problem somewhere. Just post it in the forum if you find one, and I'll fix it.
Well, we are here now, moving on to TOOLS!!! Well this is going to be a longer tutorial.
Lets have a peek at what we need to do:
-New Ore
-Making the Ore generate naturally
-New Item dropped by our ore -I'll come back and do that after I finish most of the first part.
-Making the Ore smeltable
-Making the Tools
-Making the Sword, bow, and arrows
-Making a new tool
Allright lets get started. Hm.. New ore. Well you know how to make a block by now, make one for our ore! I'm just gonna call it Emerald Ore, and make it fast as diamond, and gold and almost as long lasting as diamond. But at this point, that doesn't matter.
SAVE THIS AS mod_OurMods.java
And this is BlockEmeraldOre.java:
Coming soon.
But, yeah, thanks for rating it in diamonds like I asked as well.
I will have modloader compatibility up soon, but it will be a really short tutorial compared to the other one, but that's a good thing :wink.gif:, it's not hard, you just have to put stuff in different places.
https://assortedmods.com/
Here's for you :
Love tut gonna make me own block soon
gonna make a mod soon
i know it works but cant figure out how
making see through dirt
ANd try googling "Java Programming Tutorial -1- Setting up JDK by thenewboston.
It's good, and btw, did you just copy and paste my location for the C\program files\ stfufF? Because you probably have like Program Files x84 or whatever.
my block (commong block) wouldnt work
its is crafted like this
i put the java files and every thing but its fine ill just stick to making texture packs
I suggest for testing purposes you simply set it to:
Then change the recipe. Tell me if that doesn't work.
Also, the person with JDK problems, did you do this: try googling "Java Programming Tutorial -1- Setting up JDK by thenewboston." It's on youtube
edit: were do you put the slipperiness