I have an item that does something on use. Is there any way i can make it so that it cannot break(ie once it gets to the durabilty of 0(or 1) it is no longer usable and you must go and "recharge" the item? I dont want to lose the item, just make it unusable.
I'm not sure how to do it... If you find out though, tell me, it could be useful
I'm not sure how to do it... If you find out though, tell me, it could be useful
Is there any way to change an items metadata based off of its durability? Like is there a way for the code to call forth the items durability/damagedness(?) and then make it change metadata to a different item without and properties with the same texture until its repaired?
Is there any way to change an items metadata based off of its durability? Like is there a way for the code to call forth the items durability/damagedness(?) and then make it change metadata to a different item without and properties with the same texture until its repaired?
Not sure, I'm sure it will be possible to do that wherever you call the damage increase
Alright, and great that you answered (multipile people) so quickly. Can you do a tutorial in the future on how to generate a structure? And then i mean not like a T of diamond but something like a real house. This would be cool. And also an advanced tutorial about events?
Also i have to mention that you could explain more. For example, that Item tutorial. Ive read it 5 times today cuz i couldnt get textures working... But at the same time i followed 3/4 other tutorials, and yours was completely different and more complex.
In Eclipse, click Run. Its the green cirkle with white arrow at the top left.
Alright, and great that you answered (multipile people) so quickly. Can you do a tutorial in the future on how to generate a structure? And then i mean not like a T of diamond but something like a real house. This would be cool. And also an advanced tutorial about events?
Also i have to mention that you could explain more. For example, that Item tutorial. Ive read it 5 times today cuz i couldnt get textures working... But at the same time i followed 3/4 other tutorials, and yours was completely different and more complex.
In Eclipse, click Run. Its the green cirkle with white arrow at the top left.
1) I suppose I could do a tutorial on structures, it can be a lot of lines that just place blocks though, so it could take up a lot of space xD
2) I have been thinking of going through and touching them up a bit
First of all thank you very much for your mod tutorials. They have been very handy.
I was just wondering if you knew a way to use meta blocks or items as fuels?? I haven't been able to get anything to work. Thought I saw a previous question about this but can't seem to find it.
First of all thank you very much for your mod tutorials. They have been very handy.
I was just wondering if you knew a way to use meta blocks or items as fuels?? I haven't been able to get anything to work. Thought I saw a previous question about this but can't seem to find it.
In your fuel handler, the fuel object is an itemstack, just add a check for metadata
Updated the thread! (Hopefully) made the first two a bit easier to read, and fixed an issue in distributing your mod. Added some stuff to the top, including a github page! (finally!). If you find any problems, PLEASE tell me, atm I'm fixing stuff up
Dude, first off, I want to say your tutorials are awesome and have helped me out so much with modding.
Second, I have a question about your custom tools section. Are all of your tools both enchantable and repairable? When I attempted what you show, my tools weren't enchantable. I put it in the table and the options show up, I just can't click to apply the enchantments.
I've tried extending the regular ItemPickaxe class which made them enchantable, but then I found that I couldn't use getToolCraftingMaterial() since it relied on the default EnumToolMaterial class and I was using a new material that wasn't defined there. This made it impossible to repair with different items when I went to create another set of tools, i.e I have silver and electrum pickaxes but they can only be repaired with silver.
I also attempted to create my own EnumToolMaterial class and make a base tool class from which to subclass my tools, but that gives the same problem of not being able to enchant.
I can't see what the problem is, and it might be that it's only possible to have both repair and enchanting by editing the base classes. Any ideas?
Edit: There's always making new classes for each tool in each material, but that seems to kind of defeat the purpose of superclassing.
Why is it telling me that when making a new block object public static Block blockRuby = new BlockRuby(250);
it tells me I have to make it static but then when adding the registry it tells me it cant be static...
Dude, first off, I want to say your tutorials are awesome and have helped me out so much with modding.
Second, I have a question about your custom tools section. Are all of your tools both enchantable and repairable? When I attempted what you show, my tools weren't enchantable. I put it in the table and the options show up, I just can't click to apply the enchantments.
I've tried extending the regular ItemPickaxe class which made them enchantable, but then I found that I couldn't use getToolCraftingMaterial() since it relied on the default EnumToolMaterial class and I was using a new material that wasn't defined there. This made it impossible to repair with different items when I went to create another set of tools, i.e I have silver and electrum pickaxes but they can only be repaired with silver.
I also attempted to create my own EnumToolMaterial class and make a base tool class from which to subclass my tools, but that gives the same problem of not being able to enchant.
I can't see what the problem is, and it might be that it's only possible to have both repair and enchanting by editing the base classes. Any ideas?
Edit: There's always making new classes for each tool in each material, but that seems to kind of defeat the purpose of superclassing.
Are you making an EnumToolMaterial like I do in the tool class, as an object in the mod class?
Not sure if it'll fix your problems, but try putting the items in preinit
I put the items into preinit and commented them out of init but it still crashes when i try to run the client. It's still got something to do with my custom items being used in recipes as it keeps pointing me to a recipe that uses a custom item as an ingredient.
@Mod(modid = "FoodPlusMod", name = "Food Plus For 1.4.7", version = "v1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = true)
public class FoodPlusMod
{
//Blocks
public static Block OrangePlank;
//Items
public static Item PumpkinSoup;
public static Item ApplePie;
public static Item AppleJuice;
public static Item Juicer;
public static Item BoiledEgg;
public static Item ChocolateBar;
public static Item ChocolateBlock;
public static Item ChocolateMilk;
public static Item HotChocolate;
public static Item Custard;
public static Item BakedCustard;
public static Item CustardDanish;
public static Item BakedDanish;
public static Item Toffee;
public static Item ToffeeApple;
public static Item SugarWater;
public static Item GlucoseSyrup;
@PreInit
public void initConfig(FMLPreInitializationEvent fpe)
{
PumpkinSoup = (new ModItemSoup(1000, 3).setItemName("PumpkinSoup").setCreativeTab(CreativeTabs.tabFood).setIconCoord(2, 1));
ApplePie = (new ModItemFood (1001, 3,1.0F, false ). setItemName("ApplePie").setCreativeTab(CreativeTabs.tabFood).setIconCoord(1, 0));
AppleJuice = (new ModItemJuice (1002, 4).setItemName("AppleJuice").setCreativeTab(CreativeTabs.tabFood).setIconCoord(0, 0));
Juicer = (new ModItem (1003).setItemName("Juicer").setCreativeTab(CreativeTabs.tabTools).setIconCoord(13, 0));
BoiledEgg = (new ModItemFood (1004,2, false).setItemName("BoiledEgg").setCreativeTab(CreativeTabs.tabFood).setIconCoord(4, 0));
ChocolateBar = (new ModItemFood (1005,2,false).setItemName("ChocolateBar").setCreativeTab(CreativeTabs.tabFood).setIconCoord(5, 0));
ChocolateBlock = (new ModItemFood (1006,5,false).setItemName("ChocolateBlock").setCreativeTab(CreativeTabs.tabFood).setIconCoord(6, 0));
ChocolateMilk = (new ModItemSoup (1007,2).setItemName("ChocolateMilk").setCreativeTab(CreativeTabs.tabFood).setIconCoord(7, 0));
HotChocolate = (new ModItemSoup (1008,6).setItemName("HotChocolate").setCreativeTab(CreativeTabs.tabFood).setIconCoord(10, 0));
Custard = (new ModItemSoup (1009,2).setItemName("Custard").setCreativeTab(CreativeTabs.tabFood).setIconCoord(8, 0));
BakedCustard = (new ModItemSoup (1010,6).setItemName("BakedCustard").setCreativeTab(CreativeTabs.tabFood).setIconCoord(2, 0));
CustardDanish = (new ModItemFood (1011,2, false).setItemName("CustardDanish").setCreativeTab(CreativeTabs.tabFood).setIconCoord(9, 0));
BakedDanish = (new ModItemFood (1012,6, false).setItemName("BakedDanish").setCreativeTab(CreativeTabs.tabFood).setIconCoord(3, 0));
Toffee = (new ModItemFood (1013,1,false).setItemName("Toffee").setCreativeTab(CreativeTabs.tabFood).setIconCoord(3, 1));
ToffeeApple = (new ModItemFood (1014,5,false).setItemName("ToffeeApple").setCreativeTab(CreativeTabs.tabFood).setIconCoord(4, 1));
SugarWater = (new ModItemFood(1015,1,false).setItemName("SugarWater").setCreativeTab(CreativeTabs.tabFood).setIconCoord(12, 0));
GlucoseSyrup = (new ModItemFood(1016, 1,false).setItemName("GlucoseSyrup").setCreativeTab(CreativeTabs.tabFood).setIconCoord(11, 0));
}
@Init
public void load(FMLInitializationEvent fie)
{
//Blocks
OrangePlank = (new ModBlock(500, 3, Material.wood ).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setBlockName("OrangePlank").setRequiresSelfNotify());
//Items
/*PumpkinSoup = (new ModItemSoup(1000, 3).setItemName("PumpkinSoup").setCreativeTab(CreativeTabs.tabFood).setIconCoord(2, 1));
ApplePie = (new ModItemFood (1001, 3,1.0F, false ). setItemName("ApplePie").setCreativeTab(CreativeTabs.tabFood).setIconCoord(1, 0));
AppleJuice = (new ModItemJuice (1002, 4).setItemName("AppleJuice").setCreativeTab(CreativeTabs.tabFood).setIconCoord(0, 0));
Juicer = (new ModItem (1003).setItemName("Juicer").setCreativeTab(CreativeTabs.tabTools).setIconCoord(13, 0));
BoiledEgg = (new ModItemFood (1004,2, false).setItemName("BoiledEgg").setCreativeTab(CreativeTabs.tabFood).setIconCoord(4, 0));
ChocolateBar = (new ModItemFood (1005,2,false).setItemName("ChocolateBar").setCreativeTab(CreativeTabs.tabFood).setIconCoord(5, 0));
ChocolateBlock = (new ModItemFood (1006,5,false).setItemName("ChocolateBlock").setCreativeTab(CreativeTabs.tabFood).setIconCoord(6, 0));
ChocolateMilk = (new ModItemSoup (1007,2).setItemName("ChocolateMilk").setCreativeTab(CreativeTabs.tabFood).setIconCoord(7, 0));
HotChocolate = (new ModItemSoup (1008,6).setItemName("HotChocolate").setCreativeTab(CreativeTabs.tabFood).setIconCoord(10, 0));
Custard = (new ModItemSoup (1009,2).setItemName("Custard").setCreativeTab(CreativeTabs.tabFood).setIconCoord(8, 0));
BakedCustard = (new ModItemSoup (1010,6).setItemName("BakedCustard").setCreativeTab(CreativeTabs.tabFood).setIconCoord(2, 0));
CustardDanish = (new ModItemFood (1011,2, false).setItemName("CustardDanish").setCreativeTab(CreativeTabs.tabFood).setIconCoord(9, 0));
BakedDanish = (new ModItemFood (1012,6, false).setItemName("BakedDanish").setCreativeTab(CreativeTabs.tabFood).setIconCoord(3, 0));
Toffee = (new ModItemFood (1013,1,false).setItemName("Toffee").setCreativeTab(CreativeTabs.tabFood).setIconCoord(3, 1));
ToffeeApple = (new ModItemFood (1014,5,false).setItemName("ToffeeApple").setCreativeTab(CreativeTabs.tabFood).setIconCoord(4, 1));
SugarWater = (new ModItemFood(1015,1,false).setItemName("SugarWater").setCreativeTab(CreativeTabs.tabFood).setIconCoord(12, 0));
GlucoseSyrup = (new ModItemFood(1016, 1,false).setItemName("GlucoseSyrup").setCreativeTab(CreativeTabs.tabFood).setIconCoord(11, 0));
*/
public void recipes()
{
GameRegistry.addRecipe(new ItemStack(OrangePlank, 1), new Object[]{
" * ","*X*"," * ", Character.valueOf('*'), new ItemStack(Item.dyePowder, 1, 14), Character.valueOf('X'), Block.planks});
GameRegistry.addRecipe(new ItemStack(PumpkinSoup,1), new Object[]{
" * ", " X ", Character.valueOf('X'), Item.bowlEmpty, Character.valueOf('*'), Block.pumpkin});
GameRegistry.addShapelessRecipe(new ItemStack(ApplePie,1), new Object[]{
new ItemStack(Item.potion, 1, 0), new ItemStack(Item.appleRed), new ItemStack(Item.egg), new ItemStack(Item.sugar)});
GameRegistry.addShapelessRecipe(new ItemStack(AppleJuice,1), new Object[]{
new ItemStack(Item.appleRed), new ItemStack(ModItem.Juicer), new ItemStack(Item.sugar), new ItemStack(Item.glassBottle)});
GameRegistry.addRecipe(new ItemStack(Juicer,1), new Object[]{
" * ", " X ", " ! ", Character.valueOf('*'), Item.flint, Character.valueOf('X'), Item.stick,
Character.valueOf('!'), Item.bowlEmpty});
Juicer.setContainerItem(Juicer);
GameRegistry.addShapelessRecipe(new ItemStack(ChocolateBar,1), new Object[]{
new ItemStack(Item.dyePowder, 1, 3), new ItemStack(Item.sugar), new ItemStack(Item.bucketMilk)});
GameRegistry.addRecipe(new ItemStack(ChocolateBlock,1), new Object[]{
"***", Character.valueOf('*'), ModItem.ChocolateBar});
GameRegistry.addShapelessRecipe(new ItemStack(ChocolateMilk,1), new Object[]{
new ItemStack(ModItem.ChocolateBar), new ItemStack(Item.sugar), new ItemStack(Item.bucketMilk)});
GameRegistry.addShapelessRecipe(new ItemStack(Custard,1), new Object[]{
new ItemStack(Item.sugar), new ItemStack(Item.bucketMilk), new ItemStack(Item.egg)});
GameRegistry.addShapelessRecipe(new ItemStack(CustardDanish,1), new Object[]{
new ItemStack(ModItem.Custard), new ItemStack(Item.wheat), new ItemStack(Item.egg), new ItemStack(Item.sugar)});
GameRegistry.addRecipe(new ItemStack(ToffeeApple,1), new Object[]{
" ! ", " X ", " * ", Character.valueOf('*'), Item.stick, Character.valueOf('X'), Item.appleRed,Character.valueOf('!'), ModItem.Toffee});
GameRegistry.addShapelessRecipe(new ItemStack(SugarWater, 1), new Object[] {
new ItemStack(Item.potion, 1, 0), new ItemStack(Item.sugar)});
}
public void smelting()
{
GameRegistry.addSmelting(ModItem.SugarWater.itemID, new ItemStack(GlucoseSyrup, 1), 0.0F);
GameRegistry.addSmelting(Item.egg.itemID, new ItemStack (BoiledEgg, 1), 0.0F);
GameRegistry.addSmelting(ModItem.ChocolateMilk.itemID, new ItemStack (HotChocolate, 1), 0.0F);
GameRegistry.addSmelting(ModItem.Custard.itemID, new ItemStack (BakedCustard, 1), 0.0F);
GameRegistry.addSmelting(ModItem.CustardDanish.itemID, new ItemStack (BakedDanish, 1), 0.0F);
GameRegistry.addSmelting(Item.sugar.itemID, new ItemStack (Toffee, 1), 0.0F);
---- Minecraft Crash Report ----
// This doesn't make any sense!
Time: 5/03/13 3:02 PM
Description: Failed to start game
java.lang.NullPointerException
at net.minecraft.item.ItemStack.<init>(ItemStack.java:64)
at foodplus.FoodPlusMod.recipes(FoodPlusMod.java:162)
at foodplus.FoodPlusMod.load(FoodPlusMod.java:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:485)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:83)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:657)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:207)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:456)
at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)
at net.minecraft.client.Minecraft.run(Minecraft.java:744)
at java.lang.Thread.run(Unknown Source)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- System Details --
Details:
Minecraft Version: 1.4.7
Operating System: Windows 7 (x86) version 6.1
Java Version: 1.7.0_09, Oracle Corporation
Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
Memory: 990679928 bytes (944 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v7.26 FML v4.7.4.520 Minecraft Forge 6.6.0.497 4 mods loaded, 4 mods active
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized
FoodPlusMod [Food Plus For 1.4.7] (bin) Unloaded->Constructed->Pre-initialized->Errored
LWJGL: 2.4.2
OpenGL: GeForce GT 230M/PCI/SSE2 GL version 3.0.0, NVIDIA Corporation
Is Modded: Definitely; Client brand changed to 'forge,fml'
Type: Client (map_client.txt)
Texture Pack: Default
Profiler Position: N/A (disabled)
Vec3 Pool Size: ~~ERROR~~ NullPointerException: null
Are you making an EnumToolMaterial like I do in the tool class, as an object in the mod class?
Yeah, I do. I have it defined in my main mod file and use it when making tools. The problem seems to be that Minecraft doesn't know what the crafting material is for my custom material. I found this code in the files:
public int getToolCraftingMaterial()
{
switch (this)
{
case WOOD: return Block.planks.blockID;
case STONE: return Block.cobblestone.blockID;
case GOLD: return Item.ingotGold.itemID;
case IRON: return Item.ingotIron.itemID;
case EMERALD: return Item.diamond.itemID;
default: return (customCraftingMaterial == null ? 0 : customCraftingMaterial.itemID);
}
}
So it seems that my material isn't being inserted into this code, or however enumHelper works. This is confusing.
I put the items into preinit and commented them out of init but it still crashes when i try to run the client. It's still got something to do with my custom items being used in recipes as it keeps pointing me to a recipe that uses a custom item as an ingredient.
@Mod(modid = "FoodPlusMod", name = "Food Plus For 1.4.7", version = "v1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = true)
public class FoodPlusMod
{
//Blocks
public static Block OrangePlank;
//Items
public static Item PumpkinSoup;
public static Item ApplePie;
public static Item AppleJuice;
public static Item Juicer;
public static Item BoiledEgg;
public static Item ChocolateBar;
public static Item ChocolateBlock;
public static Item ChocolateMilk;
public static Item HotChocolate;
public static Item Custard;
public static Item BakedCustard;
public static Item CustardDanish;
public static Item BakedDanish;
public static Item Toffee;
public static Item ToffeeApple;
public static Item SugarWater;
public static Item GlucoseSyrup;
@PreInit
public void initConfig(FMLPreInitializationEvent fpe)
{
PumpkinSoup = (new ModItemSoup(1000, 3).setItemName("PumpkinSoup").setCreativeTab(CreativeTabs.tabFood).setIconCoord(2, 1));
ApplePie = (new ModItemFood (1001, 3,1.0F, false ). setItemName("ApplePie").setCreativeTab(CreativeTabs.tabFood).setIconCoord(1, 0));
AppleJuice = (new ModItemJuice (1002, 4).setItemName("AppleJuice").setCreativeTab(CreativeTabs.tabFood).setIconCoord(0, 0));
Juicer = (new ModItem (1003).setItemName("Juicer").setCreativeTab(CreativeTabs.tabTools).setIconCoord(13, 0));
BoiledEgg = (new ModItemFood (1004,2, false).setItemName("BoiledEgg").setCreativeTab(CreativeTabs.tabFood).setIconCoord(4, 0));
ChocolateBar = (new ModItemFood (1005,2,false).setItemName("ChocolateBar").setCreativeTab(CreativeTabs.tabFood).setIconCoord(5, 0));
ChocolateBlock = (new ModItemFood (1006,5,false).setItemName("ChocolateBlock").setCreativeTab(CreativeTabs.tabFood).setIconCoord(6, 0));
ChocolateMilk = (new ModItemSoup (1007,2).setItemName("ChocolateMilk").setCreativeTab(CreativeTabs.tabFood).setIconCoord(7, 0));
HotChocolate = (new ModItemSoup (1008,6).setItemName("HotChocolate").setCreativeTab(CreativeTabs.tabFood).setIconCoord(10, 0));
Custard = (new ModItemSoup (1009,2).setItemName("Custard").setCreativeTab(CreativeTabs.tabFood).setIconCoord(8, 0));
BakedCustard = (new ModItemSoup (1010,6).setItemName("BakedCustard").setCreativeTab(CreativeTabs.tabFood).setIconCoord(2, 0));
CustardDanish = (new ModItemFood (1011,2, false).setItemName("CustardDanish").setCreativeTab(CreativeTabs.tabFood).setIconCoord(9, 0));
BakedDanish = (new ModItemFood (1012,6, false).setItemName("BakedDanish").setCreativeTab(CreativeTabs.tabFood).setIconCoord(3, 0));
Toffee = (new ModItemFood (1013,1,false).setItemName("Toffee").setCreativeTab(CreativeTabs.tabFood).setIconCoord(3, 1));
ToffeeApple = (new ModItemFood (1014,5,false).setItemName("ToffeeApple").setCreativeTab(CreativeTabs.tabFood).setIconCoord(4, 1));
SugarWater = (new ModItemFood(1015,1,false).setItemName("SugarWater").setCreativeTab(CreativeTabs.tabFood).setIconCoord(12, 0));
GlucoseSyrup = (new ModItemFood(1016, 1,false).setItemName("GlucoseSyrup").setCreativeTab(CreativeTabs.tabFood).setIconCoord(11, 0));
}
@Init
public void load(FMLInitializationEvent fie)
{
//Blocks
OrangePlank = (new ModBlock(500, 3, Material.wood ).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setBlockName("OrangePlank").setRequiresSelfNotify());
//Items
/*PumpkinSoup = (new ModItemSoup(1000, 3).setItemName("PumpkinSoup").setCreativeTab(CreativeTabs.tabFood).setIconCoord(2, 1));
ApplePie = (new ModItemFood (1001, 3,1.0F, false ). setItemName("ApplePie").setCreativeTab(CreativeTabs.tabFood).setIconCoord(1, 0));
AppleJuice = (new ModItemJuice (1002, 4).setItemName("AppleJuice").setCreativeTab(CreativeTabs.tabFood).setIconCoord(0, 0));
Juicer = (new ModItem (1003).setItemName("Juicer").setCreativeTab(CreativeTabs.tabTools).setIconCoord(13, 0));
BoiledEgg = (new ModItemFood (1004,2, false).setItemName("BoiledEgg").setCreativeTab(CreativeTabs.tabFood).setIconCoord(4, 0));
ChocolateBar = (new ModItemFood (1005,2,false).setItemName("ChocolateBar").setCreativeTab(CreativeTabs.tabFood).setIconCoord(5, 0));
ChocolateBlock = (new ModItemFood (1006,5,false).setItemName("ChocolateBlock").setCreativeTab(CreativeTabs.tabFood).setIconCoord(6, 0));
ChocolateMilk = (new ModItemSoup (1007,2).setItemName("ChocolateMilk").setCreativeTab(CreativeTabs.tabFood).setIconCoord(7, 0));
HotChocolate = (new ModItemSoup (1008,6).setItemName("HotChocolate").setCreativeTab(CreativeTabs.tabFood).setIconCoord(10, 0));
Custard = (new ModItemSoup (1009,2).setItemName("Custard").setCreativeTab(CreativeTabs.tabFood).setIconCoord(8, 0));
BakedCustard = (new ModItemSoup (1010,6).setItemName("BakedCustard").setCreativeTab(CreativeTabs.tabFood).setIconCoord(2, 0));
CustardDanish = (new ModItemFood (1011,2, false).setItemName("CustardDanish").setCreativeTab(CreativeTabs.tabFood).setIconCoord(9, 0));
BakedDanish = (new ModItemFood (1012,6, false).setItemName("BakedDanish").setCreativeTab(CreativeTabs.tabFood).setIconCoord(3, 0));
Toffee = (new ModItemFood (1013,1,false).setItemName("Toffee").setCreativeTab(CreativeTabs.tabFood).setIconCoord(3, 1));
ToffeeApple = (new ModItemFood (1014,5,false).setItemName("ToffeeApple").setCreativeTab(CreativeTabs.tabFood).setIconCoord(4, 1));
SugarWater = (new ModItemFood(1015,1,false).setItemName("SugarWater").setCreativeTab(CreativeTabs.tabFood).setIconCoord(12, 0));
GlucoseSyrup = (new ModItemFood(1016, 1,false).setItemName("GlucoseSyrup").setCreativeTab(CreativeTabs.tabFood).setIconCoord(11, 0));
*/
public void recipes()
{
GameRegistry.addRecipe(new ItemStack(OrangePlank, 1), new Object[]{
" * ","*X*"," * ", Character.valueOf('*'), new ItemStack(Item.dyePowder, 1, 14), Character.valueOf('X'), Block.planks});
GameRegistry.addRecipe(new ItemStack(PumpkinSoup,1), new Object[]{
" * ", " X ", Character.valueOf('X'), Item.bowlEmpty, Character.valueOf('*'), Block.pumpkin});
GameRegistry.addShapelessRecipe(new ItemStack(ApplePie,1), new Object[]{
new ItemStack(Item.potion, 1, 0), new ItemStack(Item.appleRed), new ItemStack(Item.egg), new ItemStack(Item.sugar)});
GameRegistry.addShapelessRecipe(new ItemStack(AppleJuice,1), new Object[]{
new ItemStack(Item.appleRed), new ItemStack(ModItem.Juicer), new ItemStack(Item.sugar), new ItemStack(Item.glassBottle)});
GameRegistry.addRecipe(new ItemStack(Juicer,1), new Object[]{
" * ", " X ", " ! ", Character.valueOf('*'), Item.flint, Character.valueOf('X'), Item.stick,
Character.valueOf('!'), Item.bowlEmpty});
Juicer.setContainerItem(Juicer);
GameRegistry.addShapelessRecipe(new ItemStack(ChocolateBar,1), new Object[]{
new ItemStack(Item.dyePowder, 1, 3), new ItemStack(Item.sugar), new ItemStack(Item.bucketMilk)});
GameRegistry.addRecipe(new ItemStack(ChocolateBlock,1), new Object[]{
"***", Character.valueOf('*'), ModItem.ChocolateBar});
GameRegistry.addShapelessRecipe(new ItemStack(ChocolateMilk,1), new Object[]{
new ItemStack(ModItem.ChocolateBar), new ItemStack(Item.sugar), new ItemStack(Item.bucketMilk)});
GameRegistry.addShapelessRecipe(new ItemStack(Custard,1), new Object[]{
new ItemStack(Item.sugar), new ItemStack(Item.bucketMilk), new ItemStack(Item.egg)});
GameRegistry.addShapelessRecipe(new ItemStack(CustardDanish,1), new Object[]{
new ItemStack(ModItem.Custard), new ItemStack(Item.wheat), new ItemStack(Item.egg), new ItemStack(Item.sugar)});
GameRegistry.addRecipe(new ItemStack(ToffeeApple,1), new Object[]{
" ! ", " X ", " * ", Character.valueOf('*'), Item.stick, Character.valueOf('X'), Item.appleRed,Character.valueOf('!'), ModItem.Toffee});
GameRegistry.addShapelessRecipe(new ItemStack(SugarWater, 1), new Object[] {
new ItemStack(Item.potion, 1, 0), new ItemStack(Item.sugar)});
}
public void smelting()
{
GameRegistry.addSmelting(ModItem.SugarWater.itemID, new ItemStack(GlucoseSyrup, 1), 0.0F);
GameRegistry.addSmelting(Item.egg.itemID, new ItemStack (BoiledEgg, 1), 0.0F);
GameRegistry.addSmelting(ModItem.ChocolateMilk.itemID, new ItemStack (HotChocolate, 1), 0.0F);
GameRegistry.addSmelting(ModItem.Custard.itemID, new ItemStack (BakedCustard, 1), 0.0F);
GameRegistry.addSmelting(ModItem.CustardDanish.itemID, new ItemStack (BakedDanish, 1), 0.0F);
GameRegistry.addSmelting(Item.sugar.itemID, new ItemStack (Toffee, 1), 0.0F);
---- Minecraft Crash Report ----
// This doesn't make any sense!
Time: 5/03/13 3:02 PM
Description: Failed to start game
java.lang.NullPointerException
at net.minecraft.item.ItemStack.<init>(ItemStack.java:64)
at foodplus.FoodPlusMod.recipes(FoodPlusMod.java:162)
at foodplus.FoodPlusMod.load(FoodPlusMod.java:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:485)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:83)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:657)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:207)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:456)
at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)
at net.minecraft.client.Minecraft.run(Minecraft.java:744)
at java.lang.Thread.run(Unknown Source)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- System Details --
Details:
Minecraft Version: 1.4.7
Operating System: Windows 7 (x86) version 6.1
Java Version: 1.7.0_09, Oracle Corporation
Java VM Version: Java HotSpot™ Client VM (mixed mode), Oracle Corporation
Memory: 990679928 bytes (944 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v7.26 FML v4.7.4.520 Minecraft Forge 6.6.0.497 4 mods loaded, 4 mods active
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized
FoodPlusMod [Food Plus For 1.4.7] (bin) Unloaded->Constructed->Pre-initialized->Errored
LWJGL: 2.4.2
OpenGL: GeForce GT 230M/PCI/SSE2 GL version 3.0.0, NVIDIA Corporation
Is Modded: Definitely; Client brand changed to 'forge,fml'
Type: Client (map_client.txt)
Texture Pack: Default
Profiler Position: N/A (disabled)
Vec3 Pool Size: ~~ERROR~~ NullPointerException: null
Maybe it's because you're using those symbols in your recipes? Try sticking to letters if you can, even if that isn't the problem, it looks neater
Yeah, I do. I have it defined in my main mod file and use it when making tools. The problem seems to be that Minecraft doesn't know what the crafting material is for my custom material. I found this code in the files:
public int getToolCraftingMaterial()
{
switch (this)
{
case WOOD: return Block.planks.blockID;
case STONE: return Block.cobblestone.blockID;
case GOLD: return Item.ingotGold.itemID;
case IRON: return Item.ingotIron.itemID;
case EMERALD: return Item.diamond.itemID;
default: return (customCraftingMaterial == null ? 0 : customCraftingMaterial.itemID);
}
}
So it seems that my material isn't being inserted into this code, or however enumHelper works. This is confusing.
The custom materials in EnumHelper don't have anything for material, you'll have to override the canRepair method or whatver it's called. I suggest retrieving an ItemStack as one of the parameters for the constructor and then cheking that in the method
Maybe it's because you're using those symbols in your recipes? Try sticking to letters if you can, even if that isn't the problem, it looks neater
Even with the letters instead of symbols it still isn't liking it. Could it be something to do with me using ModItem instead of Item as the reference in some of the recipes. I've checked and the recipes that cause crashes are specifically those that use a mod item.
For example
GameRegistry.addRecipe(new ItemStack(ChocolateBlock,1), new Object[]{ "***", Character.valueOf('*'), ModItem.ChocolateBar});
Whereas this recipe is fine
GameRegistry.addRecipe(new ItemStack(PumpkinSoup,1), new Object[]{ " * ", " X ", Character.valueOf('X'), Item.bowlEmpty, Character.valueOf('*'), Block.pumpkin});
But ModItem is the correct name of the class and i have all the items inside the class so it shouldn't have a problem...
This is the ModItem.java file
package foodplus;
import net.minecraft.item.Item;
public class ModItem extends Item
{
public ModItem(int par1)
{
super (par1);
}
//Mod Items for Crafting
public static ModItem Juicer;
public static ModItem ChocolateBar;
public static ModItem Custard;
public static ModItem Toffee;
public static ModItem SugarWater;
public static ModItem ChocolateMilk;
public static ModItem CustardDanish;
public String getTextureFile()
{
return "/Texture/moditems.png";
}
}
I'm all out of ideas to fix it. I've tried fiddling around with various lines of code and what not but nothing seems to work. It's so much easier to fix things like this with ModLoader... ;( haha
I'm not sure how to do it... If you find out though, tell me, it could be useful
Is there any way to change an items metadata based off of its durability? Like is there a way for the code to call forth the items durability/damagedness(?) and then make it change metadata to a different item without and properties with the same texture until its repaired?
Not sure, I'm sure it will be possible to do that wherever you call the damage increase
w...t...f
What I meant was how do you start the code?
1) I suppose I could do a tutorial on structures, it can be a lot of lines that just place blocks though, so it could take up a lot of space xD
2) I have been thinking of going through and touching them up a bit
What do you mean?
First of all thank you very much for your mod tutorials. They have been very handy.
I was just wondering if you knew a way to use meta blocks or items as fuels?? I haven't been able to get anything to work. Thought I saw a previous question about this but can't seem to find it.
In your fuel handler, the fuel object is an itemstack, just add a check for metadata
No way xD I swear it used to be reobf
Second, I have a question about your custom tools section. Are all of your tools both enchantable and repairable? When I attempted what you show, my tools weren't enchantable. I put it in the table and the options show up, I just can't click to apply the enchantments.
I've tried extending the regular ItemPickaxe class which made them enchantable, but then I found that I couldn't use getToolCraftingMaterial() since it relied on the default EnumToolMaterial class and I was using a new material that wasn't defined there. This made it impossible to repair with different items when I went to create another set of tools, i.e I have silver and electrum pickaxes but they can only be repaired with silver.
I also attempted to create my own EnumToolMaterial class and make a base tool class from which to subclass my tools, but that gives the same problem of not being able to enchant.
I can't see what the problem is, and it might be that it's only possible to have both repair and enchanting by editing the base classes. Any ideas?
Edit: There's always making new classes for each tool in each material, but that seems to kind of defeat the purpose of superclassing.
Are you making an EnumToolMaterial like I do in the tool class, as an object in the mod class?
Means someone else beat him, in this case, me
I put the items into preinit and commented them out of init but it still crashes when i try to run the client. It's still got something to do with my custom items being used in recipes as it keeps pointing me to a recipe that uses a custom item as an ingredient.
Here's the code
package foodplus;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLog;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "FoodPlusMod", name = "Food Plus For 1.4.7", version = "v1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = true)
public class FoodPlusMod
{
//Blocks
public static Block OrangePlank;
//Items
public static Item PumpkinSoup;
public static Item ApplePie;
public static Item AppleJuice;
public static Item Juicer;
public static Item BoiledEgg;
public static Item ChocolateBar;
public static Item ChocolateBlock;
public static Item ChocolateMilk;
public static Item HotChocolate;
public static Item Custard;
public static Item BakedCustard;
public static Item CustardDanish;
public static Item BakedDanish;
public static Item Toffee;
public static Item ToffeeApple;
public static Item SugarWater;
public static Item GlucoseSyrup;
@PreInit
public void initConfig(FMLPreInitializationEvent fpe)
{
PumpkinSoup = (new ModItemSoup(1000, 3).setItemName("PumpkinSoup").setCreativeTab(CreativeTabs.tabFood).setIconCoord(2, 1));
ApplePie = (new ModItemFood (1001, 3,1.0F, false ). setItemName("ApplePie").setCreativeTab(CreativeTabs.tabFood).setIconCoord(1, 0));
AppleJuice = (new ModItemJuice (1002, 4).setItemName("AppleJuice").setCreativeTab(CreativeTabs.tabFood).setIconCoord(0, 0));
Juicer = (new ModItem (1003).setItemName("Juicer").setCreativeTab(CreativeTabs.tabTools).setIconCoord(13, 0));
BoiledEgg = (new ModItemFood (1004,2, false).setItemName("BoiledEgg").setCreativeTab(CreativeTabs.tabFood).setIconCoord(4, 0));
ChocolateBar = (new ModItemFood (1005,2,false).setItemName("ChocolateBar").setCreativeTab(CreativeTabs.tabFood).setIconCoord(5, 0));
ChocolateBlock = (new ModItemFood (1006,5,false).setItemName("ChocolateBlock").setCreativeTab(CreativeTabs.tabFood).setIconCoord(6, 0));
ChocolateMilk = (new ModItemSoup (1007,2).setItemName("ChocolateMilk").setCreativeTab(CreativeTabs.tabFood).setIconCoord(7, 0));
HotChocolate = (new ModItemSoup (1008,6).setItemName("HotChocolate").setCreativeTab(CreativeTabs.tabFood).setIconCoord(10, 0));
Custard = (new ModItemSoup (1009,2).setItemName("Custard").setCreativeTab(CreativeTabs.tabFood).setIconCoord(8, 0));
BakedCustard = (new ModItemSoup (1010,6).setItemName("BakedCustard").setCreativeTab(CreativeTabs.tabFood).setIconCoord(2, 0));
CustardDanish = (new ModItemFood (1011,2, false).setItemName("CustardDanish").setCreativeTab(CreativeTabs.tabFood).setIconCoord(9, 0));
BakedDanish = (new ModItemFood (1012,6, false).setItemName("BakedDanish").setCreativeTab(CreativeTabs.tabFood).setIconCoord(3, 0));
Toffee = (new ModItemFood (1013,1,false).setItemName("Toffee").setCreativeTab(CreativeTabs.tabFood).setIconCoord(3, 1));
ToffeeApple = (new ModItemFood (1014,5,false).setItemName("ToffeeApple").setCreativeTab(CreativeTabs.tabFood).setIconCoord(4, 1));
SugarWater = (new ModItemFood(1015,1,false).setItemName("SugarWater").setCreativeTab(CreativeTabs.tabFood).setIconCoord(12, 0));
GlucoseSyrup = (new ModItemFood(1016, 1,false).setItemName("GlucoseSyrup").setCreativeTab(CreativeTabs.tabFood).setIconCoord(11, 0));
}
@Init
public void load(FMLInitializationEvent fie)
{
//Blocks
OrangePlank = (new ModBlock(500, 3, Material.wood ).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setBlockName("OrangePlank").setRequiresSelfNotify());
//Items
/*PumpkinSoup = (new ModItemSoup(1000, 3).setItemName("PumpkinSoup").setCreativeTab(CreativeTabs.tabFood).setIconCoord(2, 1));
ApplePie = (new ModItemFood (1001, 3,1.0F, false ). setItemName("ApplePie").setCreativeTab(CreativeTabs.tabFood).setIconCoord(1, 0));
AppleJuice = (new ModItemJuice (1002, 4).setItemName("AppleJuice").setCreativeTab(CreativeTabs.tabFood).setIconCoord(0, 0));
Juicer = (new ModItem (1003).setItemName("Juicer").setCreativeTab(CreativeTabs.tabTools).setIconCoord(13, 0));
BoiledEgg = (new ModItemFood (1004,2, false).setItemName("BoiledEgg").setCreativeTab(CreativeTabs.tabFood).setIconCoord(4, 0));
ChocolateBar = (new ModItemFood (1005,2,false).setItemName("ChocolateBar").setCreativeTab(CreativeTabs.tabFood).setIconCoord(5, 0));
ChocolateBlock = (new ModItemFood (1006,5,false).setItemName("ChocolateBlock").setCreativeTab(CreativeTabs.tabFood).setIconCoord(6, 0));
ChocolateMilk = (new ModItemSoup (1007,2).setItemName("ChocolateMilk").setCreativeTab(CreativeTabs.tabFood).setIconCoord(7, 0));
HotChocolate = (new ModItemSoup (1008,6).setItemName("HotChocolate").setCreativeTab(CreativeTabs.tabFood).setIconCoord(10, 0));
Custard = (new ModItemSoup (1009,2).setItemName("Custard").setCreativeTab(CreativeTabs.tabFood).setIconCoord(8, 0));
BakedCustard = (new ModItemSoup (1010,6).setItemName("BakedCustard").setCreativeTab(CreativeTabs.tabFood).setIconCoord(2, 0));
CustardDanish = (new ModItemFood (1011,2, false).setItemName("CustardDanish").setCreativeTab(CreativeTabs.tabFood).setIconCoord(9, 0));
BakedDanish = (new ModItemFood (1012,6, false).setItemName("BakedDanish").setCreativeTab(CreativeTabs.tabFood).setIconCoord(3, 0));
Toffee = (new ModItemFood (1013,1,false).setItemName("Toffee").setCreativeTab(CreativeTabs.tabFood).setIconCoord(3, 1));
ToffeeApple = (new ModItemFood (1014,5,false).setItemName("ToffeeApple").setCreativeTab(CreativeTabs.tabFood).setIconCoord(4, 1));
SugarWater = (new ModItemFood(1015,1,false).setItemName("SugarWater").setCreativeTab(CreativeTabs.tabFood).setIconCoord(12, 0));
GlucoseSyrup = (new ModItemFood(1016, 1,false).setItemName("GlucoseSyrup").setCreativeTab(CreativeTabs.tabFood).setIconCoord(11, 0));
*/
registeringBlocks();
blockNames();
itemNames();
recipes();
smelting();
//Minecraft Forge Texture Functions
MinecraftForgeClient.preloadTexture("/Texture/modterrain.png");
MinecraftForgeClient.preloadTexture("/Texture/moditems.png");
}
public void registeringBlocks()
{
GameRegistry.registerBlock(OrangePlank);
}
public void blockNames()
{
LanguageRegistry.addName(OrangePlank, "Orange Wood Planks");
}
public void itemNames()
{
LanguageRegistry.addName(PumpkinSoup, "Pumpkin Soup");
LanguageRegistry.addName(ApplePie, "Apple Pie");
LanguageRegistry.addName(AppleJuice, "Apple Juice");
LanguageRegistry.addName(Juicer, "Juicer");
LanguageRegistry.addName(BoiledEgg, "Boiled Egg");
LanguageRegistry.addName(ChocolateBar, "Chocolate Bar");
LanguageRegistry.addName(ChocolateBlock, "Chocolate Block");
LanguageRegistry.addName(ChocolateMilk, "Chocolate Milk");
LanguageRegistry.addName(HotChocolate, "Hot Chocolate");
LanguageRegistry.addName(Custard, "Custard");
LanguageRegistry.addName(BakedCustard, "Baked Custard");
LanguageRegistry.addName(CustardDanish, "Custard Danish");
LanguageRegistry.addName(BakedDanish, "Baked Danish");
LanguageRegistry.addName(Toffee, "Toffee");
LanguageRegistry.addName(ToffeeApple, "Toffee Apple");
LanguageRegistry.addName(SugarWater, "Sugar Water");
LanguageRegistry.addName(GlucoseSyrup, "Glucose Syrup");
}
public void recipes()
{
GameRegistry.addRecipe(new ItemStack(OrangePlank, 1), new Object[]{
" * ","*X*"," * ", Character.valueOf('*'), new ItemStack(Item.dyePowder, 1, 14), Character.valueOf('X'), Block.planks});
GameRegistry.addRecipe(new ItemStack(PumpkinSoup,1), new Object[]{
" * ", " X ", Character.valueOf('X'), Item.bowlEmpty, Character.valueOf('*'), Block.pumpkin});
GameRegistry.addShapelessRecipe(new ItemStack(ApplePie,1), new Object[]{
new ItemStack(Item.potion, 1, 0), new ItemStack(Item.appleRed), new ItemStack(Item.egg), new ItemStack(Item.sugar)});
GameRegistry.addShapelessRecipe(new ItemStack(AppleJuice,1), new Object[]{
new ItemStack(Item.appleRed), new ItemStack(ModItem.Juicer), new ItemStack(Item.sugar), new ItemStack(Item.glassBottle)});
GameRegistry.addRecipe(new ItemStack(Juicer,1), new Object[]{
" * ", " X ", " ! ", Character.valueOf('*'), Item.flint, Character.valueOf('X'), Item.stick,
Character.valueOf('!'), Item.bowlEmpty});
Juicer.setContainerItem(Juicer);
GameRegistry.addShapelessRecipe(new ItemStack(ChocolateBar,1), new Object[]{
new ItemStack(Item.dyePowder, 1, 3), new ItemStack(Item.sugar), new ItemStack(Item.bucketMilk)});
GameRegistry.addRecipe(new ItemStack(ChocolateBlock,1), new Object[]{
"***", Character.valueOf('*'), ModItem.ChocolateBar});
GameRegistry.addShapelessRecipe(new ItemStack(ChocolateMilk,1), new Object[]{
new ItemStack(ModItem.ChocolateBar), new ItemStack(Item.sugar), new ItemStack(Item.bucketMilk)});
GameRegistry.addShapelessRecipe(new ItemStack(Custard,1), new Object[]{
new ItemStack(Item.sugar), new ItemStack(Item.bucketMilk), new ItemStack(Item.egg)});
GameRegistry.addShapelessRecipe(new ItemStack(CustardDanish,1), new Object[]{
new ItemStack(ModItem.Custard), new ItemStack(Item.wheat), new ItemStack(Item.egg), new ItemStack(Item.sugar)});
GameRegistry.addRecipe(new ItemStack(ToffeeApple,1), new Object[]{
" ! ", " X ", " * ", Character.valueOf('*'), Item.stick, Character.valueOf('X'), Item.appleRed,Character.valueOf('!'), ModItem.Toffee});
GameRegistry.addShapelessRecipe(new ItemStack(SugarWater, 1), new Object[] {
new ItemStack(Item.potion, 1, 0), new ItemStack(Item.sugar)});
}
public void smelting()
{
GameRegistry.addSmelting(ModItem.SugarWater.itemID, new ItemStack(GlucoseSyrup, 1), 0.0F);
GameRegistry.addSmelting(Item.egg.itemID, new ItemStack (BoiledEgg, 1), 0.0F);
GameRegistry.addSmelting(ModItem.ChocolateMilk.itemID, new ItemStack (HotChocolate, 1), 0.0F);
GameRegistry.addSmelting(ModItem.Custard.itemID, new ItemStack (BakedCustard, 1), 0.0F);
GameRegistry.addSmelting(ModItem.CustardDanish.itemID, new ItemStack (BakedDanish, 1), 0.0F);
GameRegistry.addSmelting(Item.sugar.itemID, new ItemStack (Toffee, 1), 0.0F);
}
public void registerOre()
{
OreDictionary.registerOre("AppleJuice", FoodPlusMod.AppleJuice);
OreDictionary.registerOre("ApplePie", FoodPlusMod.ApplePie);
OreDictionary.registerOre("BakedCustard", FoodPlusMod.BakedCustard);
OreDictionary.registerOre("BakedDanish", FoodPlusMod.BakedDanish);
OreDictionary.registerOre("BoiledEgg", FoodPlusMod.BoiledEgg);
OreDictionary.registerOre("ChocolateBar", FoodPlusMod.ChocolateBar);
OreDictionary.registerOre("ChocolateBlock", FoodPlusMod.ChocolateBlock);
OreDictionary.registerOre("Custard", FoodPlusMod.Custard);
OreDictionary.registerOre("Danish", FoodPlusMod.CustardDanish);
OreDictionary.registerOre("GlucoseSyrup", FoodPlusMod.GlucoseSyrup);
OreDictionary.registerOre("HotChocolate", FoodPlusMod.HotChocolate);
OreDictionary.registerOre("ChocolateMilk", FoodPlusMod.ChocolateMilk);
OreDictionary.registerOre("PumpkinSoup", FoodPlusMod.PumpkinSoup);
OreDictionary.registerOre("SugarWater", FoodPlusMod.SugarWater);
OreDictionary.registerOre("Toffee", FoodPlusMod.Toffee);
OreDictionary.registerOre("ToffeeApple", FoodPlusMod.ToffeeApple);
}
}
and here's the error report
---- Minecraft Crash Report ----
// This doesn't make any sense!
Time: 5/03/13 3:02 PM
Description: Failed to start game
java.lang.NullPointerException
at net.minecraft.item.ItemStack.<init>(ItemStack.java:64)
at foodplus.FoodPlusMod.recipes(FoodPlusMod.java:162)
at foodplus.FoodPlusMod.load(FoodPlusMod.java:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:485)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:83)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:657)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:207)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:456)
at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)
at net.minecraft.client.Minecraft.run(Minecraft.java:744)
at java.lang.Thread.run(Unknown Source)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- System Details --
Details:
Minecraft Version: 1.4.7
Operating System: Windows 7 (x86) version 6.1
Java Version: 1.7.0_09, Oracle Corporation
Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
Memory: 990679928 bytes (944 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v7.26 FML v4.7.4.520 Minecraft Forge 6.6.0.497 4 mods loaded, 4 mods active
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized
FoodPlusMod [Food Plus For 1.4.7] (bin) Unloaded->Constructed->Pre-initialized->Errored
LWJGL: 2.4.2
OpenGL: GeForce GT 230M/PCI/SSE2 GL version 3.0.0, NVIDIA Corporation
Is Modded: Definitely; Client brand changed to 'forge,fml'
Type: Client (map_client.txt)
Texture Pack: Default
Profiler Position: N/A (disabled)
Vec3 Pool Size: ~~ERROR~~ NullPointerException: null
Yeah, I do. I have it defined in my main mod file and use it when making tools. The problem seems to be that Minecraft doesn't know what the crafting material is for my custom material. I found this code in the files:
So it seems that my material isn't being inserted into this code, or however enumHelper works. This is confusing.
Maybe it's because you're using those symbols in your recipes? Try sticking to letters if you can, even if that isn't the problem, it looks neater
Never tried actually, try having DamageSource as a superclass though, that should be a good start
Can I see the block code
The custom materials in EnumHelper don't have anything for material, you'll have to override the canRepair method or whatver it's called. I suggest retrieving an ItemStack as one of the parameters for the constructor and then cheking that in the method
Like ones made with Techne.
So we can make blocks that have their own shape, like the brewing stand.
Rendering isn't really my strongpoint, and I don't know much about how to do it, but I will figure it out at some point
Did you use a 256*256 sprite sheet?
What do you mean by add the forge folder from its .zip? Do I need to extract the forge zip to the directory of my MCP folder?FIXED
Even with the letters instead of symbols it still isn't liking it. Could it be something to do with me using ModItem instead of Item as the reference in some of the recipes. I've checked and the recipes that cause crashes are specifically those that use a mod item.
For example
GameRegistry.addRecipe(new ItemStack(ChocolateBlock,1), new Object[]{
"***", Character.valueOf('*'), ModItem.ChocolateBar});
Whereas this recipe is fine
GameRegistry.addRecipe(new ItemStack(PumpkinSoup,1), new Object[]{
" * ", " X ", Character.valueOf('X'), Item.bowlEmpty, Character.valueOf('*'), Block.pumpkin});
But ModItem is the correct name of the class and i have all the items inside the class so it shouldn't have a problem...
This is the ModItem.java file
package foodplus;
import net.minecraft.item.Item;
public class ModItem extends Item
{
public ModItem(int par1)
{
super (par1);
}
//Mod Items for Crafting
public static ModItem Juicer;
public static ModItem ChocolateBar;
public static ModItem Custard;
public static ModItem Toffee;
public static ModItem SugarWater;
public static ModItem ChocolateMilk;
public static ModItem CustardDanish;
public String getTextureFile()
{
return "/Texture/moditems.png";
}
}
I'm all out of ideas to fix it. I've tried fiddling around with various lines of code and what not but nothing seems to work. It's so much easier to fix things like this with ModLoader... ;( haha