GTNewHorizons/lwjgl3ify

Problem with DivineRPG

Closed this issue · 2 comments

Caused by: java.lang.ExceptionInInitializerError
	at net.divinerpg.utils.items.IceikaItems.<clinit>(IceikaItems.java:34)
	at net.divinerpg.utils.proxies.CommonProxy.preInitServer(CommonProxy.java:101)
	at net.divinerpg.DivineRPG.preInit(DivineRPG.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532)
	at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/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 cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)
	at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/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 cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)
	at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:556)
	... 15 more
Caused by: java.lang.RuntimeException: Can not change already set repair material
	at net.minecraft.item.Item$ToolMaterial.setRepairItem(Item.java:1403)
	at net.divinerpg.utils.Util.addMeleeMaterial(Util.java:168)
	at net.divinerpg.utils.material.ToolMaterialMod.<clinit>(ToolMaterialMod.java:19)
	... 44 more

Problematic code from the mod:

    public static ToolMaterial addMeleeMaterial(int maxUses, float damage, int enchantability, Item repair) {
        return EnumHelper.addEnum(ToolMaterial.class, "", 0, maxUses, 0, damage - 5, enchantability)
                .setRepairItem(new ItemStack(repair, 1));
    }

As I understand, before the EnumHelper update, added fields with the same name were replaced, thereby DivineRPG could add a bunch of materials with an empty name.

I added the "name" field in the Util functions where it is added to the enum ToolMaterial and after that DivineRPG started working. I just took the names from the names of the variables.

Should be fixed in latest versions thanks to the enumhelper duplicate name fix.