Minecraft / Mods

Creative API

  • 6
  • 1
  • comment17
  • playlist_add
  • share
  • more_horiz
avatar pitman-87
Level 87 : Elite Programmer
1,041
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";
}

}
Progress100% complete
Game VersionMinecraft 1.2.5
Tags

5 Update Logs

Update #5 : 04/04/2012 1:21:29 pmApr 4th, 2012

update 1.2.5
LOAD MORE LOGS

17 replies

1
05/27/2012 4:51 am
Level 60 : High Grandmaster Programmer
NuclearBanana
well, you don't need this api because it automaticly puts it in creative menu
1
05/27/2012 4:59 am
Level 87 : Elite Programmer
pitman-87
Only Items!

But i gonna let this mod die with next mc version, because there is a way with modloader to add blocks in creative.
1
06/12/2012 5:51 pm
Level 11 : Journeyman Narwhal
corytrain
how?
1
05/27/2012 5:27 am
Level 60 : High Grandmaster Programmer
NuclearBanana
hey pitman. I love ur mods and everything...do you want to be in team with me? that means to make mods together? I'm honest and i never ever told a lie, realy! PM me for an awnser, thanks :D
1
05/27/2012 7:13 am
Level 87 : Elite Programmer
pitman-87
Thx, but I have enough projects and I prefer to work alone :)
1
05/27/2012 8:53 am
Level 60 : High Grandmaster Programmer
NuclearBanana
Oh please, please..anything
1
03/25/2012 4:41 pm
Level 33 : Artisan Pokemon
reece2004
Video
1
05/21/2012 4:46 am
Level 15 : Journeyman Unicorn
burnner
stupid?
1
03/25/2012 12:42 pm
Level 37 : Artisan Modder
TheRoanldo
Thanks :D
1
03/04/2012 2:07 pm
Level 1 : New Miner
kristofferlw
i dont understand what its do. can you tel me plz?
1
12/12/2011 10:59 pm
Level 1 : New Miner
jonee140
can this work with pplz servers
1
11/26/2011 1:45 am
Level 33 : Artisan Narwhal
Hemasho
Really cool! I am kinda new to modding and was wondering how you make an API. I don't know if I would make one but it just puzzles me kinda. I think I have an idea on how to but I'm not sure. Keep up the great work!
1
10/11/2011 1:33 pm
Level 47 : Master Technomancer
Nonex359
Thanks alot :D
1
10/11/2011 12:31 pm
Level 47 : Master Technomancer
Nonex359
ok now i have it but it says something about javac.exe not found.what do i do?
1
10/11/2011 1:08 pm
Level 87 : Elite Programmer
pitman-87
1
10/11/2011 1:47 am
Level 47 : Master Technomancer
Nonex359
Where do i get mcp
1
10/11/2011 7:47 am
Level 87 : Elite Programmer
pitman-87

Planet Minecraft

Browse

Site

© 2010 - 2019
planetminecraft.com

Welcome