I am a beginner modder, but I realised that modding (basic mods) aren't as difficult as you might think. This is my tutorial on how to Decompile Minecraft and create a mod. Yay!
The Tools
We are going to need some tools!
-A clean minecraft.jar (NOT CRACKED.)
-Some basic coding knowledge. Don't get scared, it's only very basic.
-Minecraft Coders Pack (Will be referred to as MCP)
-Java Development Kit. (Get this one of the website, it is too big to upload). Java SE Downloads Trusted website.
-Notepad++
-Know how to install mods
-How to add a PATH VARIABLE
Let's Get Started!
1. Get MCP up and running! Unzip to any location on your computer.
2. Use HeartView's tutorial to find your .minecraft folder. http://www.mpgh.net/forum/422-minecr...ft-folder.html
3. Copy the "bin" and "resources" folder to the jars folder in MCP.
4. Run 'decompile.bat'
5. Now navigate to MCP\sources\minecraft\net\minecraft\src* Whoa! That's a lot of files!
6. Right click on any file you wish to mod and select open with Notepad++. For the tutorial I will be showing you how to make skeletons not
burn during the day.
7. Find EntitySkeleton.class this is the file we are going to mod.
8. D: That's a lot of code! Can you see what might make a skeleton burn during the day?!
That's right!
9. Now, if the code checks if it is daytime...then sets a skeleton on fire if it is...how could be make it so that it checks if it is daytime and doesn't set on fire?
Of course!
So now when it's daytime, instead of Mr. Skeleton being bombarded with 300 watts of fire power...he receives 0. Yay!
You can probably see lots of other little variables, play around with them!
10. Now we have finished coding and are ready to add our mod into Minecraft.
11. Open up your 'conf' folder and find 'client_obfuscation.txt'
12. Delete the contents of this file and add our modded file into it. Remember, we modded EntitySkeleton so add that to the text document.
13. Go back into your main MCP folder and find 'recompile.bat'. Unless you added random stuff or included a non-applicable variable, you should get no errors.
14. If you don't get any errors, run 'reobf.bat'
15. Now the moment of truth! Find your folder called final_out\minecraft. You should see a class file.
16. Open up minecraft.jar and delete META-INF, if it is there. Drag and drop your class file in and close it.
17. Open up Minecraft and load any world. Find yourself (or spawn) a skeleton and notice something. :O He isn't burning?!
18. You have created an extremely basic mod, but it's a great start! Good job.
If you have any errors or questions, post them here. This tutorial took a while to write, so thank and/or rep would be appreciated (:
*Src means Source, in coding terms.
Virus Scans : Online Virus Scanner
Others aren't working, feel free to scan it for yourself and edit this post, @JamesA1994
The Tools
We are going to need some tools!
-A clean minecraft.jar (NOT CRACKED.)
-Some basic coding knowledge. Don't get scared, it's only very basic.
-Minecraft Coders Pack (Will be referred to as MCP)
-Java Development Kit. (Get this one of the website, it is too big to upload). Java SE Downloads Trusted website.
-Notepad++
-Know how to install mods
-How to add a PATH VARIABLE
Let's Get Started!
1. Get MCP up and running! Unzip to any location on your computer.
2. Use HeartView's tutorial to find your .minecraft folder. http://www.mpgh.net/forum/422-minecr...ft-folder.html
3. Copy the "bin" and "resources" folder to the jars folder in MCP.
4. Run 'decompile.bat'
5. Now navigate to MCP\sources\minecraft\net\minecraft\src* Whoa! That's a lot of files!
6. Right click on any file you wish to mod and select open with Notepad++. For the tutorial I will be showing you how to make skeletons not
burn during the day.
7. Find EntitySkeleton.class this is the file we are going to mod.
8. D: That's a lot of code! Can you see what might make a skeleton burn during the day?!
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
import java.util.Random;
public class EntitySkeleton extends EntityMobs
{
public EntitySkeleton(World world)
{
super(world);
texture = "/mob/skeleton.png";
}
protected String getLivingSound()
{
return "mob.skeleton";
}
protected String getHurtSound()
{
return "mob.skeletonhurt";
}
protected String getDeathSound()
{
return "mob.skeletonhurt";
}
public void onLivingUpdate()
{
if(worldObj.isDaytime())
{
float f = getEntityBrightness(1.0F);
if(f > 0.5F && worldObj.canBlockSeeTheSky(MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)) && rand.nextFloat() * 30F < (f - 0.4F) * 2.0F)
{
fire = 300;
}
}
super.onLivingUpdate();
}
protected void attackEntity(Entity entity, float f)
{
if(f < 10F)
{
double d = entity.posX - posX;
double d1 = entity.posZ - posZ;
if(attackTime == 0)
{
EntityArrow entityarrow = new EntityArrow(worldObj, this);
entityarrow.posY += 1.3999999761581421D;
double d2 = entity.posY - 0.20000000298023224D - entityarrow.posY;
float f1 = MathHelper.sqrt_double(d * d + d1 * d1) * 0.2F;
worldObj.playSoundAtEntity(this, "random.bow", 1.0F, 1.0F / (rand.nextFloat() * 0.4F + 0.8F));
worldObj.entityJoinedWorld(entityarrow);
entityarrow.setArrowHeading(d, d2 + (double)f1, d1, 0.6F, 12F);
attackTime = 3;
}
rotationYaw = (float)((Math.atan2(d1, d) * 180D) / 3.1415927410125732D) - 90F;
hasAttacked = true;
}
}
public void writeEntityToNBT(NBTTagCompound nbttagcompound)
{
super.writeEntityToNBT(nbttagcompound);
}
public void readEntityFromNBT(NBTTagCompound nbttagcompound)
{
super.readEntityFromNBT(nbttagcompound);
}
protected int getDropItemId()
{
return Item.arrow.shiftedIndex;
}
protected void dropFewItems()
{
int i = rand.nextInt(3);
for(int j = 0; j < i; j++)
{
dropItem(Item.arrow.shiftedIndex, 5);
}
i = rand.nextInt(3);
for(int k = 0; k < i; k++)
{
dropItem(Item.bone.shiftedIndex, 1);
}
}
public ItemStack getHeldItem()
{
return defaultHeldItem;
}
private static final ItemStack defaultHeldItem;
static
{
defaultHeldItem = new ItemStack(Item.bow, 1);
}
}
Code:
public void onLivingUpdate()
{
if(worldObj.isDaytime())
{
float f = getEntityBrightness(1.0F);
if(f > 0.5F && worldObj.canBlockSeeTheSky(MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)) && rand.nextFloat() * 30F < (f - 0.4F) * 2.0F)
{
fire = 300;
}
Of course!
Code:
fire = 0;
You can probably see lots of other little variables, play around with them!
10. Now we have finished coding and are ready to add our mod into Minecraft.
11. Open up your 'conf' folder and find 'client_obfuscation.txt'
12. Delete the contents of this file and add our modded file into it. Remember, we modded EntitySkeleton so add that to the text document.
13. Go back into your main MCP folder and find 'recompile.bat'. Unless you added random stuff or included a non-applicable variable, you should get no errors.
14. If you don't get any errors, run 'reobf.bat'
15. Now the moment of truth! Find your folder called final_out\minecraft. You should see a class file.
16. Open up minecraft.jar and delete META-INF, if it is there. Drag and drop your class file in and close it.
17. Open up Minecraft and load any world. Find yourself (or spawn) a skeleton and notice something. :O He isn't burning?!
18. You have created an extremely basic mod, but it's a great start! Good job.
If you have any errors or questions, post them here. This tutorial took a while to write, so thank and/or rep would be appreciated (:
*Src means Source, in coding terms.
Virus Scans : Online Virus Scanner
Others aren't working, feel free to scan it for yourself and edit this post, @JamesA1994

.


