158
hey everyone. Today I'm going to be showing you how to make a new block with the properties of stone. Let's get started.
we need 2 classes to make a block
Blockyourblock and mod_yourblock
mod_yourblock
just like always we need our mod_ classes to extend basemod, have load, and have getversion
after that you need to add this in the load method
yourblock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/yourblock.png");
ModLoader.registerBlock(yourblock);
ModLoader.addName(yourblock, "yourblock");
on the first/second line you see the addoverride method
this means that blocks are normally on terrain.png and you are overriding that and saying instead you want it to show yourblock.png
then on the rest we are just registering and adding a name to the block
next we need to add this but not inside load
public static final Block yourblock = new Blockyourblock(160, 0).setBlockName("yourblock").setHardness(3F).setResistance(4F).setLightValue(1F);
this is giving the block all of its properties
160 is the block id and the others set the name,how hard it it,how much blast resistance it has, and how much light it puts out.
your mod_ class should now look like this
now the blockyourblock class
copy and paste this in to start
then you need this
public BlockNamehere(int i, int j)
{
super(i, j, Material.stone);
}
public int idDropped(int i, Random random, int j)
{
return mod_yourblock.yourblock.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}}
this says the material, what it drops, and how much it drops
here is how it should look when its done
thanks for reading.Leave any error code in the comments along with suggestions for new tutorials,and as always diamond and subscribe!!!
p.s. the tutorials will be continuing on youtube so I don't have too many on my profile
and sorry about the tutorial being sloppy because I am really sick
we need 2 classes to make a block
Blockyourblock and mod_yourblock
mod_yourblock
just like always we need our mod_ classes to extend basemod, have load, and have getversion
mod_ start
package net.minecraft.src;
public class mod_yourblock extends BaseMod
{
public void load()
{
}
public String getVersion()
{
return "1.2.5";
}
}
public class mod_yourblock extends BaseMod
{
public void load()
{
}
public String getVersion()
{
return "1.2.5";
}
}
after that you need to add this in the load method
yourblock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/yourblock.png");
ModLoader.registerBlock(yourblock);
ModLoader.addName(yourblock, "yourblock");
on the first/second line you see the addoverride method
this means that blocks are normally on terrain.png and you are overriding that and saying instead you want it to show yourblock.png
then on the rest we are just registering and adding a name to the block
next we need to add this but not inside load
public static final Block yourblock = new Blockyourblock(160, 0).setBlockName("yourblock").setHardness(3F).setResistance(4F).setLightValue(1F);
this is giving the block all of its properties
160 is the block id and the others set the name,how hard it it,how much blast resistance it has, and how much light it puts out.
your mod_ class should now look like this
mod_ finished
package net.minecraft.src;
public class mod_Block extends BaseMod
{
public static final Block yourblock = new Blockyourblock(160, 0).setBlockName("yourblock").setHardness(3F).setResistance(4F).setLightValue(1F);
public void load()
{
Namehere.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/yourblock.png");
ModLoader.registerBlock(yourblock);
ModLoader.addName(yourblock, "yourblock");
}
public String getVersion()
{
return "1.2.5";
}
}
public class mod_Block extends BaseMod
{
public static final Block yourblock = new Blockyourblock(160, 0).setBlockName("yourblock").setHardness(3F).setResistance(4F).setLightValue(1F);
public void load()
{
Namehere.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/yourblock.png");
ModLoader.registerBlock(yourblock);
ModLoader.addName(yourblock, "yourblock");
}
public String getVersion()
{
return "1.2.5";
}
}
now the blockyourblock class
copy and paste this in to start
Blockyourblock start
package net.minecraft.src;
import java.util.Random;
public class Blockyourblock extends Block
{
import java.util.Random;
public class Blockyourblock extends Block
{
then you need this
public BlockNamehere(int i, int j)
{
super(i, j, Material.stone);
}
public int idDropped(int i, Random random, int j)
{
return mod_yourblock.yourblock.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}}
this says the material, what it drops, and how much it drops
here is how it should look when its done
Blockyourblock finished
package net.minecraft.src;
import java.util.Random;
public class Blockyourblock extends Block
{
public Blockyourblock(int i, int j)
{
super(i, j, Material.stone);
}
public int idDropped(int i, Random random, int j)
{
return mod_yourblock.yourblock.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}}
import java.util.Random;
public class Blockyourblock extends Block
{
public Blockyourblock(int i, int j)
{
super(i, j, Material.stone);
}
public int idDropped(int i, Random random, int j)
{
return mod_yourblock.yourblock.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}}
thanks for reading.Leave any error code in the comments along with suggestions for new tutorials,and as always diamond and subscribe!!!
p.s. the tutorials will be continuing on youtube so I don't have too many on my profile
and sorry about the tutorial being sloppy because I am really sick
Tags |
tools/tracking
841997
6
modding-tutorials-3-blocks
Create an account or sign in to comment.
What do we change to show what it drops?like rename what? *The return mod_yourblock.yourblock.blockID.Replace with a number?*
EDIT: Nevermind a video you made helped........