Tutorials Navigation

Tutorials :: New :: Popular :: Top Rated

Tutorials: 18,357 Categories: 12

Total Tutorial Views: 42,546,678

[ Minecraft ] How To Make Your Own Food! [ Any Version ]

Tutorial Name: [ Minecraft ] How To Make Your Own Food! [ Any Version ]  

Category: PC Tutorials

Submitted By: Console

Date Added:

Comments: 1

Views: 6,737

Related Forum: PC Building Forum

Share:

How to make a new Food:




In this tutorial i will teach you how to make your own food!




Ok first of all create a new file called mod_Whatever... im calling mine mod_Chocolate for this tutorial!
So first off enter this code into your mod_Chocolate file:




package net.minecraft.src;

public class mod_Chocolate extends BaseMod {
   
   public static final Item Chocolate = new ItemFood(ID, HEALAMOUNT, false).setItemName("Chocolate");
   
   public mod_Chocolate() {
      //crafting codes, etc
   }
   
   public String Version() {
      return "yourversion";
   }
}





So this is pretty easy to understand.... Basically edit the names... and then where it says ID, change that to the item id you want your food to be - 40,000 i think is the max and then the heal amount....




Basically 10 is half of full hearts.... so here is the list:

  • 1 = half heart
  • 2 = 1 heart
  • 3 = 1 + 1/2 hearts
  • 4 = 2 hearts
  • 5 = 2 + 1/2 hearts
  • 6 = 3 hearts
  • 7 = 3 + 1/2 hearts
  • 8 = 4 hearts
  • 9 = AND SO ON! 20 = full hearts!!!





Then you add overrides etc... So here is my full mod_Chocolate and check how i did it:





package net.minecraft.src;

public class mod_Chocolate extends BaseMod
{
       
        public static final Item Chocolate = new ItemFood(2200, 6, false).setItemName("Chocolate");
       
        public mod_Chocolate()
        {
                Chocolate.iconIndex = ModLoader.addOverride("/gui/items.png", "chocolate.png");
                ModLoader.AddName(Chocolate, "Chocolate");
                ModLoader.AddRecipe(new ItemStack(Chocolate, 64), new Object[]
                {
                        "XXX", "XXX", "XXX", Character.valueOf('X'), Item.cocoaBeans, Character.valueOf('A')});
        }
       
        public String Version()
        {
                return "yourversion";
        }
}





Then you need to create an ItemChocolate file:




package net.minecraft.src;

public class ItemChocolate extends ItemFood {
   
   public ItemChocolate(int i, int j) {
        super(i, j, true);
        maxStackSize = (1);
   }
}





Basically all you need to do is rename and all you need to know is that, int i will call the id, int j will call the heal amount. And there! You have your own food item!




Thanks Guys!

Ratings

Current rating: 4.82 by 22 users
Please take one second and rate this tutorial...

Not a Chance
1
2
3
4
5
6
7
8
9
10
Absolutely

Comments

"[ Minecraft ] How To Make Your Own Food! [ Any Version ]" :: Login/Create an Account :: 1 comment

If you would like to post a comment please signin to your account or register for an account.

OdinPosted:

This tutorial does not work with the newer versions of ModLoader!

[code]public String getVersion() {
// TODO Auto-generated method stub
return null;
}
public void load(){
// TODO Auto-generated method stub
}[/code]

is required