Hey guys, today I will be modding with minecraft and forge and mcp.
New Blocks!
Ok, first go into your main class. Type this above the load method:
public static Block ham;
This line says that "This is a block!"
Now below the load method, type these lines:
ham = new BlockHam(3000, Material.rock).setUnlocalizedName("ham");
GameRegistry.registerBlock(ham);
LanguageRegistry.addName(ham, "Block of Ham");
The line, is saying that ham id is 3000, the material should act like rock (stone) and it's code name is ham.
GameRegistry registers the block.
LanguageRegistry gives the block a name.
You should have an error under BlockHam. Create the class BlockHam.
Have the class extend Block, type extends Block after BlockHam
Add the constructor by hovering over BlockHam.
Now if you test the game, you should have a new block. (To find it, search in the search bar.)
Block Settings!
Now, you should already have a Block made. (If not, see my first tut)
Now, go to the line that says:
ham = new BlockHam(3000) etc.....
Now add to the end of the line, any of the following commands (most common)
public static CreativeTab pig = new TabPig("Pig", 20);
20 = ID
Pig = Unique Tab ID (Not to be confused with 20)
You should get an error under TabPig, so create the class. (TabPig)
Have the class extend CreativeTabs by typing:
extends CreativeTabs
Import creativeTabs, so your class should should look like this.
package piggy;
public class TabPig extends CreativeTabs{
}
You should get an error under TabPig. Add the constructor. The second one I believe.
Your class should look like this:
package piggy;
public class TabPig extends CreativeTabs{
public void TabPig(String label, int id){
super(label);
}
}
Now, to give it a name, add this to the class:
public void getTranslatedTabLabel(){
return "Piggy Tab";
}
Now if you test it out, you should get your tab!
Adding Stuff to your Custom Tab!
The easiest way, is to go into your BlockNAME or ItemNAME class.
Then, go into the constructor and type:
this.setCreativeTab(Main.pig);
New Ladders!
Ok, ladders are very easy to add. First create a normal block.
But in the line that has:
ladder = new BlockPigLadder(3001, Material.rock) etc...
Erase Material.rock.
Go into your Blockxxxx Class and have it extend BlockLadder instead of Block.
Smelting Recipes!
Go to your main class. Then type this in the load method:
Stick is what you put in, which must have a .blockID or .itemID after it because it's a integer, and Item.apple is what you receive. 3F, is a float, is how much XP you receive.
How to make more than 1 block (like serveral colored blocks, etc..)?
How to transform this in class file so I can use with other mods?
What do you mean, "more than one block"
Do something like this:
(Above the load method)
public static Block ham;
public static Block ham_red;
(Below)
ham = new BlockHam(3000, Material.rock).setUnlocalizedName("ham");
ham_red = new BlockHamRed(3001, Material.rock).setUnlocalizedName("ham_red");
GameRegistry.registerBlock(ham);
GameRegistry.registerBlock(ham_red);
LanguageRegistry.addName(ham, "Block of Ham");
LanguageRegistry.addName(ham_red, "Red Block of Ham");
New Blocks!
This line says that "This is a block!"
Now below the load method, type these lines:
ham = new BlockHam(3000, Material.rock).setUnlocalizedName("ham"); GameRegistry.registerBlock(ham); LanguageRegistry.addName(ham, "Block of Ham");The line, is saying that ham id is 3000, the material should act like rock (stone) and it's code name is ham.
GameRegistry registers the block.
LanguageRegistry gives the block a name.
You should have an error under BlockHam. Create the class BlockHam.
Have the class extend Block, type extends Block after BlockHam
Add the constructor by hovering over BlockHam.
Now if you test the game, you should have a new block. (To find it, search in the search bar.)
Now, go to the line that says:
Now add to the end of the line, any of the following commands (most common)
# = number
F = float, don't mind this.
public static CreativeTab pig = new TabPig("Pig", 20);20 = ID
Pig = Unique Tab ID (Not to be confused with 20)
You should get an error under TabPig, so create the class. (TabPig)
Have the class extend CreativeTabs by typing:
Import creativeTabs, so your class should should look like this.
package piggy; public class TabPig extends CreativeTabs{ }You should get an error under TabPig. Add the constructor. The second one I believe.
Your class should look like this:
package piggy; public class TabPig extends CreativeTabs{ public void TabPig(String label, int id){ super(label); } }Now, to give it a name, add this to the class:
public void getTranslatedTabLabel(){ return "Piggy Tab"; }Now if you test it out, you should get your tab!
Then, go into the constructor and type:
But in the line that has:
Erase Material.rock.
Go into your Blockxxxx Class and have it extend BlockLadder instead of Block.
Stick is what you put in, which must have a .blockID or .itemID after it because it's a integer, and Item.apple is what you receive. 3F, is a float, is how much XP you receive.
Planet Minecraft: GLStudios
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumYes, I forgot to add it to the post. Type this in the TabXXXXX class:
public int getTabIconItemIndex(){ return Item.leather.itemID; }Planet Minecraft: GLStudios
How to transform this in class file so I can use with other mods?
What do you mean, "more than one block"
Do something like this:
(Above the load method)
(Below)
ham = new BlockHam(3000, Material.rock).setUnlocalizedName("ham"); ham_red = new BlockHamRed(3001, Material.rock).setUnlocalizedName("ham_red"); GameRegistry.registerBlock(ham); GameRegistry.registerBlock(ham_red); LanguageRegistry.addName(ham, "Block of Ham"); LanguageRegistry.addName(ham_red, "Red Block of Ham");Transform so you can... What?
Planet Minecraft: GLStudios
I don't know how at the moment.
But take a look at BlockCrop or the tutorial on Forge Forums
Planet Minecraft: GLStudios