Jump to content

Recommended Posts

Posted

I recently updated my mod from 1.9 to 1.9.4, all is well except that creating custom armors is very messed up. I registered my armor material like this:

public static ArmorMaterial silverMetal = EnumHelper.addArmorMaterial("Silver", "iceandfire:armor_silverMetal", 25, new int[] { 2, 7, 6, 2 }, 20, SoundEvents.ITEM_ARMOR_EQUIP_CHAIN);

 

and initialized my item like this:

	silver_helmet = new ItemSilverArmor(silverMetal, 0, EntityEquipmentSlot.HEAD, "armor_silverMetal_helmet", "iceandfire.silver_helmet");

 

 

However I get a crash.

 

 

[08:43:17] [Client thread/ERROR] [FML]: Caught exception from iceandfire
java.lang.ExceptionInInitializerError
at com.github.alexthe666.iceandfire.IceAndFire.init(IceAndFire.java:76) ~[bin/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:563) ~[forgeSrc-1.9.4-12.17.0.1917-1.9.4.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:228) ~[forgeSrc-1.9.4-12.17.0.1917-1.9.4.jar:?]
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:206) ~[forgeSrc-1.9.4-12.17.0.1917-1.9.4.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135) [LoadController.class:?]
at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:765) [Loader.class:?]
at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:316) [FMLClientHandler.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:557) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:384) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
at GradleStart.main(GradleStart.java:26) [start/:?]
Caused by: java.lang.RuntimeException: net.minecraft.item.ItemArmor$ArmorMaterial.<init>(java.lang.String, int, java.lang.String, int, [i, int, net.minecraft.util.SoundEvent)
at net.minecraftforge.common.util.EnumHelper.addEnum(EnumHelper.java:347) ~[EnumHelper.class:?]
at net.minecraftforge.common.util.EnumHelper.addEnum(EnumHelper.java:217) ~[EnumHelper.class:?]
at net.minecraftforge.common.util.EnumHelper.addEnum(EnumHelper.java:203) ~[EnumHelper.class:?]
at net.minecraftforge.common.util.EnumHelper.addEnum(EnumHelper.java:189) ~[EnumHelper.class:?]
at net.minecraftforge.common.util.EnumHelper.addArmorMaterial(EnumHelper.java:63) ~[EnumHelper.class:?]
at com.github.alexthe666.iceandfire.core.ModItems.<clinit>(ModItems.java:72) ~[ModItems.class:?]
... 44 more
Caused by: java.lang.NoSuchMethodException: net.minecraft.item.ItemArmor$ArmorMaterial.<init>(java.lang.String, int, java.lang.String, int, [i, int, net.minecraft.util.SoundEvent)
at java.lang.Class.getConstructor0(Unknown Source) ~[?:1.8.0_91]
at java.lang.Class.getDeclaredConstructor(Unknown Source) ~[?:1.8.0_91]
at net.minecraftforge.common.util.EnumHelper.getConstructorAccessor(EnumHelper.java:145) ~[EnumHelper.class:?]
at net.minecraftforge.common.util.EnumHelper.makeEnum(EnumHelper.java:154) ~[EnumHelper.class:?]
at net.minecraftforge.common.util.EnumHelper.addEnum(EnumHelper.java:337) ~[EnumHelper.class:?]
at net.minecraftforge.common.util.EnumHelper.addEnum(EnumHelper.java:217) ~[EnumHelper.class:?]
at net.minecraftforge.common.util.EnumHelper.addEnum(EnumHelper.java:203) ~[EnumHelper.class:?]
at net.minecraftforge.common.util.EnumHelper.addEnum(EnumHelper.java:189) ~[EnumHelper.class:?]
at net.minecraftforge.common.util.EnumHelper.addArmorMaterial(EnumHelper.java:63) ~[EnumHelper.class:?]
at com.github.alexthe666.iceandfire.core.ModItems.<clinit>(ModItems.java:72) ~[ModItems.class:?]
... 44 more
[08:43:17] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:646]: ---- Minecraft Crash Report ----
// This doesn't make any sense!

Time: 6/13/16 8:43 AM
Description: There was a severe problem during mod loading that has caused the game to fail

net.minecraftforge.fml.common.LoaderException: java.lang.ExceptionInInitializerError
at net.minecraftforge.fml.common.LoadController.transition(LoadController.java:179)
at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:767)
at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:316)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:557)
at net.minecraft.client.Minecraft.run(Minecraft.java:384)
at net.minecraft.client.main.Main.main(Main.java:118)
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 net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
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 net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)
Caused by: java.lang.ExceptionInInitializerError
at com.github.alexthe666.iceandfire.IceAndFire.init(IceAndFire.java:76)
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 net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:563)
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.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:228)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:206)
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.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135)
at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:765)
... 16 more
Caused by: java.lang.RuntimeException: net.minecraft.item.ItemArmor$ArmorMaterial.<init>(java.lang.String, int, java.lang.String, int, [i, int, net.minecraft.util.SoundEvent)
at net.minecraftforge.common.util.EnumHelper.addEnum(EnumHelper.java:347)
at net.minecraftforge.common.util.EnumHelper.addEnum(EnumHelper.java:217)
at net.minecraftforge.common.util.EnumHelper.addEnum(EnumHelper.java:203)
at net.minecraftforge.common.util.EnumHelper.addEnum(EnumHelper.java:189)
at net.minecraftforge.common.util.EnumHelper.addArmorMaterial(EnumHelper.java:63)
at com.github.alexthe666.iceandfire.core.ModItems.<clinit>(ModItems.java:72)
... 44 more
Caused by: java.lang.NoSuchMethodException: net.minecraft.item.ItemArmor$ArmorMaterial.<init>(java.lang.String, int, java.lang.String, int, [i, int, net.minecraft.util.SoundEvent)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getDeclaredConstructor(Unknown Source)
at net.minecraftforge.common.util.EnumHelper.getConstructorAccessor(EnumHelper.java:145)
at net.minecraftforge.common.util.EnumHelper.makeEnum(EnumHelper.java:154)
at net.minecraftforge.common.util.EnumHelper.addEnum(EnumHelper.java:337)
... 49 more


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- System Details --
Details:
Minecraft Version: 1.9.4
Operating System: Windows 8.1 (amd64) version 6.3
Java Version: 1.8.0_91, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 585802192 bytes (558 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP 9.28 Powered by Forge 12.17.0.1917 5 mods loaded, 5 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHI	mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
UCHI	FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.9.4-12.17.0.1917-1.9.4.jar) 
UCHI	Forge{12.17.0.1917} [Minecraft Forge] (forgeSrc-1.9.4-12.17.0.1917-1.9.4.jar) 
UCHE	iceandfire{0.1.4} [ice and Fire] (bin) 
UCHI	llibrary{1.3.1} [LLibrary] (llibrary-1.3.1-1.9-dev.jar) 
Loaded coremods (and transformers): 
GL info: ' Vendor: 'Intel' Version: '4.2.0 - Build 10.18.10.3316' Renderer: 'Intel(R) HD Graphics 4400'
[08:43:17] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:646]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\alexr_000\Desktop\Mods\Ice_and_Fire\eclipse\.\crash-reports\crash-2016-06-13_08.43.17-client.txt
AL lib: (EE) alc_cleanup: 1 device not closed
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

 

 

 

Now, if we look at the ArmorMaterial Enum, this is how they are registered:

LEATHER("leather", 5, new int[]{1, 2, 3, 1}, 15, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, 0.0F),
        CHAIN("chainmail", 15, new int[]{1, 4, 5, 2}, 12, SoundEvents.ITEM_ARMOR_EQUIP_CHAIN, 0.0F),
        IRON("iron", 15, new int[]{2, 5, 6, 2}, 9, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0.0F),
        GOLD("gold", 7, new int[]{1, 3, 5, 2}, 25, SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 0.0F),
        DIAMOND("diamond", 33, new int[]{3, 6, 8, 3}, 10, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 2.0F);

 

I think this issue is caused by the extra param in the addEnum method, however I want to know about your thoughts.

Posted

The new parameters (equip sound and armor toughness) are exactly what's causing your problem. (The ArmorMaterial constructors were broken in Forge 1.9 because they didn't have the new parameters which were added in 1.9 and 1.9.2, but this was fixed in Forge 1.9.4.) Just use one of the armor equip sounds (or the generic one, ITEM_ARMOR_EQUIP_GENERIC, or a custom sound, or just null for no sound) and add in a 0.0F for the toughness parameter. (Unless, of course, you want your custom armor to have extra toughness.) Not really much to discuss here.

Colore - The mod that adds monochrome blocks in every color of the rainbow!

http://www.minecraftforge.net/forum/index.php?topic=35149

 

If you're looking to learn how to make mods for 1.9.4, I wrote a helpful article with links to a lot of useful resources for learning Minecraft 1.9.4 modding!

 

http://supergeniuszeb.com/mods/a-helpful-list-of-minecraft-1-9-4-modding-resources/

Posted
EnumHelper.addArmorMaterial

had the

toughness

parameter added a while back, make sure you're using the latest version of Forge.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.