HassanS6000 Posted January 21, 2015 Share Posted January 21, 2015 This is my Main File: http://pastebin.com/4SSATMu9 This is my HaloArmor File: http://pastebin.com/H1St6sXi This is my CrashReport: http://pastebin.com/mMKAEEYb Now I think the problem is that in my Main file, I set it so that the ID used for the Halo Helmet, Chestplate, Leggings, Boots, are all defined as a variable, yet I never set that variable to have a value. However when I do set it a value, it still crashes. Could it be because I set it to a value already taken? Is there a way to generate a randomID? Will that help? Is my assumption not the real error? Thanks in Advance Quote Link to comment Share on other sites More sharing options...
coolAlias Posted January 21, 2015 Share Posted January 21, 2015 If you bothered to look at the ItemArmor constructor, you would see: public ItemArmor(ItemArmor.ArmorMaterial material, int renderIndex, int armorType) So the 2nd parameter needs to be an integer render index, the same value for each piece of the set, but it doesn't matter because custom render classes probably won't use it at all. It's mostly for vanilla. But that's unrelated to your crash. Your crash is caused because you try to use your ArmorMaterial 'HaloArmor' (which should be 'haloArmor' - lowercase letter first) before it is initialized. Put your armor Item instantiation inside the FMLPreInitializationEvent method, after you have instantiated your armor material. Quote http://i.imgur.com/NdrFdld.png[/img] Link to comment Share on other sites More sharing options...
HassanS6000 Posted January 21, 2015 Author Share Posted January 21, 2015 What's an Integer Render index? Quote Link to comment Share on other sites More sharing options...
HassanS6000 Posted January 21, 2015 Author Share Posted January 21, 2015 My Main File: http://pastebin.com/77JKFfNU I still get the same problem? I'm not sure if I did what you said properly, as when you said "Put your armor Item instantiation inside the FMLPreInitializationEvent method, after you have instantiated your armor material." From what I know, you meant this: public static Item SpartanHelmet = new HaloArmor(HaloArmor, helmetID, 0).setUnlocalizedName("SpartanHelmet"); public static Item SpartanChestplate = new HaloArmor(HaloArmor, chestplateID, 1).setUnlocalizedName("SpartanChestplate"); public static Item SpartanLeggings = new HaloArmor(HaloArmor, leggingID, 2).setUnlocalizedName("SpartanLeggings"); public static Item SpartanBoots = new HaloArmor(HaloArmor, bootID, 3).setUnlocalizedName("SpartanBoots"); however by putting that in the PreInt Method, it caused numerous other errors, in my other classes, so I put it back. Can you explain in further detail what you meant? Quote Link to comment Share on other sites More sharing options...
coolAlias Posted January 21, 2015 Share Posted January 21, 2015 You should probably spend some time learning Java if that didn't make sense. This is a declaration: public static Item myItem; // now there is something named 'myItem', but it is NULL right now. This is an initialization: myItem = new ItemWhatever().setUnlocalizedName("myitem"); // now 'myItem' is a valid Item and no longer NULL 1. You never initialize your ArmorMaterial, all you did was declare it, so it is NULL. 2. renderIndex is used by vanilla, you can probably just pass in zero or whatever else you want. 3. Declare your Items where they are now, but do not initialize them. 4. Initialize your items inside of the method. P.S. Do not send private messages to people about your post. It is both annoying and unnecessary. People will respond if and when they have time / knowledge to do so, and pestering them is only going to make them less likely to help you. Quote http://i.imgur.com/NdrFdld.png[/img] Link to comment Share on other sites More sharing options...
HassanS6000 Posted January 21, 2015 Author Share Posted January 21, 2015 I can't figure out how to initialize the ArmorMaterial. Though I understand that I have called the HaloArmor when it's value is obviously null, how do I initialize it? I've tried a couple ways, and search online but it doesn't work, but says I cannot instantiate the ItemArmor.ArmorMaterial. Any advice? Quote Link to comment Share on other sites More sharing options...
HassanS6000 Posted January 21, 2015 Author Share Posted January 21, 2015 How? The EnumHelper class has NOT been updated to Forge 1.8 yet, as far as I know, and I'm using the other method, which is using ISpecialArmor. Which in another post, you said is possible: 1.8 is beta. The EnumHelper hasn't been updated yet most likely. But you can do it manually, instead of using the predefined addArmor method. So how would I go about initializing this armor material without EnumHelper as it hasn't been updated? Quote Link to comment Share on other sites More sharing options...
Pwjw Posted January 27, 2015 Share Posted January 27, 2015 Hi there. I'm experiencing a similar problem trying to use EnumHelper, and I hoped someone might be able to point out what I am missing. I downloaded the most recent source file, 8.0.20.1023, dated 18th January 2015, and so far the other basic mods I am making are working correctly. However, when following a tutorial to create armour/weapons, I tried to use the EnumHelper class and Eclipse informs me that it is not found. The exact error message is "EnumHelper cannot be resolved". Searching the full tree appears to confirm this. Based on other posts, it looks as though EnumHelper should be found in net.minecraftforge.common.util.EnumHelper, but there is no 'util' package in this branch at all. Just to be clear, when I look under 'Reference Libraries - fmlSrc-1.8-8.0.20.1023-1.8.jar - net - minecraftforge.fml' - common there is no 'util' package at this point. Am I missing something obvious here, of are others experiencing similar problems with this build? Any advice would be greatly appreciated. I was thinking of loading up an earlier version of the source code, perhaps the last one from 2014, build 8.0.16.1021, and seeing if this resolved the problem. Can anyone confirm a specific build that does have EnumHelper (and presumably other util classes) included? Many thanks PWJW Quote Link to comment Share on other sites More sharing options...
Pwjw Posted January 27, 2015 Share Posted January 27, 2015 OK, this is the first part of the code I am using import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.registry.GameRegistry; import WinCrafters.test.Reference; public class TestItems { public static Item item_EmeraldSword; public static final Item.ToolMaterial emeraldSwordMaterial = EnumHelper.addToolMaterial(); In Eclipse EnumHelper is underlined in red, and the error associated with it is "EnumHelper cannot be resolved", and Ctrl+Shift+O does nothing. Any thoughts on how to troubleshoot this would be most welcome. Thanks in advance for you help PWJW Quote Link to comment Share on other sites More sharing options...
Pwjw Posted January 28, 2015 Share Posted January 28, 2015 OK, just to be sure, should that be: import net.minecraftforge.common.util.EnumHelper Many thanks for your help, it's appreciate. PWJW Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.