First you will need to name the the file, ModLoader mods HAVE to start with 'mod_' for the modloader to recognize it... otherwise the file is useless! Name it something that resembles what the mod is for... Eg. 'mod_CraftableFlint'
The necessary stuff
To start off scripting your mod, you will need to add two things... * = The mod name (mod_lol123 would be lol123)
public class mod_* extends BaseMod
{
and
public String Version()
{
return "1.3_01";
}
return "1.3_01"; will obviously be change to the current Minecraft version
Scripting the mod Thnx to Club559 for teaching me all of this!
Now lets get serious... Its scripting time!
If you're thinking of making a mod you will need to use at least one of the six main functions of the ModLoader...
public void AddRecipes(CraftingManager recipes)
public int AddSmelting(int id)
public int AddFuel(int id)
public void AddEntityID()
public void GenerateNether(World world, Random random, int chunkX, int chunkZ)
public void GenerateSurface(World world, Random random, int chunkX, int chunkZ)
Adding recipes
If you're creating a new block or item or just plain adding a recipe for glass or something you will need this!
Pretty much starts the whole recipe script, it tells the ModLoader that its adding a recipe
recipes.addRecipe(new ItemStack(Block.glass, 4), new Object[] {
This means the recipe will make 4 'glass' blocks, if you want an item use 'Item.[item]'
"# #", " # ", "# #", Character.valueOf('#')
This is the recipe, so the block or item will be crafted like this:
[]
[] []
[]
Block.sand
Thats the material that will be used in the crafting grid (as #)
});
Ends the recipe =D
Adding a fuel
Again the code is quite basic
public int AddFuel(int id)
{
if(id == Item.wheat.shiftedIndex)
{
return 600;
}
return 0;
}
if(id == Item.wheat.shiftedIndex)
This checks if 'wheat' is in the slot where fuel normally goes
return 600;
This is how long the fuel lasts...
Sticks = 100
Wood = 300
Coal = 1600
Lava = 20000
return 0;
This removes the item once it has been loaded as fuel (if its in a 64 stack it will go down to 63, then 62, ect.). This can also be used for adding one on... So if you put a diamond in and set the return to 2, it would gain 1 diamond (or 2... im not that sure how it works)
Add a smelting recipe
Once again, a very easy and basic script
public int AddSmelting(int id)
{
if(id == Block.gravel.blockID)
{
return Item.flint.shiftedIndex;
}
}
if(id == Block.gravel.blockID)
This checks if 'gravel' is in the 'to be smelted' slot
return Item.flint.shiftedIndex;
This makes the block/item be smelted into 'flint'
To do:
- How to create new blocks and add custom textures to it
- How to create new items and add custom icons to them
- How to add blocks to the map generation (I still have to learn this one)
You can post tutorials involving creating mods with the ModLoader here and I will add them to the index =)
i have mobs mod how can i make them compatible with modloader?
What mods do you have?
...also I think this information might be outdated >.<
EDIT: You have mob mods, here is a tutorial: viewtopic.php?f=25&t=102487#p1524660 Unfortunately its for a player mob so you might have to replace a few lines of code :wink.gif:
Great that your making a Tutorial, but I see you´re doing this with `names`. not the kind of class names minecraft is using. How do you convert it to names? MCP? (When I use mcp and use it with mod loader, it convert things like "func_443_init()")
There should be a tutorial for using mcp with the ModLoader... Its here: viewtopic.php?f=1036&t=177715 ...in the meantime I should add [MCP] to my title
i have mobs mod how can i make them compatible with modloader?
What mods do you have?
...also I think this information might be outdated >.<
EDIT: You have mob mods, here is a tutorial: viewtopic.php?f=25&t=102487#p1524660 Unfortunately its for a player mob so you might have to replace a few lines of code :wink.gif:
thats it : any tool making it compatible with modloader? because i dont know codes im using mob maker
i have mobs mod how can i make them compatible with modloader?
What mods do you have?
...also I think this information might be outdated >.<
EDIT: You have mob mods, here is a tutorial: viewtopic.php?f=25&t=102487#p1524660 Unfortunately its for a player mob so you might have to replace a few lines of code :wink.gif:
thats it : any tool making it compatible with modloader? because i dont know codes im using mob maker
Can someone please teach how to make a new block, in the map generator.
You see i made a new ore and i want to add it into the Ore Generation but i dont know how.
Try this:
public void GenerateSurface(dt world, Random random, int i, int j)
{
for(int k = 0; k < 10; k++)
{
int l = i + random.nextInt(16);
int i1 = random.nextInt(128);
int j1 = j + random.nextInt(16);
(new eb([ore name].bk, 8)).a(world, random, l, i1, j1);
}
}
Can someone please teach how to make a new block, in the map generator.
You see i made a new ore and i want to add it into the Ore Generation but i dont know how.
Try this:
public void GenerateSurface(dt world, Random random, int i, int j)
{
for(int k = 0; k < 10; k++)
{
int l = i + random.nextInt(16);
int i1 = random.nextInt(128);
int j1 = j + random.nextInt(16);
(new eb([ore name].bk, 8)).a(world, random, l, i1, j1);
}
}
That should generate it about the same as diamond
I tried it and its this part it says in Eclipse its wrong:
(new WorldGenMinable([onyxOre].TextureLavaFX, 8)).a(world, random, l, i1, j1);
more further
([onyxOre]
You dont put the ore name in square brackets! So like this:
public void GenerateSurface(dt world, Random random, int i, int j)
{
for(int k = 0; k < 10; k++)
{
int l = i + random.nextInt(16);
int i1 = random.nextInt(128);
int j1 = j + random.nextInt(16);
(new eb(onyxOre.bk, 8)).a(world, random, l, i1, j1);
}
}
public int AddSmelting(int id)
{
if(id == myitem1.shiftedIndex)
{
return myitem2.shiftedIndex;
}
}
This isn't working for me. It says that I'm "missing a return statement." I just pasted it at the bottom of my main class. I don't know what I'm doing lol.
public int AddSmelting(int id)
{
if(id == myitem1.shiftedIndex)
{
return myitem2.shiftedIndex;
}
}
This isn't working for me. It says that I'm "missing a return statement." I just pasted it at the bottom of my main class. I don't know what I'm doing lol.
You are missing a return statement... The return statement that tells the game how much fuel was lost
sooo...
[quote=bossangel6264764]
public int AddSmelting(int id)
{
if(id == myitem1.shiftedIndex)
{
return myitem2.shiftedIndex;
}
return 0; (0 = -1 with this return)
}
public int AddSmelting(int id)
{
if(id == myitem1.shiftedIndex)
{
return myitem2.shiftedIndex;
}
}
This isn't working for me. It says that I'm "missing a return statement." I just pasted it at the bottom of my main class. I don't know what I'm doing lol.
You are missing a return statement... The return statement that tells the game how much fuel was lost
sooo...
Quote from bossangel6264764 »
public int AddSmelting(int id)
{
if(id == myitem1.shiftedIndex)
{
return myitem2.shiftedIndex;
}
return 0; (0 = -1 with this return)
}
When I test my mod with MCP and put myitem1 into a Furnace with coal or wood or any fuel to power it, nothing happens. Here is the new code:
public int AddSmelting(int id)
{
if(id == myitem1.shiftedIndex)
{
return myitem2.shiftedIndex;
}
return 0;
}
If you need to know any addtional info, let me know. Thanks for the help!
public int AddSmelting(int id)
{
if(id == myitem1.shiftedIndex)
{
return myitem2.shiftedIndex;
}
}
This isn't working for me. It says that I'm "missing a return statement." I just pasted it at the bottom of my main class. I don't know what I'm doing lol.
You are missing a return statement... The return statement that tells the game how much fuel was lost
sooo...
Quote from bossangel6264764 »
public int AddSmelting(int id)
{
if(id == myitem1.shiftedIndex)
{
return myitem2.shiftedIndex;
}
return 0; (0 = -1 with this return)
}
When I test my mod with MCP and put myitem1 into a Furnace with coal or wood or any fuel to power it, nothing happens. Here is the new code:
public int AddSmelting(int id)
{
if(id == myitem1.shiftedIndex)
{
return myitem2.shiftedIndex;
}
return 0;
}
If you need to know any addtional info, let me know. Thanks for the help!
Oh god I almost forgot... there is a new code for the furnace!
So it would be like this:
public void AddRecipes(fr craftingmanager)
{
ModLoader.AddSmelting(item1.bc, new gz(ex.c[item2.bc]));
}
If you already have recipes in there just smash
ModLoader.AddSmelting(item1.bc, new gz(ex.c[item2.bc]));
public void GenerateSurface(dt world, Random random, int i, int j)
{
for(int k = 0; k < 10; k++)
{
int l = i + random.nextInt(16);
int i1 = random.nextInt(128);
int j1 = j + random.nextInt(16);
(new eb(BLOCKNAME.bk, 8)).a(world, random, l, i1, j1);
}
}
Index
Things you will need
Starting the mod
- Naming the mod
- The necessary stuff
Scripting the mod
- Adding recipes
- Adding a fuel
- Adding a smelting recipe
To do
Things you will need
- Risugami's ModLoader (v4 or v5, Id go with v5)
- A java compiler, I use DJ Java decompiler... It acts as an awesome compiler too (If you know how to work cmd use
javac.exe)
- Java JDK and Java JRE
- MCP setup with the ModLoader (viewtopic.php?f=1036&t=177715)
- A small amount of Java knowledge
Starting the mod
Naming the mod
First you will need to name the the file, ModLoader mods HAVE to start with 'mod_' for the modloader to recognize it... otherwise the file is useless! Name it something that resembles what the mod is for... Eg. 'mod_CraftableFlint'
The necessary stuff
To start off scripting your mod, you will need to add two things... * = The mod name (mod_lol123 would be lol123)
and
return "1.3_01"; will obviously be change to the current Minecraft version
Scripting the mod
Thnx to Club559 for teaching me all of this!
Now lets get serious... Its scripting time!
If you're thinking of making a mod you will need to use at least one of the six main functions of the ModLoader...
public void AddRecipes(CraftingManager recipes)
public int AddSmelting(int id)
public int AddFuel(int id)
public void AddEntityID()
public void GenerateNether(World world, Random random, int chunkX, int chunkZ)
public void GenerateSurface(World world, Random random, int chunkX, int chunkZ)
Adding recipes
If you're creating a new block or item or just plain adding a recipe for glass or something you will need this!
The script is pretty basic!
Pretty much starts the whole recipe script, it tells the ModLoader that its adding a recipe
This means the recipe will make 4 'glass' blocks, if you want an item use 'Item.[item]'
This is the recipe, so the block or item will be crafted like this:
[]
[] []
[]
Thats the material that will be used in the crafting grid (as #)
Ends the recipe =D
Adding a fuel
Again the code is quite basic
This checks if 'wheat' is in the slot where fuel normally goes
This is how long the fuel lasts...
Sticks = 100
Wood = 300
Coal = 1600
Lava = 20000
This removes the item once it has been loaded as fuel (if its in a 64 stack it will go down to 63, then 62, ect.). This can also be used for adding one on... So if you put a diamond in and set the return to 2, it would gain 1 diamond (or 2... im not that sure how it works)
Add a smelting recipe
Once again, a very easy and basic script
This checks if 'gravel' is in the 'to be smelted' slot
This makes the block/item be smelted into 'flint'
To do:
- How to create new blocks and add custom textures to it
- How to create new items and add custom icons to them
- How to add blocks to the map generation (I still have to learn this one)
You can post tutorials involving creating mods with the ModLoader here and I will add them to the index =)
<!-- l -->List of all my other mods,creations,maps,etc..:
viewtopic.php?f=1039&t=325080&p=4488802#p4488802
<!-- l -->What mods do you have?
...also I think this information might be outdated >.<
EDIT: You have mob mods, here is a tutorial: viewtopic.php?f=25&t=102487#p1524660 Unfortunately its for a player mob so you might have to replace a few lines of code :wink.gif:
There should be a tutorial for using mcp with the ModLoader... Its here: viewtopic.php?f=1036&t=177715 ...in the meantime I should add [MCP] to my title
thats it : any tool making it compatible with modloader? because i dont know codes im using mob maker
viewtopic.php?f=1032&t=214673
<!-- l -->List of all my other mods,creations,maps,etc..:
viewtopic.php?f=1039&t=325080&p=4488802#p4488802
<!-- l -->Well MCP helps A LOT... viewtopic.php?f=1036&t=177715
thanks alot gonna give it a try ! :smile.gif:
<!-- l -->List of all my other mods,creations,maps,etc..:
viewtopic.php?f=1039&t=325080&p=4488802#p4488802
<!-- l -->I'm trying to override a texture, but I can't figure out what after the block name:
The rest I've figured out.
It should be like this:
Or something like that
Try this:
That should generate it about the same as diamond
isn't working for me.
Apparently I need something other than "b" after the block name. What does "b" mean?
I dont know what b means but try this one:
You dont put the ore name in square brackets! So like this:
This isn't working for me. It says that I'm "missing a return statement." I just pasted it at the bottom of my main class. I don't know what I'm doing lol.
You are missing a return statement... The return statement that tells the game how much fuel was lost
sooo...
[quote=bossangel6264764]
When I test my mod with MCP and put myitem1 into a Furnace with coal or wood or any fuel to power it, nothing happens. Here is the new code:
If you need to know any addtional info, let me know. Thanks for the help!
Oh god I almost forgot... there is a new code for the furnace!
So it would be like this:
If you already have recipes in there just smash
in there as if its a new recipe!
ModLoader.AddSmelting(myitem1.bc, new gz(ex.c[myitem2.bc]));
And it didn't work, so I sat thinking...until I realized that I was stupid and fixed it:
ModLoader.AddSmelting(item1.shiftedIndex, new ItemStack(item2));
Thanks!
Does this code work for modloader?
Lots More Humans (Beta 1.5_01)