Minecraft Blogs

modding tutorial 4:food

  • 3
  • 1
  • 2
avatar waterskier
Level 54 : Grandmaster Pony
Hey everyone I have another tutorial for you. In this one I will teach you how to make food. From now on instead of doing something like yourore in the name I will do something like copperore. In this one I will make a cheeseburger. Let's get started.

this should be very easy for you guys we only need 1 class
first we need to add our getversion and load methods and then it should look like this
mod_cheeseburger 1

after that we need to put this into the class
public static final Item cheeseburger = new ItemFood(165, 4, 1F, false).setItemName("cheeseburger");
this is saying we have a new item and it's not a normal item it's a food item
then we tell the game about what the food does with 3 integers and a boolean (see bottom)
the first int is the item id
the second is how many chicken legs it heals but if the integer is 2 then it heals 1 chicken leg 4=2 6=3 ect.
the third is the saturation (invisible bar that tells the food bar when to lose a chicken leg)
the boolean is weather or not people can feed it to wolves (obviously false is no and true is yes)
then we need to add the name and add the texture
Namehere.iconIndex = ModLoader.addOverride("/gui/items.png", "/cheeseburger.png");
ModLoader.addName(cheeseburger, "cheeseburger");

then we are done here is what it should look like
mod_cheeseburger final

boolean-A binary variable, having two possible values called o trueo and o false.o .

thanks for reading! Leave any error code in the comments along with suggestions for future tutorials,and as always diamond and subscribe!

06/02/2012 6:49 am
Level 12 : Journeyman Bunny
where is cheeseburger.png located?
05/12/2012 4:06 am
Level 8 : Apprentice Miner
Usefull. Thanks! I had this idea of adding more food as a mod, but never found out how to :3
Planet Minecraft Logo


© 2010 - 2020