Sorry for dropping off the face of the earth with these tutorials. I've been working on my mod, The Precursor, and I've been having a lot of stuff happening with Family and School. I should be back in gear for awhile.
I really don't feel like going through and making sure all these tutorials still work. If you use one, and you get some errors, please tell me. If my template stuff is broken, I will fix it ASAP. Tutorials I'm working on now are for GUI's, including Buttons, textures, text, and pages.
Now you want to make a new folder somewhere like your Desktop, and make a new folder called MCP. Take all of the files from the MCP50 zip and drag it into that folder you just created.
Now this is the somewhat tricky part.
Open the 'jars' folder, and open another window and go into your AppData/Roaming/.minecraft. You want to make sure you have a FRESH MINECRAFT. Add ModLoader (AudioMod if you want to add custom sounds too) to the minecraft.jar in the bin folder. Then, you'll take the bin folder (again, AppData/Roaming/.minecraft) and copy and paste it into the 'jars' folder in your MCP folder. If you're adding custom sounds, you'll want to move the resource folder also.
Now, go back into the MCP folder, to the main page, I'll explain the important .bats
cleanup.bat = This will delete any MCP made folders (after you decompile)
decompile.bat = This will unload your minecraft.jar and give you the sources
recompile.bat = This will load your added/configured classes into the MCP Minecraft
reobfuscate.bat = This will turn your .java files into .classes so you can use them in regular Minecraft
startclient.bat = This will allow you to test your mod (after you recompile)
What you want to do now, it open the decompile.bat, you might get an error or two, that's fine. This will add a few new folders. The final part, open the src folder, then minecraft/net/minecraft/src and this will give you all of the .classes written as .java so you can edit and add your own.
To Edit/Add your own .java, use EditRocket, Notepad++, or Eclipse (recommended)
Click HERE to go to the Eclipse set up Tutorial (Not Up Yet)
You'll want to download Eclipse Classic 4.2, and open the .zip and put the content into a folder. Open it up, and you'll get a pop up, just press OK.
You should get a screen like this:
Right click under the 'Project Explorer' and click New -> Project. You should get a popup, and you'll want to pick 'Java Project'.
Under 'Project Name' you can have whatever, I like to have my Mod Names as the Project Name. Untick the 'Use Default Workspace' button and click 'Browse' under Location. You will get a small popup to find the location of your mod. Look for your MCP folder, then you'll want to click on the 'src' FOLDER. Click 'OK' and then 'Finish'.
Now, you'll want to right click your project and click on 'Properties'. Make sure you're on 'Java Build Path' on the left, and 'Libraries' on the top. Click on Add External JARs. Find your MCP folder again, then go to Jars -> Bin, then select all four of the jars and hit 'Open'.
Now you'll want to expand jinput, lwjgl_util, and lwjgl on that same popup and click on 'Native Library Location' and click on 'Edit'. Click on External Folder and go back to the MCP folder. Open jars -> bin, then select natives. Click 'OK' and copy that location, and press 'OK' again. Now you take that location path and put it in the other Native Library Locations, DON'T DO IT IN THE MINECRAFT.JAR ONE.
Now you're done! Eclipse is set up and ready to go. To get to the .java files, you'll want to expand your project on the left side, then expand minecraft, and finally expand net.minecraft.src. When you make a new .java, you want to go to File -> New -> Other, and click on Class. When it adds it, it will go into '(default package)', drag that into the net.minecraft.src package and it SHOULD be good to go.
public void addSmelting()
{
ModLoader.AddSmelting(whatyouputin, new ItemStack(whatyoureceive, amountreturned));
}
This is what you do with public static:
For ITEMS:
public static Item youritem;
For BLOCKS:
public static Block yourblock;
This is what you do with static:
For ITEMS
static
{
youritem = (new ItemItemclass(itemid)).setItemName("itemname");
}
You'll want to add an item ID, I'd pick somewhere above 1000. The 'itemname' and 'youritem' is where you'd put your item name, and the 'Itemitemclass' is the ItemYouritem.java that you make in the Item tutorial.
For BLOCKS, this one is a bit more complicated, please read the 'Block Methods and Effects' tutorial after this.
static
{
yourblock = new BlockBlockclass(blockid, 0, material.whatever).setBlockName("yourblock");
}
Block ID is different then an Item ID because the ID is a lot lower of a number, I believe you can go down to 200 on this. For material.whatever, you'll want to look in Material.java for list. Again, replace 'yourblock' with whatever your block name is. There are more methods you can add along with the .setBlockName, read the 'Block Methods and Effects' tutorial to learn more such as lightvalue and hardness.
First to make an item, you'll want to make an ItemName.java
The ItemBlank is a catagory of items, like ItemRecord includes all of the records. So if you're making two of the nearly same item, you don't need ItemLeash1 and ItemLeash2, you can just have ItemLeash.
So, make a new .java and name it ItemWhatever, for this tutorial I'll have it ItemPencil.
//Coded by <your name="">
package net.minecraft.src;
public class ItemPencil extends Item
{
public ItemPencil (int i)
{
super (i);
maxStackSize = 4; //This is the max stack, obviously
}
}
Now, you'll need the template from above for the mod_Name
When you name your mod_, it doesn't have to be mod_pencil, you can put multiple items on one mod_. For the sake of example, I'll have the tutorial as mod_School
//Coded by <your name="">
package net.minecraft.src;
import java.util.Random;
public class mod_School extends BaseMod{
public mod_School()
{
//TODO List
addNames();
setTextures();
registerBlocks();
addRecipes();
addSmelting();
}
public void addNames()
{
ModLoader.AddName(pencil, "Wooden Pencil");
}
public void setTextures()
{
youritem.iconIndex = ModLoader.addOverride("/gui/items.png", "/school/pencil.png");
}
public void registerBlocks()
{
}
public void addRecipes()
{
ModLoader.AddRecipe(new ItemStack(pencil, 4), new Object[] {
"M", "M", Character.valueOf('M'), Item.stick
});
}
public void addSmelting()
{
}
public static Item pencil;
static
{
pencil = (new ItemPencil(1000)).setItemName("pencil");
}
public String getVersion()
{
return "School Mod v1";
}
public void load()
{
}
}
That's pretty much it, how to add an item.</your></your>
This tutorial will be an addition to the Adding Items tutorial, please do that before doing this.
So, you made the ItemName, and you want to make it a food. I'm going to use the ItemPencil and add the new codes to it, just so you can compare the two.
Open your ItemName.java, and add the following codes:
private int healAmount;
healAmount = 12; //this is how much it heals by half a hunger heart (Two is a full hunger heart)
public int getHealAmount()
{
return healAmount;
}
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
itemstack.stackSize--; //this is the code to make it take one off of the stack
entityplayer.heal(healAmount); //this is the code to make it heal
return itemstack;
}
An example so you know where they go:
//Coded by YourName
package net.minecraft.src;
public class ItemPencil extends Item
{
private int healAmount;
public ItemPencil (int i)
{
super (i);
maxStackSize = 4;
healAmount = 12; //this is how much it heals by half a hunger heart (Two is a full hunger heart)
}
public int getHealAmount()
{
return healAmount;
}
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
itemstack.stackSize--; //this is the code to make it take one off of the stack
entityplayer.heal(healAmount); //this is the code to make it heal
return itemstack;
}
}
Just like Items, the BlockName.java is a category, not for each separate block you add.
So, make a new .java and name it BlockYourname, for this tutorial I'm going to have it named BlockLantern.
//Coded by YourName
package net.minecraft.src;
import java.util.Random;
public class BlockLantern extends Block
{
public BlockLantern(int i, int j, Material material)
{
super(i, Material.iron);
}
public int idDropped(int i, Random random, int j)
{
return mod_Lantern.light.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
}
Now you will need to use the template, if you already used it for an item, you don't need to make a new one for blocks, you can use the same one.
Again, this will be mod_Lantern, change everything to how you need.
//Coded by <your name="">
package net.minecraft.src;
import java.util.Random;
public class mod_Lantern extends BaseMod{
public mod_Lantern()
{
//TODO List
addNames();
setTextures();
registerBlocks();
addRecipes();
addSmelting();
}
public void addNames()
{
ModLoader.AddName(light, "Lantern");
}
public void setTextures()
{
light.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/modpictures/lantern.png");
}
public void registerBlocks()
{
ModLoader.RegisterBlock(light);
}
public void addRecipes()
{
ModLoader.AddRecipe(new ItemStack(light, 1), new Object[] {
"MMM", "MSM", "MMM" Character.valueOf('M'), Block.glass, Character.valueOf('S'), Item.lightStoneDust
});
}
public void addSmelting()
{
}
public static Block light;
static
{
light = new BlockLantern(200, 0, Material.iron).setHardness(0.3F).setBlockName("light");
}
public String getVersion()
{
return "your mod's name";
}
public void load()
{
}
}
Before I explain the methods, I'll show how to add them. If you look at the template, you want to go to the "static" part at the very bottom, and add it to the block you want to change. For example, if I wanted to add a hardness, I'd change
yourblock = new BlockBlockclass(blockid, 0, material.whatever).setBlockName("yourblock");
to
yourblock = new BlockBlockclass(blockid, 0, material.whatever).setHardness(2.5F).setBlockName("yourblock");
Now, here are the Methods you can add
.setHardness
.setHardness is basically how hard your block is. For example, Obsidian is 10, and a chest is 2.5. You can add this by having
.setHardness(intF)
replacing 'int' with a number.
.setLightOpacity
.setLightOpacity is how easy light can pass through the block. For example, webs have a Light Opacity of 1, while ice and water have a Light Opacity of 3. The higher opacity number, the less light that will travel through it. You can add this by having
.setLightOpacity(int)
replacing 'int' with a number.
.setResistance
.setResistance is how resistant your block is to explosions. The higher resistance, the more damage it can handle from explosions. The resistance of Obsidian is 2000, so if you want it safe from explosions just use 2000. You can add this by adding
.setResistance(intF)
changing 'int' with a number.
.setBlockUnbreakable
.setBlockUnbreakable will make your block unbreakable, just like bedrock. You can add it by having
.setBlockUnbreakable()
.
.setLightValue
.setLightValue is like a torch. It will allow your block to release light. You can add
.setLightValue(intF)
replacing 'int' with a number. A torch is 0.9375. You want to be careful with this one, because I think the max you can have is 2. If your game crashes from adding this, I'd lower the light value.
EDIT: can you add how to add crops and ore and stuff and also a template for those things so all i have to do is fill in the blank and how to make mobs spawn at your position when you right click with a certain item and how to add seeds
The best way I think I can explain this is, is to use an item in game. I'll do acouple codes so you can get the general idea.
Basically, in the "s, you can have any code you want. You can use any characters inside, and you'll need to define every new character you use.
In the code to add recipe
ModLoader.AddRecipe(new ItemStack(WhateverItem/Block, HowManyInReturn), new Object[] {
Where it says 'WhateverItem/Block' means you can use whatever item/block
If you're using an item in mod_Whatever, you just need to add the item name.
For example, you want to create a pencil. You don't need to put mod_Whatever.pencil, you can just have pencil. If you're using an item that already exists, you want to do Item.thatitem, for a block you want to use Block.thatblock. For a list of existent items/blocks and how you should capitalize them, open Item.java or Block.java and it will list them.
Where it says 'HowManyInReturn' means how many you get after you create it.
So if you put <block.sand, 5=""> that will be so you create 5 sand blocks using whatever recipe.
Now to explain coding the recipe itself. This example I'll use a crafting table.
You don't need spaces in the empty spots, or it'd make so you NEED that space there, do you wouldn't be able to be crafted in your inventory.
This example I'll use shears. In this one, you need a space in the code because it's in a diagonal. If you didn't have the spaces, it would make it a vertical line of iron ingots to make shears
The numbers in the crafting table image can be anywhere, so you need the recipe in the same shape, but it can be placed anywhere in the crafting zone.</block.sand,>
You'll want to open your 'MCP' folder, then the 'bin' folder, then the 'minecraft' folder.
Make a new folder for whatever your mod is called. For example, your mod is named Colored Water, you can name your folder coloredwater, water, or whatever you want really. Make sure you know how you capitalized it. Any image you make for your mod, weather it be an item or a block, add it to this folder.
Now for your code, I'll have the item and block all in the same code so I don't need a huge post.
For this example I will have the mod folder be named "Tutorial", item will be "Pencil", and the block will be "Lantern"
When you add the /Tutorial/pencil.png and /Tutorial/lantern.png, make sure you spelled and capitalized everything correctly, and make sure your image for your file is a '.png'
This one is relatively simple. Just add this code into your BlockWhatever.java.
public int getRenderBlockPass()
{
return 1;
}
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
return super.shouldSideBeRendered(iblockaccess, i, j, k, 1 - l);
}
public boolean isOpaqueCube()
{
return false;
}
When you add the texture to your block, you'll want to have it have some transparency. Basically, you can't be a solid color in the texture to be transparent in game.
Thank you Muserae! Now I can combine all my little new blocks into a single mod. SO happy! I was trying to add them one block after another and I didn't understand why it didn't work.
I've been wanting to add new wood plank colors to my maps, when you have the time could you explain how to:
1) Edit/override pre-existing items or blocks to change their damage values or other values
2) How to use damage values.
Maybe that should be reversed? he he he. I have other suggestions as well if you are interested, but I don't wanna come off the wrong way.
Sorry for dropping off the face of the earth with these tutorials. I've been working on my mod, The Precursor, and I've been having a lot of stuff happening with Family and School. I should be back in gear for awhile.
I really don't feel like going through and making sure all these tutorials still work. If you use one, and you get some errors, please tell me. If my template stuff is broken, I will fix it ASAP. Tutorials I'm working on now are for GUI's, including Buttons, textures, text, and pages.
-----MCP and Eclipse-----
Setting up MCP
Setting up Eclipse
Making Your Mod Available for Download
-----mod_ Template-----
Basic mod_ Template
How to use the mod_ Template
Example of the Template with Multiple Items
Adding Crafting Recipes Explained
Adding Textures Explained
Adding a Basic GUI
Adding Text to a GUI
Adding Buttons to a GUI
-----Items-----
Adding a Basic Item
Making the Item into Food
Placing a Block With an Item
-----Blocks-----
Adding a Basic Block
Multi-Textured Block
Block Generation
Block Methods and Effects
Block Shape Manipulation
Making a Block Transparent with a Color
Turning a Block into a Half-Step
Adding a Flower
-----Other-----
Item Returned in Crafting Recipe
Block Hardness and Resistance
Block names in code (coming soon)
Item names in code (coming soon)
If any of these tutorials helped you, please push the green +
Click Here to get MCP for Minecraft v1
It should look something like this:
decompile.bat = This will unload your minecraft.jar and give you the sources
recompile.bat = This will load your added/configured classes into the MCP Minecraft
reobfuscate.bat = This will turn your .java files into .classes so you can use them in regular Minecraft
startclient.bat = This will allow you to test your mod (after you recompile)
To Edit/Add your own .java, use EditRocket, Notepad++, or Eclipse (recommended)
Click HERE to go to the Eclipse set up Tutorial (Not Up Yet)
</your>
First to make an item, you'll want to make an ItemName.java
The ItemBlank is a catagory of items, like ItemRecord includes all of the records. So if you're making two of the nearly same item, you don't need ItemLeash1 and ItemLeash2, you can just have ItemLeash.
So, make a new .java and name it ItemWhatever, for this tutorial I'll have it ItemPencil.
Now, you'll need the template from above for the mod_Name
When you name your mod_, it doesn't have to be mod_pencil, you can put multiple items on one mod_. For the sake of example, I'll have the tutorial as mod_School
That's pretty much it, how to add an item.</your></your>
This tutorial will be an addition to the Adding Items tutorial, please do that before doing this.
So, you made the ItemName, and you want to make it a food. I'm going to use the ItemPencil and add the new codes to it, just so you can compare the two.
Open your ItemName.java, and add the following codes:
An example so you know where they go:
Just like Items, the BlockName.java is a category, not for each separate block you add.
So, make a new .java and name it BlockYourname, for this tutorial I'm going to have it named BlockLantern.
Now you will need to use the template, if you already used it for an item, you don't need to make a new one for blocks, you can use the same one.
Again, this will be mod_Lantern, change everything to how you need.
</your>
Before I explain the methods, I'll show how to add them. If you look at the template, you want to go to the "static" part at the very bottom, and add it to the block you want to change. For example, if I wanted to add a hardness, I'd change
to
Now, here are the Methods you can add
Here's a list of existing block harness and resistance, list thanks to Elyssia001.
EDIT: can you add how to add crops and ore and stuff and also a template for those things so all i have to do is fill in the blank and how to make mobs spawn at your position when you right click with a certain item and how to add seeds
[size=16px]
This is for adding recipes:
The best way I think I can explain this is, is to use an item in game. I'll do acouple codes so you can get the general idea.
Basically, in the "s, you can have any code you want. You can use any characters inside, and you'll need to define every new character you use.
In the code to add recipe
Where it says 'WhateverItem/Block' means you can use whatever item/block
If you're using an item in mod_Whatever, you just need to add the item name.
For example, you want to create a pencil. You don't need to put mod_Whatever.pencil, you can just have pencil. If you're using an item that already exists, you want to do Item.thatitem, for a block you want to use Block.thatblock. For a list of existent items/blocks and how you should capitalize them, open Item.java or Block.java and it will list them.
Where it says 'HowManyInReturn' means how many you get after you create it.
So if you put <block.sand, 5=""> that will be so you create 5 sand blocks using whatever recipe.
Now to explain coding the recipe itself. This example I'll use a crafting table.
You don't need spaces in the empty spots, or it'd make so you NEED that space there, do you wouldn't be able to be crafted in your inventory.
This example I'll use shears. In this one, you need a space in the code because it's in a diagonal. If you didn't have the spaces, it would make it a vertical line of iron ingots to make shears
If you want to add more than one Character, you need this:
Now, if we look back at the workbench, I'll show how it shows in game.
I'm going to change the 'M' to numbers so you can see where it's located
The numbers in the crafting table image can be anywhere, so you need the recipe in the same shape, but it can be placed anywhere in the crafting zone.</block.sand,>
This will be for setTextures
First, it will be where to put your textures.
You'll want to open your 'MCP' folder, then the 'bin' folder, then the 'minecraft' folder.
Make a new folder for whatever your mod is called. For example, your mod is named Colored Water, you can name your folder coloredwater, water, or whatever you want really. Make sure you know how you capitalized it. Any image you make for your mod, weather it be an item or a block, add it to this folder.
Now for your code, I'll have the item and block all in the same code so I don't need a huge post.
For this example I will have the mod folder be named "Tutorial", item will be "Pencil", and the block will be "Lantern"
When you add the /Tutorial/pencil.png and /Tutorial/lantern.png, make sure you spelled and capitalized everything correctly, and make sure your image for your file is a '.png'
Thank you :smile.gif:
Thanks, I'm going to be adding some more advanced things later, I just want to get the basics in first.
You said multiple things can be added to the same mod, can you show us an example of how that would look please?
As a request from Elyssia001, I'll make an example on how you can add multiple blocks and items to one template.
This one is relatively simple. Just add this code into your BlockWhatever.java.
When you add the texture to your block, you'll want to have it have some transparency. Basically, you can't be a solid color in the texture to be transparent in game.
I've been wanting to add new wood plank colors to my maps, when you have the time could you explain how to:
1) Edit/override pre-existing items or blocks to change their damage values or other values
2) How to use damage values.
Maybe that should be reversed? he he he. I have other suggestions as well if you are interested, but I don't wanna come off the wrong way.