Posted October 26, 201411 yr When I try and launch my mod from a server, it just crashes and says that it can't find the keybindings class. My class is as follows: public static final int TOGGLEBENDING = 0; private static final String[] desc = {"Toggle Bending"}; private static final int[] keyValues = {Keyboard.KEY_X}; private final KeyBinding[] keys; public static boolean BendingActive; public ToggleBending() { keys = new KeyBinding[desc.length]; for (int i = 0; i < desc.length; ++i) { keys[i] = new KeyBinding(desc[i], keyValues[i], "Elemental Imperium"); ClientRegistry.registerKeyBinding(keys[i]); } } @SideOnly(Side.CLIENT) @SubscribeEvent public void onKeyInput(KeyInputEvent event) { if (keys[TOGGLEBENDING].isPressed()) { if (BendingActive) { BendingActive = false; System.out.println("Bending Activated"); Minecraft.getMinecraft().thePlayer.sendChatMessage("Bending Activated"); }else{ BendingActive = true; System.out.println("Bending Dectivated"); Minecraft.getMinecraft().thePlayer.sendChatMessage("Bending Deactivated"); } } } And my crash report from the server is: ---- Minecraft Crash Report ---- // Don't do that. Time: 26/10/14 12:12 PM Description: Exception in server tick loop cpw.mods.fml.common.LoaderException: java.lang.NoClassDefFoundError: net/minecraft/client/settings/KeyBinding at cpw.mods.fml.common.LoadController.transition(LoadController.java:162) at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:515) at cpw.mods.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:88) at cpw.mods.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:314) at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:117) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:387) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685) Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/settings/KeyBinding at com.elementalimperium.bending.ToggleBending.<init>(ToggleBending.java:27) at com.elementalimperium.ElementalImperium.preInit(ElementalImperium.java:47) 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 cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) 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 cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) 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 cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) ... 5 more Caused by: java.lang.ClassNotFoundException: net.minecraft.client.settings.KeyBinding at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 34 more Caused by: java.lang.NullPointerException A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.7.0_67, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 244839904 bytes (233 MB) / 376963072 bytes (359 MB) up to 1908932608 bytes (1820 MB) JVM Flags: 2 total; -Xmx2G -XX:MaxPermSize=256M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.05 FML v7.10.85.1232 Minecraft Forge 10.13.2.1232 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized FML{7.10.85.1232} [Forge Mod Loader] (forge-1.7.10-10.13.2.1232-universal.jar) Unloaded->Constructed->Pre-initialized Forge{10.13.2.1232} [Minecraft Forge] (forge-1.7.10-10.13.2.1232-universal.jar) Unloaded->Constructed->Pre-initialized elementalimperium{Dev Build 0.1.0.0} [Elemental Imperium] (Elemental_Imperium_DevBuild-0.1.0.7.jar) Unloaded->Constructed->Errored Profiler Position: N/A (disabled) Is Modded: Definitely; Server brand changed to 'fml,forge' Type: Dedicated Server (map_server.txt) Also, does anyone know how to send a chat message TO the player (Instead of from the player)? Thanks in advance -Whyneb360
October 26, 201411 yr Key bindings are only on the client, you have to register them through your client proxy, and send packets if you want to do anything on the server. BEFORE ASKING FOR HELP READ THE EAQ! I'll help if I can. Apologies if I do something obviously stupid. If you don't know basic Java yet, go and follow these tutorials.
October 26, 201411 yr Author Thank you, Could you please supply a link to where I can learn more about these packets?
October 26, 201411 yr Here you go. BEFORE ASKING FOR HELP READ THE EAQ! I'll help if I can. Apologies if I do something obviously stupid. If you don't know basic Java yet, go and follow these tutorials.
October 26, 201411 yr You shouldn't need packets if what you are doing is on the client side only (i.e., if your 'BendingActive' is meant for rendering or some such). If you need that information on the server for whatever reason, then yes, you will need packets. Your problem is more likely that you registered your KeyBinding class on both sides - register it in your ClientProxy to keep it isolated to the client side, and you should not crash with the exception given. http://i.imgur.com/NdrFdld.png[/img]
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.