public class mod_coal extends BaseMod
{
public static final Block CoalBlock = new BlockCoal(97,0).setHardness(0.1F).setResistance(1.0F).setBlockName("CoalBlock");
public mod_coal()
{
ModLoader.RegisterBlock(CoalBlock);
CoalBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/coalBlock.png");
ModLoader.AddName(CoalBlock, "Coal Block");
Well I tested the code, the only thing I had to change was the ID number, try a high number like 250 because I believe the ID you used is already taken by a vanilla item.
Also make sure you have the image inside your minecraft.jar or when you run the client it will crash.
package net.minecraft.src;
import java.util.Random;
public class mod_coal extends BaseMod
{
public static final Block CoalBlock = new BlockCoal(97,0).setHardness(0.1F).setResistance(1.0F).setBlockName("CoalBlock");
public mod_coal()
{
ModLoader.RegisterBlock(CoalBlock);
CoalBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/coalBlock.png");
ModLoader.AddName(CoalBlock, "Coal Block");
ModLoader.AddRecipe(new ItemStack(CoalBlock, 1), new Object []{
"%%%", "%%%", "%%%", Character.valueOf('%'), Item.coal
});
}
public String Version()
{
return "3.14159265";
}
}
AND
package net.minecraft.src;
import java.util.Random;
public class BlockCoal extends Block
{
protected BlockCoal(int i, int j)
{
super(i,j,Material.wood);
}
public int idDropped(int i, Random random)
{
return Item.coal.shiftedIndex;
}
public int quantityDropped(Random random)
{
return 9;
}
}
BUT WHEN I TEST IT, IT DOSN'T WORK. WTF IS WRONG!!!!!!!!!!!!!!!!
Also make sure you have the image inside your minecraft.jar or when you run the client it will crash.