Hi and welcome to my modding tutorials. I will be making lots of tutorials using modloader. If you have any errors questions or ideas for my next tutorial let me no. NO negative comments please!
Tutorials:
How to make a block.
How to make a item.
How to Make a New Kind of Grass!
Working on How to make NPC's
Just tell me what you want me to do next!
One is the block class and one to be a mod class. I'll explan what a mod class is later.
So first I'll show you how to make the block class.
So this part is simple.
First lets look at the dirt file. Its called BlockDirt
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
// Referenced classes of package net.minecraft.src:
// Block, Material
public class BlockDirt extends Block
{
protected BlockDirt(int i, int j)
{
super(i, j, Material.ground);
}
}
Ok so the two BlockDirt thouse need to be the name of the file. The Material.ground is not that inportant if you want it to be easy to mine with a pick change the ground to rock.
So now lets make a new block so the first thing to do is think of a name for you mod. For this tutorial Im going to make it be called myblock so the file will be named Blockmyblock. Note this will not be the name it says in minecraft.
So All is you need is this part in your class file.
package net.minecraft.src;
public class BlockDirt extends Block
{
protected BlockDirt(int i, int j)
{
super(i, j, Material.ground);
}
}
So sence my file is called Blockmyblock this is what mine looks like.
package net.minecraft.src;
public class Blockmyblock extends Block
{
protected Blockmyblock(int i, int j)
{
super(i, j, Material.ground);
}
}
So thats realy it. For making the block class anyways.
Now for the hard part the mod class.
Now the reason why I call it the mod class is because you always have to have mod_ in front of the name. So im going to name mine mod_myblock because my block is called myblock in the Block class.
Here Is what it looks like for my file.
//Script by tayler6000
package net.minecraft.src;
import java.util.Random;
public class mod_myblock extends BaseMod
{
public static final Block Blockmyblock = new Blockmyblock(1000,0).setHardness(0.5F).setResistance(0.0F).setBlockName("Blockmyblock");
public mod_myblock()
{
//This registers our new block
ModLoader.RegisterBlock(Blockmyblock);
//This overrides the texture pack (called terrain.png), and adds our custom texture (called henryBlock.png)
Blockmyblock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/MyMod/BlockMyblock.png");
//This adds the in game name to our block the word/s in "'s is what it is ingame.
ModLoader.AddName(Blockmyblock, "MY BLOCK");
//This adds a crafting recipe for the block this resipe alows you to make 4 of these blocks with one dirt
ModLoader.AddRecipe(new ItemStack(Blockmyblock, 4), new Object[] {
"*", Character.valueOf('*'), Block.dirt
});
}
public String Version()
{
return "3.14159265";
}
}
So all of this is confusing to you? Dont worry when I saw this the first time I freaked out too. So let me explain this to you.
so the first number you see, 1000, is the block id the second number wich is 0 is what place it is in so 0 is the first block. If your making seperit images for each block leave it at 0. the setHardness is how hard it is to brake. The setResistance is how much tnt resistant it is. I think obsidian is 4000 but im not shure... It says what every thing else is. So now you make your texture so copy one block in the texture.png file. and make a new png file and put it in there. and change it to however you want. THEN DO RECOMPILE AND REBOF AND YOU SHOULD BE GOOD!!! If you get any errors let me know!
I take it all you're going to show us is how to make a new block and Item?
It's not your fault.. but Honestly, It's not really considered a great skill anymore to be able to make new blocks or items...
Nope I know how to make lots of things like making armor and tools and all kinds of things I just want to know what other people want me to make a tutorial about.
So here is the item code mine will be named ItemMyItem
//Script by tayler6000
package net.minecraft.src;
public class ItemMyItem extends Item
{
public ItemMyItem(int i)
{
super(i);
maxStackSize = 64;
}
}
Simple right? The maxStackSize is how much it could be stalked to. A ingot is 64 and and a picaxe or food is 1. Simple. So now for the hard part the mod class mine will be named mod_MyItem
//Script by tayler6000
package net.minecraft.src;
public class mod_MyItem extends BaseMod
{
public static final Item ItemMyItem = new ItemMyItem(6003).setItemName("ItemMyItem");
public mod_MyItem()
{
//The only thing differnt here is that it says .iconIndex instead. Well its the same thing just sence its a item its differnt.
ItemMyItem.iconIndex = ModLoader.addOverride("/gui/items.png", "/MyMod/MyItem.png");
ModLoader.AddName(ItemMyItem, "My Item");
ModLoader.AddRecipe(new ItemStack(ItemMyItem, 1), new Object[] {
"*", Character.valueOf('*'), Block.dirt
});
}
public String Version()
{
return "3.14159265";
}
}
So thats realy it all you have to do is make the texture make it 16x16. Good luck!
Could you maybe add a tutorial on making a new bow(gun) and a new type of arrow(bullet) for it? I've been trying to make a gun for my mod and I can't find any tutorial that has that.
Could you maybe add a tutorial on making a new bow(gun) and a new type of arrow(bullet) for it? I've been trying to make a gun for my mod and I can't find any tutorial that has that.
Hmmm... I did find one tutorial on this but it was not finnised but Im looking in to this for my mod midgard (My signiture has a link to it its the image click on it!) so when I find out how I will be shure to do it!
Hmmm... I did find one tutorial on this but it was not finnised but Im looking in to this for my mod midgard (My signiture has a link to it its the image click on it!) so when I find out how I will be shure to do it!
Dont worry this is not hard to do you just need to know what your doing!
Ok so to make grass you need a new kind of dirt for it to spread to right so first lets do that! Mine will be called My Dirt so there for the file will be called BlockMyDirt
//Script by tayler6000
package net.minecraft.src;
public class BlockMyDirt extends Block
{
protected BlockMyDirt(int i, int j)
{
super(i, j, Material.ground);
}
}
So thats how you make the dirt. Easy right? But before we make the grass block we need to make the mod class. Lets call ours mod_Ground
//Script by tayler6000
package net.minecraft.src;
import java.util.Random;
public class mod_Ground extends BaseMod
{
public static final Block MyGrass = new BlockMyGrass(131,0).setHardness(0.8F).setResistance(0.2F).setBlockName("MyGrass");
public static final Block MyDirt = new BlockMyDirt(132,0).setHardness(0.7F).setResistance(0.2F).setBlockName("MyDirt");
public mod_Ground()
{
ModLoader.RegisterBlock(MyGrass);
ModLoader.RegisterBlock(MyDirt);
MyGrass.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/MyGround/MyGrass.png");
MyDirt.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/MyGround/MyDirt.png");
ModLoader.AddName(MyGrass, "My Grass");
ModLoader.AddName(MyDirt, "My Dirt");
}
public String Version()
{
return "3.14159265";
}
}
Ok that part should be review. Now for the grass class(lol that rimes!)
package net.minecraft.src;
import java.util.Random;
public class BlockMyGrass extends Block
{
protected BlockMyGrass(int i)
{
super(i, Material.grassMaterial);
//The 3 makes the sides be the 4th texture(the first texture is 0)
blockIndexInTexture = 3;
setTickOnLoad(true);
}
public int getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
// The 0 stands for the texture on the top so the first block
if(l == 1)
{
return 0;
}
// The 2 here stards for the texture on the bottem
if(l == 0)
{
return 2;
}
Material material = iblockaccess.getBlockMaterial(i, j + 1, k);
return material != Material.snow && material != Material.builtSnow ? 3 : 68;
}
public int colorMultiplier(IBlockAccess iblockaccess, int i, int j, int k)
{
//This changers the color for differnt biomes.
iblockaccess.getWorldChunkManager().func_4069_a(i, k, 1, 1);
double d = iblockaccess.getWorldChunkManager().temperature[0];
double d1 = iblockaccess.getWorldChunkManager().humidity[0];
return ColorizerGrass.getGrassColor(d, d1);
}
public void updateTick(World world, int i, int j, int k, Random random)
{
if(world.multiplayerWorld)
{
return;
}
if(world.getBlockLightValue(i, j + 1, k) < 4 && Block.lightOpacity[world.getBlockId(i, j + 1, k)] > 2)
{
if(random.nextInt(4) != 0)
{
return;
}
//This part here talks about what it spreads to!
world.setBlockWithNotify(i, j, k, mod_Ground.MyDirt.blockID);
} else
if(world.getBlockLightValue(i, j + 1, k) >= 9)
{
int l = (i + random.nextInt(3)) - 1;
int i1 = (j + random.nextInt(5)) - 3;
int j1 = (k + random.nextInt(3)) - 1;
int k1 = world.getBlockId(l, i1 + 1, j1);
if(world.getBlockId(l, i1, j1) == mod_Ground.MyDirt.blockID && world.getBlockLightValue(l, i1 + 1, j1) >= 4 && Block.lightOpacity[k1] <= 2)
{
world.setBlockWithNotify(l, i1, j1, mod_Ground.MyGrass.blockID);
}
}
}
//This tells it what to drop when you brake the grass!
public int idDropped(int i, Random random)
{
return mod_Ground.MyDirt.idDropped(0, random);
}
}
Dont worry this is not hard to do you just need to know what your doing!
Ok so to make grass you need a new kind of dirt for it to spread to right so first lets do that! Mine will be called My Dirt so there for the file will be called BlockMyDirt
//Script by tayler6000
package net.minecraft.src;
public class BlockMyDirt extends Block
{
protected BlockMyDirt(int i, int j)
{
super(i, j, Material.ground);
}
}
So thats how you make the dirt. Easy right? But before we make the grass block we need to make the mod class. Lets call ours mod_Ground
//Script by tayler6000
package net.minecraft.src;
import java.util.Random;
public class mod_Ground extends BaseMod
{
public static final Block MyGrass = new BlockMyGrass(131,0).setHardness(0.8F).setResistance(0.2F).setBlockName("MyGrass");
public static final Block MyDirt = new BlockMyDirt(132,0).setHardness(0.7F).setResistance(0.2F).setBlockName("MyDirt");
public mod_Ground()
{
ModLoader.RegisterBlock(MyGrass);
ModLoader.RegisterBlock(MyDirt);
MyGrass.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/MyGround/MyGrass.png");
MyDirt.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/MyGround/MyDirt.png");
ModLoader.AddName(MyGrass, "My Grass");
ModLoader.AddName(MyDirt, "My Dirt");
}
public String Version()
{
return "3.14159265";
}
}
Ok that part should be review. Now for the grass class(lol that rimes!)
package net.minecraft.src;
import java.util.Random;
public class BlockMyGrass extends Block
{
protected BlockMyGrass(int i)
{
super(i, Material.grassMaterial);
//The 3 makes the sides be the 4th texture(the first texture is 0)
blockIndexInTexture = 3;
setTickOnLoad(true);
}
public int getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
// The 0 stands for the texture on the top so the first block
if(l == 1)
{
return 0;
}
// The 2 here stards for the texture on the bottem
if(l == 0)
{
return 2;
}
Material material = iblockaccess.getBlockMaterial(i, j + 1, k);
return material != Material.snow && material != Material.builtSnow ? 3 : 68;
}
public int colorMultiplier(IBlockAccess iblockaccess, int i, int j, int k)
{
//This changers the color for differnt biomes.
iblockaccess.getWorldChunkManager().func_4069_a(i, k, 1, 1);
double d = iblockaccess.getWorldChunkManager().temperature[0];
double d1 = iblockaccess.getWorldChunkManager().humidity[0];
return ColorizerGrass.getGrassColor(d, d1);
}
public void updateTick(World world, int i, int j, int k, Random random)
{
if(world.multiplayerWorld)
{
return;
}
if(world.getBlockLightValue(i, j + 1, k) < 4 && Block.lightOpacity[world.getBlockId(i, j + 1, k)] > 2)
{
if(random.nextInt(4) != 0)
{
return;
}
//This part here talks about what it spreads to!
world.setBlockWithNotify(i, j, k, mod_Ground.MyDirt.blockID);
} else
if(world.getBlockLightValue(i, j + 1, k) >= 9)
{
int l = (i + random.nextInt(3)) - 1;
int i1 = (j + random.nextInt(5)) - 3;
int j1 = (k + random.nextInt(3)) - 1;
int k1 = world.getBlockId(l, i1 + 1, j1);
if(world.getBlockId(l, i1, j1) == mod_Ground.MyDirt.blockID && world.getBlockLightValue(l, i1 + 1, j1) >= 4 && Block.lightOpacity[k1] <= 2)
{
world.setBlockWithNotify(l, i1, j1, mod_Ground.MyGrass.blockID);
}
}
}
//This tells it what to drop when you brake the grass!
public int idDropped(int i, Random random)
{
return mod_Ground.MyDirt.idDropped(0, random);
}
}
Now you just make the texture and your done!
Ermm.. can u show me an example on how to make the texture and where to put the textures in which folder? and also plz add screenshots. THX :biggrin.gif:
Tutorials:
How to make a block.
How to make a item.
How to Make a New Kind of Grass!
Working on How to make NPC's
Just tell me what you want me to do next!
This is a bacic tutorial.
To do this you need two new java files.
One is the block class and one to be a mod class. I'll explan what a mod class is later.
So first I'll show you how to make the block class.
So this part is simple.
First lets look at the dirt file. Its called BlockDirt
Ok so the two BlockDirt thouse need to be the name of the file. The Material.ground is not that inportant if you want it to be easy to mine with a pick change the ground to rock.
So now lets make a new block so the first thing to do is think of a name for you mod. For this tutorial Im going to make it be called myblock so the file will be named Blockmyblock. Note this will not be the name it says in minecraft.
So All is you need is this part in your class file.
So sence my file is called Blockmyblock this is what mine looks like.
So thats realy it. For making the block class anyways.
Now for the hard part the mod class.
Now the reason why I call it the mod class is because you always have to have mod_ in front of the name. So im going to name mine mod_myblock because my block is called myblock in the Block class.
Here Is what it looks like for my file.
So all of this is confusing to you? Dont worry when I saw this the first time I freaked out too. So let me explain this to you.
so the first number you see, 1000, is the block id the second number wich is 0 is what place it is in so 0 is the first block. If your making seperit images for each block leave it at 0. the setHardness is how hard it is to brake. The setResistance is how much tnt resistant it is. I think obsidian is 4000 but im not shure... It says what every thing else is. So now you make your texture so copy one block in the texture.png file. and make a new png file and put it in there. and change it to however you want. THEN DO RECOMPILE AND REBOF AND YOU SHOULD BE GOOD!!! If you get any errors let me know!
It's not your fault.. but Honestly, It's not really considered a great skill anymore to be able to make new blocks or items...
Nope I know how to make lots of things like making armor and tools and all kinds of things I just want to know what other people want me to make a tutorial about.
This isn't to differnt from making a block.
So here is the item code mine will be named ItemMyItem
Simple right? The maxStackSize is how much it could be stalked to. A ingot is 64 and and a picaxe or food is 1. Simple. So now for the hard part the mod class mine will be named mod_MyItem
So thats realy it all you have to do is make the texture make it 16x16. Good luck!
Can you make a tutorial on how to make a block which takes the shape of stairs, but is upside down?
So, in other words, how to make an upside down stairs block :biggrin.gif:
I am 100% sure there is no other tutorial out showing how to do this.
Yes I can do this It will take some reserch but check back soon to see if its done!
Yes I can do this I do know how to make things like snails I will do this for you. If you want me to make a sertin animal let me know.
Hmmmm Im looking at the source code for the stairs kindof wiered. And why do you want it upside down???
Hmmm... I did find one tutorial on this but it was not finnised but Im looking in to this for my mod midgard (My signiture has a link to it its the image click on it!) so when I find out how I will be shure to do it!
Sounds great :smile.gif:
Coz a block that took the shape of upside down stairs would allow for many improvements to buildings etc and allow more creativity.
Dont worry this is not hard to do you just need to know what your doing!
So thats how you make the dirt. Easy right? But before we make the grass block we need to make the mod class. Lets call ours mod_Ground
Ok that part should be review. Now for the grass class(lol that rimes!) Now you just make the texture and your done!
I am abit confused. If you don't you can just write how to add new arrows and entities.
Ermm.. can u show me an example on how to make the texture and where to put the textures in which folder? and also plz add screenshots. THX :biggrin.gif: