Just going to copy and paste a tutorial I wrote on the subject, delete your ItemSausage, as it's unneeded with this tutorial.
Tutorial for ModLoder
So I had a hard time finding one so I decided to create a tutorial on creating a new food item for 1.8.1.
Create a new file called mod_Food.java with this code:
package net.minecraft.src
public class mod_Food extends BaseMod
{
public mod_Food()
{
}
public String Version()
{
return "Food Mod for 1.8.1";
}
}
Now we need to first create the food, we do so by adding the following line within the mod_Food class:
public static final Item DirtPie = new ItemFood(601, 6, false).setItemName("DirtPie");
The 601 is the ID for the new food item.
The 6 is how many "hunger bar slots" it will fill. 1 would be half of a "hunger bar slot", 2 would be a whole "hunger bar slot". The maximum number is 20 (or 10 "hunger bar slots"). Just for reference:
1 = ½ "hunger bar slot"
2 = 1 "hunger bar slot"
3 = 1 ½ "hunger bar slots"
4 = 2 "hunger bar slots"
etc.
The false represents whether or not a Wolf can eat it to heal. Put true if you want Wolfs to be able to heal with the new food item.
Now we need to set the food items texture and name, place the following code within the mod_Food constructor:
Now your mod_Food.java file should look just like the one below:
public class mod_Food extends BaseMod
{
public static final Item DirtPie = new ItemFood(601, 6, false).setItemName("DirtPie");
public mod_Food()
{
DirtPie.iconIndex = ModLoader.addOverride("/gui/items.png", "/Food/DirtPie.png");
ModLoader.AddName(DirtPie, "Dirt Pie");
ModLoader.AddRecipe(new ItemStack(DirtPie, 1), new Object[]
{ "###", "###", "###", Character.valueOf('#'), Block.dirt});
}
public String Version()
{
return "Food Mod for 1.8.1";
}
}
Just as a reference, when I say "hunger bar slots" I mean these:
Keep in mind you won't be able to eat it until you've depleted some of the hunger bar.
I don't know how to do it manually like the way your trying to do it, as well I don't see what the problem with deleting ItemSausage. Your going to condense around 21 lines of code into 1 and reduce the amount of class files your mod contains.
I mean the only thing your changing with your mod_Name.java file is your replacing
public static Item Sausage = new Item(211).setItemName("SausageItem");
with
public static final Item Sausage = new ItemFood(211, 6, false).setItemName("Sausage");
Everything else within mod_Name.java will remain and still function.
Minecraft has stopped running because it encountered a problem.
If you wish to report this, please copy this entire text and email it to [email protected].
Please include a description of what you did when the error occured.
--- BEGIN ERROR REPORT c67b1a66 --------
Generated 06/10/2011 5:04
Minecraft: Minecraft Beta 1.8.1
OS: Windows 7 (x86) version 6.1
Java: 1.6.0_26, Sun Microsystems Inc.
VM: Java HotSpot(TM) Client VM (mixed mode), Sun Microsystems Inc.
LWJGL: 2.4.2
OpenGL: GeForce 8600 GT/PCI/SSE2 version 3.3.0, NVIDIA Corporation
java.lang.RuntimeException: java.lang.Exception: Image not found: HotDog
at net.minecraft.src.ModLoader.RegisterAllTextureOverrides(ModLoader.java:1166)
at net.minecraft.src.ModLoader.OnTick(ModLoader.java:887)
at net.minecraft.src.EntityRendererProxy.updateCameraAndRender(EntityRendererProxy.java:24)
at net.minecraft.client.Minecraft.run(Minecraft.java:517)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.Exception: Image not found: HotDog
at net.minecraft.src.ModLoader.loadImage(ModLoader.java:851)
at net.minecraft.src.ModLoader.RegisterAllTextureOverrides(ModLoader.java:1158)
... 4 more
--- END ERROR REPORT e6209011 ----------
I know it says something about the image but its in the right place!
And
There are no errors but it just wont be edible
any ideas?
Tutorial for ModLoder
So I had a hard time finding one so I decided to create a tutorial on creating a new food item for 1.8.1.
Create a new file called mod_Food.java with this code:
Now we need to first create the food, we do so by adding the following line within the mod_Food class:
The 601 is the ID for the new food item.
The 6 is how many "hunger bar slots" it will fill. 1 would be half of a "hunger bar slot", 2 would be a whole "hunger bar slot". The maximum number is 20 (or 10 "hunger bar slots"). Just for reference:
1 = ½ "hunger bar slot"
2 = 1 "hunger bar slot"
3 = 1 ½ "hunger bar slots"
4 = 2 "hunger bar slots"
etc.
The false represents whether or not a Wolf can eat it to heal. Put true if you want Wolfs to be able to heal with the new food item.
Now we need to set the food items texture and name, place the following code within the mod_Food constructor:
All this does is set the DirtPie's icon to "/Food/DirtPie.png" and then assigns the in-game name "Dirt Pie" to the new food item.
Last, we'll make a quick recipe so we can craft the new food item.
Add the following code within the mod_Food constructor:
Now your mod_Food.java file should look just like the one below:
Just as a reference, when I say "hunger bar slots" I mean these:
Keep in mind you won't be able to eat it until you've depleted some of the hunger bar.
I mean the only thing your changing with your mod_Name.java file is your replacing
with
Everything else within mod_Name.java will remain and still function.
=\
Please Help!
I have an error
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
If you wish to report this, please copy this entire text and email it to [email protected].
Please include a description of what you did when the error occured.
--- BEGIN ERROR REPORT c67b1a66 --------
Generated 06/10/2011 5:04
Minecraft: Minecraft Beta 1.8.1
OS: Windows 7 (x86) version 6.1
Java: 1.6.0_26, Sun Microsystems Inc.
VM: Java HotSpot(TM) Client VM (mixed mode), Sun Microsystems Inc.
LWJGL: 2.4.2
OpenGL: GeForce 8600 GT/PCI/SSE2 version 3.3.0, NVIDIA Corporation
java.lang.RuntimeException: java.lang.Exception: Image not found: HotDog
at net.minecraft.src.ModLoader.RegisterAllTextureOverrides(ModLoader.java:1166)
at net.minecraft.src.ModLoader.OnTick(ModLoader.java:887)
at net.minecraft.src.EntityRendererProxy.updateCameraAndRender(EntityRendererProxy.java:24)
at net.minecraft.client.Minecraft.run(Minecraft.java:517)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.Exception: Image not found: HotDog
at net.minecraft.src.ModLoader.loadImage(ModLoader.java:851)
at net.minecraft.src.ModLoader.RegisterAllTextureOverrides(ModLoader.java:1158)
... 4 more
--- END ERROR REPORT e6209011 ----------
I know it says something about the image but its in the right place!