Hi! I'm making 2 mods, but I've been getting this runtime error in both mods. They compile ok, IntelliJ doesn't highlights any error, but when I test them, Minecraft throws a java.lang.NoSuchMethodError.
I'm using Forge 1.8-11.14.3.1521 to run, and IntelliJ IDEA 14.1.4 as IDE.
I checked the methods, the imports (the line itself), and the files being imported, and everything is ok. I also searched this online, even here, but I didn't find an answer to my problem.
I can't modify the import, as it's from an external library.
Here I will put the error of one of the mods, along with the relevant code of the file imported and the MC Crash report. I hope you guys can help me with this.
File 'errored':
package com.joa.techmod.items;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
public class BasicItem extends Item {
public BasicItem(String unlocalizedName) {
super();
this.setUnlocalizedName(unlocalizedName); // <- This is "wrong"
this.setCreativeTab(CreativeTabs.tabMaterials);
}
}
Import (Item, resume):
package net.minecraft.item;
import ...
public class Item
{
...
private String unlocalizedName;
...
/**
* Sets the unlocalized name of this item to the string passed as the parameter, prefixed by "item."
*/
public Item setUnlocalizedName(String unlocalizedName)
{
this.unlocalizedName = unlocalizedName;
return this;
}
...
}
Crash Report:
---- Minecraft Crash Report ----
// I just don't know what went wrong
Time: 13/10/15 13:23
Description: There was a severe problem during mod loading that has caused the game to fail
net.minecraftforge.fml.common.LoaderException: java.lang.NoSuchMethodError: com.joa.techmod.items.BasicItem.setUnlocalizedName(Ljava/lang/String;)Lnet/minecraft/item/Item;
at net.minecraftforge.fml.common.LoadController.transition(LoadController.java:163)
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:553)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:249)
at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:413)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:325)
at net.minecraft.client.main.Main.main(SourceFile:120)
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)
Caused by: java.lang.NoSuchMethodError: com.joa.techmod.items.BasicItem.setUnlocalizedName(Ljava/lang/String;)Lnet/minecraft/item/Item;
at com.joa.techmod.items.BasicItem.<init>(BasicItem.java:10)
at com.joa.techmod.items.ModItems.createItems(ModItems.java:50)
at com.joa.techmod.CommonProxy.preInit(CommonProxy.java:12)
at com.joa.techmod.ClientProxy.preInit(ClientProxy.java:12)
at com.joa.techmod.Main.preInit(Main.java:26)
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:537)
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:212)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:190)
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:119)
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:550)
... 10 more