- 3
- 0
- 8
327
Number 2 of this whole series. Please if you have any errors / problems just comment or PM me :)
YOU MUST READ THE FIRST TUTORIAL IF YOU DON'T KNOW HOW TO SET UP MCP with ECLIPSE!!!
So today we are going to make a new simple block with the statistics as like pretty much a normal block.
You must create two files. One being the main ModLoader class extender, and the Block file.
Open these spoilers to get the code. The " // " means a comment AKA it's just explaining. The code doesn't read the comments. So these are pretty safe to copy and paste.
BUT SINCE THIS IS A CUSTOM BLOCK USING THE BLOCK.CLASS YOU DO NOT NEED TO MAKE A NEW BLOCK!!!! :D
YOU MUST READ THE FIRST TUTORIAL IF YOU DON'T KNOW HOW TO SET UP MCP with ECLIPSE!!!
So today we are going to make a new simple block with the statistics as like pretty much a normal block.
You must create two files. One being the main ModLoader class extender, and the Block file.
Open these spoilers to get the code. The " // " means a comment AKA it's just explaining. The code doesn't read the comments. So these are pretty safe to copy and paste.
BUT SINCE THIS IS A CUSTOM BLOCK USING THE BLOCK.CLASS YOU DO NOT NEED TO MAKE A NEW BLOCK!!!! :D
mod_YOURMOD [Change YOURMOD to any name
[Change NAME to your block name!]]
package net.minecraft.src;
public class mod_YOURMOD extends BaseMod
{
public static final Block NAME = (new Block (175, ModLoader.addOverride("/terrain.png", "/a.png")).setBlockName("NAME").setHardness(1F).setResistance(1F));
//Hardness means how long it takes to break. 1F means gravel with hand.
//Resistance means TNT / Creeper protection. 1F means instant break ROFL.
//Every new block with .setBlockName NEEDS TO BE DIFFERENT!!!
// 150 is the ID number. Blocks must be around 150 - 256.
//Block picture is the picture so if its a.png your have to create a a.png inside the mod contents.
public mod_YOURMOD()
{
ModLoader.registerBlock(NAME);
//Change the INGAMENAME to the name you want it to be in the game. ironBlock = Block of Iron.
ModLoader.addName(NAME, "INGAMENAME");
ModLoader.addRecipe(new ItemStack(NAME, 1), new Object [] {
"XXX", "YYY", "XXX", 'X', Block.stone, 'Y', Block.dirt });
// Now recipes are the confusing part. "" means the recipe. '' means the block.
// So XXX YYY XXX means the first layer second layer then the third layer.
// XXX So the X is stone. And the Y is dirt. And that makes the BLOCK!
// YYY
// XXX
// The NAME, 1 means How many this recipe creates. If you change 1 to 16 it will create 16. DO NOT MAKE IT OVER 64!
}
public void load()
{ //Just ModLoader configuration. Not required. Unless you want to rofl.
}
public String getVersion()
{
return "1.4.5"; //Make this the latest minecraft version or the current one.
}
}
package net.minecraft.src;
public class mod_YOURMOD extends BaseMod
{
public static final Block NAME = (new Block (175, ModLoader.addOverride("/terrain.png", "/a.png")).setBlockName("NAME").setHardness(1F).setResistance(1F));
//Hardness means how long it takes to break. 1F means gravel with hand.
//Resistance means TNT / Creeper protection. 1F means instant break ROFL.
//Every new block with .setBlockName NEEDS TO BE DIFFERENT!!!
// 150 is the ID number. Blocks must be around 150 - 256.
//Block picture is the picture so if its a.png your have to create a a.png inside the mod contents.
public mod_YOURMOD()
{
ModLoader.registerBlock(NAME);
//Change the INGAMENAME to the name you want it to be in the game. ironBlock = Block of Iron.
ModLoader.addName(NAME, "INGAMENAME");
ModLoader.addRecipe(new ItemStack(NAME, 1), new Object [] {
"XXX", "YYY", "XXX", 'X', Block.stone, 'Y', Block.dirt });
// Now recipes are the confusing part. "" means the recipe. '' means the block.
// So XXX YYY XXX means the first layer second layer then the third layer.
// XXX So the X is stone. And the Y is dirt. And that makes the BLOCK!
// YYY
// XXX
// The NAME, 1 means How many this recipe creates. If you change 1 to 16 it will create 16. DO NOT MAKE IT OVER 64!
}
public void load()
{ //Just ModLoader configuration. Not required. Unless you want to rofl.
}
public String getVersion()
{
return "1.4.5"; //Make this the latest minecraft version or the current one.
}
}
3 Update Logs
Update #3 : by Twinklez 12/07/2012 11:42:26 pmDecember 8, 2012 @ 4:42 am UTC
Changed methods for easier learning.
LOAD MORE LOGS
More like this
1698846
6



Have something to say?
Javascript = Programming for mostly websites.
BUT THEY ARE SUPER DIFFERENT.