Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hi, I have a server crash problem due to my custom Key Handler class (NoDefFound). I have tried many things that dont seem to work: I tried registering it through KeyBindingRegistry and tried TickRegistry. I also added @SideOnly(Side.Client) annotations over the keyhandler. Here is the key handler code

@SideOnly(Side.CLIENT)
static KeyBinding binding = new KeyBinding("Aura Screen", Keyboard.KEY_R);

public AlchemiconKeyHandler() {
	super(new KeyBinding[] { binding }, new boolean[] { false });
}

@Override
public String getLabel() {
	return "mykeybindings";
}

@Override
public void keyDown(EnumSet<TickType> types, KeyBinding kb,
		boolean tickEnd, boolean isRepeat) {

	if (Minecraft.getMinecraft().currentScreen == null && tickEnd
			&& Minecraft.getMinecraft().inGameHasFocus) {
		Packet250CustomPayload packet = new Packet250CustomPayload();
		packet.channel = "aura";
		PacketDispatcher.sendPacketToServer(packet);
	}
}

@Override
public void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd) {
}

@Override
public EnumSet<TickType> ticks() {
	return EnumSet.of(TickType.CLIENT);
} 

Thanks for any help

  • Author

I dont think its needed, but il post it.  The NoDefCrash on the KeyHandler is because the KeyHandler is a client side class, not server, but even with the Side Annotations it still doesnt work.

2013-07-21 09:08:52 [sEVERE] [Minecraft-Server] Encountered an unexpected exception NoClassDefFoundError
java.lang.NoClassDefFoundError: net/minecraft/client/settings/KeyBinding
at wookiederk.AlchemiconKeyHandler.<clinit>(AlchemiconKeyHandler.java:20)
at wookiederk.Alchemicon.<init>(Alchemicon.java:137)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at cpw.mods.fml.common.ILanguageAdapter$JavaAdapter.getNewInstance(ILanguageAdapter.java:36)
at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:466)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:98)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:503)
at cpw.mods.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:85)
at cpw.mods.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:350)
at net.minecraft.server.dedicated.DedicatedServer.startServer(DedicatedServer.java:69)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:430)
at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.settings.KeyBinding
at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:238)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 36 more
Caused by: java.lang.RuntimeException: Attempted to load class net/minecraft/client/settings/KeyBinding for invalid side SERVER
at cpw.mods.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:50)
at cpw.mods.fml.relauncher.RelaunchClassLoader.runTransformers(RelaunchClassLoader.java:352)
at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:225)
... 38 more 

The line on the KeyHandler is the initilization of the binding, and the load in the main class is for the KeyBindingRegistry.

KeyHandler should only be registered on client side.

Use KeyBindingRegistry.registerKeyHandler on your client proxy for example.

 

As a side note, Annotations are supposed to help finding issues, not fixing them.

  • 4 weeks later...

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.