LibRMX Posted July 22, 2020 Posted July 22, 2020 (edited) Hey, I have a problem with my Custom Sword. Idk why it is happening, but here: My Code Main Class: package com.example.examplemod; import org.apache.logging.log4j.Logger; import net.minecraft.init.Blocks; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemSword; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; @Mod(modid = ExampleMod.MODID, name = ExampleMod.NAME, version = ExampleMod.VERSION) public class ExampleMod { public static final String MODID = "sword"; public static final String NAME = "Sword Test"; public static final String VERSION = "1.0"; public static ToolMaterial myToolMaterial; public static ItemSword mySword; private static Logger logger; @EventHandler public void preInit(FMLPreInitializationEvent event) { logger = event.getModLog(); myToolMaterial = EnumHelper.addToolMaterial("Sapphire Sword", 4, 10000, 20.0F, 50000.0F, 30); mySword = new CustomSword(); } @EventHandler public void init(FMLInitializationEvent event) { // some example code logger.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); } } my CustomSword() Class: package com.example.examplemod; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemSword; public class CustomSword extends ItemSword { public CustomSword() { super(ExampleMod.myToolMaterial); this.setRegistryName("my_sword"); this.setUnlocalizedName("my_sword"); this.setCreativeTab(CreativeTabs.COMBAT); } } My CommonProxy Class: package com.example.examplemod; import net.minecraft.item.Item; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @Mod.EventBusSubscriber public class CommonProxy { @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(ExampleMod.mySword); } } The Error: [23:03:28] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Sword Test (sword) Caused by: java.lang.NoSuchMethodError: com.example.examplemod.CustomSword.setUnlocalizedName(Ljava/lang/String;)Lnet/minecraft/item/Item; at com.example.examplemod.CustomSword.<init>(CustomSword.java:11) ~[CustomSword.class:?] at com.example.examplemod.ExampleMod.preInit(ExampleMod.java:35) ~[ExampleMod.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_261] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_261] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_261] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_261] at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:637) ~[forge.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_261] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_261] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_261] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_261] at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) ~[minecraft_server.1.12.2.jar:?] at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) ~[minecraft_server.1.12.2.jar:?] at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) ~[minecraft_server.1.12.2.jar:?] at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) ~[minecraft_server.1.12.2.jar:?] at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) ~[minecraft_server.1.12.2.jar:?] at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) ~[minecraft_server.1.12.2.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:217) ~[minecraft_server.1.12.2.jar:?] at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:219) ~[forge.jar:?] at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:197) ~[forge.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_261] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_261] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_261] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_261] at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) ~[minecraft_server.1.12.2.jar:?] at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) ~[minecraft_server.1.12.2.jar:?] at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) ~[minecraft_server.1.12.2.jar:?] at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) ~[minecraft_server.1.12.2.jar:?] at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) ~[minecraft_server.1.12.2.jar:?] at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) ~[minecraft_server.1.12.2.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:217) ~[minecraft_server.1.12.2.jar:?] at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:136) ~[LoadController.class:?] at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:629) ~[Loader.class:?] at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:99) ~[FMLServerHandler.class:?] at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:333) ~[FMLCommonHandler.class:?] at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:125) ~[nz.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:486) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_261] [23:03:29] [Server thread/ERROR] [minecraft/MinecraftServer]: This crash report has been saved to: C:\Users\LibRMXWin10\Desktop\Forge Server\.\crash-reports\crash-2020-07-22_23.03.29-server.txt [23:03:29] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server [23:03:29] [Server thread/INFO] [minecraft/MinecraftServer]: Saving worlds [23:03:29] [Server thread/INFO] [FML]: The state engine was in incorrect state INITIALIZATION and forced into state SERVER_STOPPED. Errors may have been discarded. [23:03:29] [Server Shutdown Thread/INFO] [minecraft/MinecraftServer]: Stopping server [23:03:29] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Found status: UP_TO_DATE Target: null [23:03:29] [Server Shutdown Thread/INFO] [minecraft/MinecraftServer]: Saving worlds Idk why that is happening. It says SetUnlocalizedName is not a method and CreativeTabs.COMBAT isnt a thing even if i have imported it. I followed a 1.12.2 Tutorial and my Mod is 1.12.2 Edited July 22, 2020 by LibRMX
poopoodice Posted July 22, 2020 Posted July 22, 2020 (edited) 1.12 is no longer supported Edited July 22, 2020 by poopoodice
LibRMX Posted July 23, 2020 Author Posted July 23, 2020 (edited) 10 hours ago, poopoodice said: 1.12 is no longer supported how? i have the 1.12.2 mdk? So it should work. Because forge is 1.12.2, and my mdk also Edited July 23, 2020 by LibRMX
Recommended Posts