- 13,275 views, 2 today
- 852 downloads, 0 today
1,046
The Creative API can use for adding custom Blocks and Items to the Creative Mode inventory.
User have to install the API like Modloader if they want to use Mods working with this API.
Tutorial for modder:
Install the API like Modloader in the minecraft.jar before using MCP.
Add in the constructor of your mod_ file the following:
add simple blocks:
CreativeAPI.addBlock(yourBlock);
add blocks with subtypes (like wool):
CreativeAPI.addBlock(yourBlock, 1);
add items with subtypes (like dyes or charcoal):
CreativeAPI.addItem(yourItem, 1);
Regular items don't need to add!
Pro-Tipp:
Use try/catch to avoid minecraft crashing, for user they won't play in Creative Mode or install the API.
Example:
public class mod_YourMod extends BaseMod
{
public static final Block yourBlock= new Block(200);
public mod_YourMod ()
{
ModLoader.RegisterBlock(yourBlock);
ModLoader.AddName(yourBlock, "Block Name");
ModLoader.AddRecipe(...);
try
{
CreativeAPI.addBlock(yourBlock);
CreativeAPI.addItem(Item.coal, 1);
} catch (NoClassDefFoundError e)
{
ModLoader.getLogger().fine((new StringBuilder("Creative API not found! ")).toString());
}
}
public String Version()
{
return "1.2.4";
}
}
User have to install the API like Modloader if they want to use Mods working with this API.
Tutorial for modder:
Install the API like Modloader in the minecraft.jar before using MCP.
Add in the constructor of your mod_ file the following:
add simple blocks:
CreativeAPI.addBlock(yourBlock);
add blocks with subtypes (like wool):
CreativeAPI.addBlock(yourBlock, 1);
add items with subtypes (like dyes or charcoal):
CreativeAPI.addItem(yourItem, 1);
Regular items don't need to add!
Pro-Tipp:
Use try/catch to avoid minecraft crashing, for user they won't play in Creative Mode or install the API.
Example:
public class mod_YourMod extends BaseMod
{
public static final Block yourBlock= new Block(200);
public mod_YourMod ()
{
ModLoader.RegisterBlock(yourBlock);
ModLoader.AddName(yourBlock, "Block Name");
ModLoader.AddRecipe(...);
try
{
CreativeAPI.addBlock(yourBlock);
CreativeAPI.addItem(Item.coal, 1);
} catch (NoClassDefFoundError e)
{
ModLoader.getLogger().fine((new StringBuilder("Creative API not found! ")).toString());
}
}
public String Version()
{
return "1.2.4";
}
}
Progress | 100% complete |
Game Version | Minecraft 1.2.5 |
Tags |
5 Update Logs
Update #5 : by pitman-87 04/04/2012 1:21:29 pmApr 4th, 2012
update 1.2.5
LOAD MORE LOGS
tools/tracking
245220
7
creative-api
Create an account or sign in to comment.
But i gonna let this mod die with next mc version, because there is a way with modloader to add blocks in creative.