Jump to content

[1.7.2][SOLVED] Key Handler/Server crash


korti11

Recommended Posts

Good evening everybody,

 

I am using a keybinding in my mod and I wanted to test on the server, but the server crash all the time.

 

My code:

 

KeyBinding class

 

 

public class RedKeyBinding{

public static int switchKey = Keyboard.KEY_H;

@SideOnly(Side.CLIENT)
public KeyBinding invert = new KeyBinding("Switch", switchKey, RedModInfo.ModName);

public RedKeyBinding(){
	ClientRegistry.registerKeyBinding(invert);
}

@SubscribeEvent
public void KeyInputEvent(KeyInputEvent event){

	Item[] items = new Item[]{RedTools.redSword, RedTools.redSwordCharged, RedTools.redPickaxe, RedTools.redPickaxeCharged, RedTools.redAxe, RedTools.redAxeCharged};

	if(invert.isPressed()){
		InventoryPlayer inventory = Minecraft.getMinecraft().thePlayer.inventory;
		InventoryPlayer inventoryMP = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(Minecraft.getMinecraft().thePlayer.getDisplayName()).inventory;

		for(int i = 0; i < items.length && inventory.getCurrentItem() != null; i += 2){
			if(inventory.getCurrentItem().getUnlocalizedName().equals(new ItemStack(items[i]).getUnlocalizedName())){
				inventory.setInventorySlotContents(inventory.currentItem, new ItemStack(items[i + 1], 1, inventory.getCurrentItem().getItemDamage()));
				inventoryMP.setInventorySlotContents(inventoryMP.currentItem, new ItemStack(items[i + 1], 1, inventory.getCurrentItem().getItemDamage()));
			}
			else if(inventory.getCurrentItem().getUnlocalizedName().equals(new ItemStack(items[i + 1]).getUnlocalizedName())){
				inventory.setInventorySlotContents(inventory.currentItem, new ItemStack(items[i], 1, inventory.getCurrentItem().getItemDamage()));
				inventoryMP.setInventorySlotContents(inventoryMP.currentItem, new ItemStack(items[i], 1, inventory.getCurrentItem().getItemDamage()));
			}
		}
	}
}
}

 

 

 

KeyHandler class

 

 

public class RedKeyHandler {

public static void init(){
	EventBus eventBus = FMLCommonHandler.instance().bus();
	eventBus.register(new RedKeyBinding());
	eventBus.register(new RedKeyHandler());
}
}

 

 

 

Crashreport

 

 

---- Minecraft Crash Report ----
// Don't be sad, have a hug! <3

Time: 07.03.14 20:34
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:163)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:497)
at cpw.mods.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:78)
at cpw.mods.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:296)
at net.minecraft.server.dedicated.DedicatedServer.startServer(DedicatedServer.java:115)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:414)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:706)
Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/settings/KeyBinding
at at.minecraft.korti.invertredstonetools.utils.RedKeyBinding.<init>(RedKeyBinding.java:29)
at at.minecraft.korti.invertredstonetools.utils.RedKeyHandler.init(RedKeyHandler.java:12)
at at.minecraft.korti.invertredstonetools.RedstoneTools.preInit(RedstoneTools.java:33)
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:536)
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.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)
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.sendEventToModContainer(LoadController.java:209)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188)
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.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)
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:119)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:495)
... 5 more
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.settings.KeyBinding
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:188)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 35 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 net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:276)
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:174)
... 37 more


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- System Details --
Details:
Minecraft Version: 1.7.2
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_51, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 917219752 bytes (874 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
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.01-pre FML v7.2.125.1039 Minecraft Forge 10.12.0.1039 4 mods loaded, 4 mods active
mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized
FML{7.2.125.1039} [Forge Mod Loader] (forgeBin-1.7.2-10.12.0.1039.jar) Unloaded->Constructed->Pre-initialized
Forge{10.12.0.1039} [Minecraft Forge] (forgeBin-1.7.2-10.12.0.1039.jar) Unloaded->Constructed->Pre-initialized
invertredstonetools{Alpha 0.1.1} [invert Redstone Tools] (bin) Unloaded->Constructed->Errored
Profiler Position: N/A (disabled)
Is Modded: Definitely; Server brand changed to 'fml,forge'
Type: Dedicated Server (map_server.txt)

 

 

 

Sorry for my bad english and a good weekend :D

Link to comment
Share on other sites

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • CubeHaven is a SMP server with unique features that can't be found on the majority of other servers! Java: MC.CUBEHAVEN.NET Bedrock: MC.CUBEHAVEN.NET:19132 3 different stores: - CubeHaven Store: Our store to purchase using real money. - Bitcoin Store: Store for Bitcoin. Bitcoin can be earned from playing the server. Giving options for players if they want to spend real money or grind to obtain exclusive packages. - Black Market: A hidden store for trading that operates outside our traditional stores, like custom enchantments, exclusive items and more. Some of our features include: Rank Up: Progress through different ranks to unlock new privileges and perks. 📈 Skills: RPG-style skill system that enhances your gaming experience! 🎮 Leaderboards: Compete and shine! Top players are rewarded weekly! 🏆 Random Teleporter: Travel instantly across different worlds with a click! 🌐 Custom World Generation: Beautifully generated world. 🌍 Dungeons: Explore challenging and rewarding dungeons filled with treasures and monsters. 🏰 Kits: Unlock ranks and gain access to various kits. 🛠️ Fishing Tournament: Compete in a friendly fishing tournament! 🎣 Chat Games: Enjoy games right within the chat! 🎲 Minions: Get some help from your loyal minions. 👥 Piñata Party: Enjoy a festive party with Piñatas! 🎉 Quests: Over 1000 quests that you can complete! 📜 Bounty Hunter: Set a bounty on a player's head. 💰 Tags: Displayed on nametags, in the tab list, and in chat. 🏷️ Coinflip: Bet with other players on coin toss outcomes, victory, or defeat! 🟢 Invisible & Glowing Frames: Hide your frames for a cleaner look or apply a glow to it for a beautiful look. 🔲✨[ Player Warp: Set your own warp points for other players to teleport to. 🌟 Display Shop: Create your own shop and sell to other players! 🛒 Item Skins: Customize your items with unique skins. 🎨 Pets: Your cute loyal companion to follow you wherever you go! 🐾 Cosmetics: Enhance the look of your character with beautiful cosmetics! 💄 XP-Bottle: Store your exp safely in a bottle for later use! 🍶 Chest & Inventory Sorting: Keep your items neatly sorted in your inventory or chest! 📦 Glowing: Stand out from other players with a colorful glow! ✨ Player Particles: Over 100 unique particle effects to show off. 🎇 Portable Inventories: Over virtual inventories with ease. 🧳 And a lot more! Become part of our growing community today! Discord: https://cubehaven.net/discord Java: MC.CUBEHAVEN.NET Bedrock: MC.CUBEHAVEN.NET:19132
    • # Problematic frame: # C [libopenal.so+0x9fb4d] It is always the same issue - this refers to the Linux OS - so your system may prevent Java from working   I am not familiar with Linux - check for similar/related issues  
    • Create a new instance and start with Embeddium/Oculus and Valkyrien Skies Try different builds of Embeddium/Valkyrien Skies until you find a working combination - then add the rest of your mods one by one or in groups
    • There are some mods missing Missing or unsupported mandatory dependencies: Mod ID: 'octolib', Requested by: 'ramcompat', Expected range: '[0.1,)', Actual version: '[MISSING]' Mod ID: 'forge', Requested by: 'tfc', Expected range: '[47.1.3,47.1.6),[47.1.81,47.2.0),[47.2.6,)', Actual version: '47.2.0' Mod ID: 'relics', Requested by: 'ramcompat', Expected range: '[0.6.5,)', Actual version: '[MISSING]' Add octolib and relics and update tfc to build 47.2.6
    • Make a test with adding LMFT https://www.curseforge.com/minecraft/mc-mods/lmft
  • Topics

×
×
  • Create New...

Important Information

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