package net.minecraft.src;
public class mod_NewTools extends BaseMod
{
public static final Item GoldHammer = new Item(5108).setItemName("Hammer");
public static final Item IronHammer = new Item(5109).setItemName("Hammer");
public static final Item DiamondHammer = new Item(5110).setItemName("Hammer");
public static final Item StoneHammer = new Item(5112).setItemName("Hammer");
public static final Item WoodHammer = new Item(5113).setItemName("Hammer");
public String Version()
{
return "1.0.0";
}
public mod_NewTools()
{
NewTools.iconIndex = ModLoader.addOverride ("/gui/items.png", "/NewTools/GoldHammer.png" ,"/NewTools/DiamondHammer.png" ,"/NewTools/IronHammer.png" ,"/NewTools/StoneHammer.png" ,"/NewTools/WoodHammer.png");
ModLoader.AddName(GoldHammer, "GoldHammer"; IronHammer, "IronHammer"; WoodHammer, "WoodHammer"; DiamondHammer, "DiamondHammer"; StoneHammer, "StoneHammer");
}
@Override
public String getVersion() {
// TODO Auto-generated method stub
return null;
}
@Override
public void load() {
// TODO Auto-generated method stub
}
}
package net.minecraft.src;
public class mod_NewTools extends BaseMod
{
public static final Item GoldHammer = new Item(5108).setItemName("Hammer");
public static final Item IronHammer = new Item(5109).setItemName("Hammer");
public static final Item DiamondHammer = new Item(5110).setItemName("Hammer");
public static final Item StoneHammer = new Item(5112).setItemName("Hammer");
public static final Item WoodHammer = new Item(5113).setItemName("Hammer");
public String Version()
{
return "1.0.0";
}
public mod_NewTools()
{
NewTools.iconIndex = ModLoader.addOverride ("/gui/items.png", "/NewTools/GoldHammer.png" ,"/NewTools/DiamondHammer.png" ,"/NewTools/IronHammer.png" ,"/NewTools/StoneHammer.png" ,"/NewTools/WoodHammer.png");
ModLoader.AddName(GoldHammer, "GoldHammer"; IronHammer, "IronHammer"; WoodHammer, "WoodHammer"; DiamondHammer, "DiamondHammer"; StoneHammer, "StoneHammer");
}
@Override
public String getVersion() {
// TODO Auto-generated method stub
return null;
}
@Override
public void load() {
// TODO Auto-generated method stub
}
}
if you post your error it would be a good deal easier to help you
package net.minecraft.src;
import java.util.*;
public class mod_NameHere extends BaseMod
{
public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int i = 0; i < 15; i++)
{
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(64);
int randPosZ = chunkZ + rand.nextInt(16);
(new WorldGenMinable(mod_NameHere.NameHere.blockID, 15)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
Not sure what your asking for the food. Do you mean where to put the textures? If so do this: MCP folder/eclipse/client/bin/(optional)folder/NameHere.png The optional part is you can put that folder there if you would like or just put your .png in the bin.
i need help now,when you say put the PNG in here MCP folder/eclipse/client/bin/(optional)folder/NameHere.png, i dont have the bin folder. Do i have to add my .minecraft.jar bin folder in to this?
i need help : i downloaded mcp50 and eclipse and i have 1.0.0 i put my bin and resources in the jar folder and i click decompile.bat and theres an error : cannot find the path specified. Press any key to continue.
Hello, in this tutorial I will be showing you how to create different mods in Minecraft! I will NOT be showing you how to set up MCP, or Eclipse (USE IT!). I do strongly suggest using Eclipse be cause it will make your life so much easier! Make sure to install ModLoader into MCP before using these tutorials. I do suggest that you write out everything and don't just Copy-and-Paste. You will learn more. Also, I will note one thing; When creating textures, put the texture into the temp/bin/minecraft folder in MCP. Okay, on with the tutorials!
(Make sure to press the button at the bottom right!) +1 +1 +1
Tutorials
--- Basic Block
------ Item
--------- Generating Ores
------------ Armor
--------------- Tools
------------------ Advanced Block
---------------------- Food
------------------------- Smelting your ore
---------------------------- Making your smelted ore food!
================ And more to come!
Helpers
This is for the people that help out if I cannot or am not around. Thanks a lot for whoever does help!
[None yet!]
Help
If you get an error if Minecraft crashes be sure to READ the error. It does come in handy and will usually tell you what is wrong.
Also, you ALWAYS have to add this to every "mod_NameHere":
Override
public String getVersion() {
// TODO Auto-generated method stub
return null;
}
@Override
public void load() {
// TODO Auto-generated method stub
}
Actual Tutorials
Block
This tutorial in on a basic block with a recipe, block ID, and the code for the texture!
mod_NameHere
package net.minecraft.src;
import java.util.*;
public class mod_NameHere extends BaseMod
{
public String Version()
{
return "1.0.0";
}
public mod_NameHere()
{
ModLoader.RegisterBlock(NameHere);
Diamonite.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mod/NameHere.png"); //Make sure to create this texture!
ModLoader.AddName(NameHere, "NameHere");
ModLoader.AddRecipe(new ItemStack(Namehere, 1), new Object[] {
"333", "333", "333", Character.valueOf('3'), Block.dirt
});
}
public static Block NameHere = new BlockNameHere(190,0).setHardness(3.5F).setResistance(2.0F).setBlockName("NameHere");
@Override
public String getVersion() {
// TODO Auto-generated method stub
return null;
}
@Override
public void load() {
// TODO Auto-generated method stub
}
}
BlockNameHere
package net.minecraft.src;
import java.util.Random;
public class BlockNameHere extends Block
{
public BlockNameHere(int i, int j)
{
super(i, j, Material.rock);
}
public int idDropped(int i, Random random)
{
return mod_NameHere.NameHere.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
}
Item
mod_NameHere
package net.minecraft.src;
public class mod_NameHere extends BaseMod
{
public static final Item NameHere = new Item(31415).setItemName("NameHere");
public String Version()
{
return "1.0.0";
}
public mod_NameHere()
{
NameHere.iconIndex = ModLoader.addOverride("/gui/items.png", "/mod/NameHere.png");
ModLoader.AddName(NameHere, "NameHere");
}
@Override
public String getVersion() {
// TODO Auto-generated method stub
return null;
}
@Override
public void load() {
// TODO Auto-generated method stub
}
}
ItemNameHere
package net.minecraft.src;
import java.util.Random;
public class ItemNameHere extends Item
{
public ItemNameHere (int i)
{
super(i);
maxStackSize = 64;
}
}
Food(Really easy!)
For this tutorial I am just going to use the example "Pie". mod_Pie
package net.minecraft.src;
public class mod_Pie extends BaseMod
{
public String Version()
{
return "1.0.0";
}
public mod_Pie()
{
Pie.iconIndex = ModLoader.addOverride("/gui/items.png", "/mORES/Pie.png");
ModLoader.AddName(Pie, "Pie");
ModLoader.AddRecipe(new ItemStack(Pie, 1), new Object[] {
" ", " ", " 1 ", Character.valueOf('1'), Block.dirt, Character.valueOf('2'), Item.wheat, Character.valueOf('3'), Item.bucketMilk, Character.valueOf('4'), Item.egg
});
}
public static Item Pie = (new ItemFood(31415, 8, 1F, false)).setItemName("Pie");
@Override
public String getVersion() {
// TODO Auto-generated method stub
return null;
}
@Override
public void load() {
// TODO Auto-generated method stub
}
}
Generating Ores(Add this in the block we made)
mod_NameHere
public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int i = 0; i < 50; i++) //The -50- is how many allowed per chunk.
{
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(128); //Height above Bedrock is allowed to spawn.
int randPosZ = chunkZ + rand.nextInt(16);
(new WorldGenMinable(mod_Silver.Silver.blockID, 60)).generate(world, rand, randPosX, randPosY, randPosZ); // -60- is how many per vain.
}
}
Smelting
I will show you how to smelt your ore into the item. mod_NameHere
public mod_NameHere()
{
ModLoader.RegisterBlock(NameHere);
NameHere.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Folder/NameHere.png");
ModLoader.AddName(NameHere, "NameHere");
ModLoader.AddSmelting(NameHere.blockID, new ItemStack(mod_NameHere.NameHere, 1, 1)); //The last part: new ItemStack(mod_NameHere.NameHere, 1, 1));. That is your item name.
}
Add this in there:
ModLoader.AddSmelting(NameHere.blockID, new ItemStack(mod_NameHere.NameHere, 1, 1));
\
Making your smelted ore food!
Go into your mod_NameHere. This is the item mod_NameHere.
mod_NameHere
Change this:
public static final Item NameHere = new Item(30000).setItemName("NameHere");
To this:
public static final Item NameHere = (new ItemFood(30000, 1, 1F, false)).setItemName("NameHere");
Advanced Block(All these are in the BlockNameHere)
Self building house!
package net.minecraft.src;
import java.util.Random;
public class BlockNameHere extends Block
{
public BlockNameHere(int i, int j)
{
super(i, j, Material.rock);
}
public int idDropped(int i, Random random)
{
return mod_NameHere.NameHere.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer)
{
int block = Block.planks.blockID;
int block2 = Block.doorWood.blockID;
int block3 = Block.wood.blockID;
int block4 = Block.glass.blockID;
//Log Pillers
world.setBlockWithNotify(i + 5, j + 0, k, block3);
world.setBlockWithNotify(i + 5, j + 1, k, block3);
world.setBlockWithNotify(i + 5, j + 2, k, block3);
world.setBlockWithNotify(i + 5, j + 3, k, block3);
world.setBlockWithNotify(i, j + 0, k + 5, block3);
world.setBlockWithNotify(i, j + 1, k + 5, block3);
world.setBlockWithNotify(i, j + 2, k + 5, block3);
world.setBlockWithNotify(i, j + 3, k + 5, block3);
world.setBlockWithNotify(i + 5, j + 0, k + 5, block3);
world.setBlockWithNotify(i + 5, j + 1, k + 5, block3);
world.setBlockWithNotify(i + 5, j + 2, k + 5, block3);
world.setBlockWithNotify(i + 5, j + 3, k + 5, block3);
world.setBlockWithNotify(i, j + 0, k, block3);
world.setBlockWithNotify(i, j + 1, k, block3);
world.setBlockWithNotify(i, j + 2, k, block3);
world.setBlockWithNotify(i, j + 3, k, block3);
//Walls (Wood)
world.setBlockWithNotify(i + 4, j + 0, k, block);
world.setBlockWithNotify(i + 4, j + 2, k, block);
world.setBlockWithNotify(i + 4, j + 3, k, block);
world.setBlockWithNotify(i + 1, j + 0, k, block);
world.setBlockWithNotify(i + 1, j + 2, k, block);
world.setBlockWithNotify(i + 1, j + 3, k, block);
world.setBlockWithNotify(i + 2, j + 3, k, block);
world.setBlockWithNotify(i + 2, j + 2, k, block);
world.setBlockWithNotify(i + 3, j + 2, k, block);
world.setBlockWithNotify(i + 3, j + 2, k, block);
world.setBlockWithNotify(i, j + 0, k + 1, block);
world.setBlockWithNotify(i, j + 0, k + 2, block);
world.setBlockWithNotify(i, j + 0, k + 3, block);
world.setBlockWithNotify(i, j + 0, k + 4, block);
world.setBlockWithNotify(i, j + 1, k + 1, block);
world.setBlockWithNotify(i, j + 2, k + 1, block);
world.setBlockWithNotify(i, j + 3, k + 1, block);
world.setBlockWithNotify(i, j + 1, k + 4, block);
world.setBlockWithNotify(i, j + 2, k + 4, block);
world.setBlockWithNotify(i, j + 3, k + 4, block);
world.setBlockWithNotify(i, j + 3, k + 2, block);
world.setBlockWithNotify(i, j + 3, k + 3, block);
world.setBlockWithNotify(i + 1, j + 0, k + 5, block);
world.setBlockWithNotify(i + 2, j + 0, k + 5, block);
world.setBlockWithNotify(i + 3, j + 0, k + 5, block);
world.setBlockWithNotify(i + 4, j + 0, k + 5, block);
world.setBlockWithNotify(i + 1, j + 1, k + 5, block);
world.setBlockWithNotify(i + 1, j + 2, k + 5, block);
world.setBlockWithNotify(i + 1, j + 3, k + 5, block);
world.setBlockWithNotify(i + 4, j + 1, k + 5, block);
world.setBlockWithNotify(i + 4, j + 2, k + 5, block);
world.setBlockWithNotify(i + 4, j + 3, k + 5, block);
world.setBlockWithNotify(i + 2, j + 3, k + 5, block);
world.setBlockWithNotify(i + 3, j + 3, k + 5, block);
world.setBlockWithNotify(i + 5, j + 0, k + 1, block);
world.setBlockWithNotify(i + 5, j + 0, k + 2, block);
world.setBlockWithNotify(i + 5, j + 0, k + 3, block);
world.setBlockWithNotify(i + 5, j + 0, k + 4, block);
world.setBlockWithNotify(i + 5, j + 1, k + 1, block);
world.setBlockWithNotify(i + 5, j + 2, k + 1, block);
world.setBlockWithNotify(i + 5, j + 3, k + 1, block);
world.setBlockWithNotify(i + 5, j + 1, k + 4, block);
world.setBlockWithNotify(i + 5, j + 2, k + 4, block);
world.setBlockWithNotify(i + 5, j + 3, k + 4, block);
world.setBlockWithNotify(i + 5, j + 3, k + 2, block);
world.setBlockWithNotify(i + 5, j + 3, k + 3, block);
world.setBlockWithNotify(i + 3, j + 3, k, block);
//Walls (Glass)
world.setBlockWithNotify(i + 4, j + 1, k, block4);
world.setBlockWithNotify(i + 1, j + 1, k, block4);
world.setBlockWithNotify(i, j + 1, k + 2, block4);
world.setBlockWithNotify(i, j + 1, k + 3, block4);
world.setBlockWithNotify(i, j + 2, k + 2, block4);
world.setBlockWithNotify(i, j + 2, k + 3, block4);
world.setBlockWithNotify(i + 2, j + 1, k + 5, block4);
world.setBlockWithNotify(i + 3, j + 1, k + 5, block4);
world.setBlockWithNotify(i + 2, j + 2, k + 5, block4);
world.setBlockWithNotify(i + 3, j + 2, k + 5, block4);
world.setBlockWithNotify(i + 5, j + 1, k + 2, block4);
world.setBlockWithNotify(i + 5, j + 1, k + 3, block4);
world.setBlockWithNotify(i + 5, j + 2, k + 2, block4);
world.setBlockWithNotify(i + 5, j + 2, k + 3, block4);
//Roof
world.setBlockWithNotify(i + 1, j + 4, k + 1, block);
world.setBlockWithNotify(i + 1, j + 4, k + 2, block);
world.setBlockWithNotify(i + 1, j + 4, k + 3, block);
world.setBlockWithNotify(i + 1, j + 4, k + 4, block);
world.setBlockWithNotify(i + 2, j + 4, k + 1, block);
world.setBlockWithNotify(i + 2, j + 4, k + 2, block);
world.setBlockWithNotify(i + 2, j + 4, k + 3, block);
world.setBlockWithNotify(i + 2, j + 4, k + 4, block);
world.setBlockWithNotify(i + 3, j + 4, k + 1, block);
world.setBlockWithNotify(i + 3, j + 4, k + 2, block);
world.setBlockWithNotify(i + 3, j + 4, k + 3, block);
world.setBlockWithNotify(i + 3, j + 4, k + 4, block);
world.setBlockWithNotify(i + 4, j + 4, k + 1, block);
world.setBlockWithNotify(i + 4, j + 4, k + 2, block);
world.setBlockWithNotify(i + 4, j + 4, k + 3, block);
world.setBlockWithNotify(i + 4, j + 4, k + 4, block);
}
}
I am going to explain this so don't get to paranoid...
The first part is all the same. Then this new line is tell the world you punched the block.
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer)
Then each of these:
world.setBlockWithNotify(i, j, k, block);
is a block. You should be able to figure this out with A LOT of trial and error. It took me about 45mins to get this small 5x5 house. Good luck!
More to Come!
Thank you so much for posting this, it will help me so much with my mod
i got an error with my items so here is the error |
---------------------------------------------------------
Mods loaded: 1
ModLoader 1.0.0
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
If you wish to report this, please copy this entire text and email it to [email protected].
Please include a description of what you did when the error occured.
--- BEGIN ERROR REPORT 141ccf11 --------
Generated 12/15/11 10:00 PM
Minecraft: Minecraft 1.0.0
OS: Windows 7 (x86) version 6.1
Java: 1.7.0, Oracle Corporation
VM: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
LWJGL: 2.4.2
OpenGL: Intel(R) HD Graphics Family version 3.0.0 - Build 8.15.10.2342, Intel
java.lang.InstantiationException: net.minecraft.src.mod_Copsnrobbers
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at net.minecraft.src.ModLoader.addMod(ModLoader.java:265)
at net.minecraft.src.ModLoader.readFromClassPath(ModLoader.java:1214)
at net.minecraft.src.ModLoader.init(ModLoader.java:733)
at net.minecraft.src.ModLoader.AddAllRenderers(ModLoader.java:162)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:104)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:42)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:314)
at net.minecraft.client.Minecraft.run(Minecraft.java:613)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT 939210e8 ----------
could you please make a tutorial on how to make a block drop an item (example: diamond ore drops diamond)
I have tried copying codes from the Blocks.java file but it doesn't seem to work!
PLEASE HELP!
Eclipse (VERY RECOMENDED! MAKES LIFE 100% EASIER!), and MCP. There are tutorials on all this stuff. Look on the forum or Youtube.
Please answer.
if you post your error it would be a good deal easier to help you
i need help now,when you say put the PNG in here MCP folder/eclipse/client/bin/(optional)folder/NameHere.png, i dont have the bin folder. Do i have to add my .minecraft.jar bin folder in to this?
Wrong. That is not the error. It was just he didn't have the getVersion method
In which java file, in the source folder, can i find out about the Spider Jockeys?
I want to try and learn about them.
I checked in the spider and skeleton file, couldn't find anything other than MountedYOffset.
But that's basically all i can find.
Thanks for your help.
-Dj
Thank you so much for posting this, it will help me so much with my mod
The recompile.bat file shold do it
This is the error I get when I try to run Minecraft with no mods other than the mod I made (and modloader).
Can anyone tell me what is wrong?
---------------------------------------------------------
Mods loaded: 1
ModLoader 1.0.0
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
If you wish to report this, please copy this entire text and email it to [email protected].
Please include a description of what you did when the error occured.
--- BEGIN ERROR REPORT 141ccf11 --------
Generated 12/15/11 10:00 PM
Minecraft: Minecraft 1.0.0
OS: Windows 7 (x86) version 6.1
Java: 1.7.0, Oracle Corporation
VM: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
LWJGL: 2.4.2
OpenGL: Intel(R) HD Graphics Family version 3.0.0 - Build 8.15.10.2342, Intel
java.lang.InstantiationException: net.minecraft.src.mod_Copsnrobbers
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at net.minecraft.src.ModLoader.addMod(ModLoader.java:265)
at net.minecraft.src.ModLoader.readFromClassPath(ModLoader.java:1214)
at net.minecraft.src.ModLoader.init(ModLoader.java:733)
at net.minecraft.src.ModLoader.AddAllRenderers(ModLoader.java:162)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:104)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:42)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:314)
at net.minecraft.client.Minecraft.run(Minecraft.java:613)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT 939210e8 ----------
I have tried copying codes from the Blocks.java file but it doesn't seem to work!
PLEASE HELP!