Jump to content

Lqgback

Members
  • Posts

    5
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Lqgback's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hello! After creating a keybinding class, I began testing through the IDE. All functions work perfect when I run the main class in Eclipse and play the temporary forge version of the game, but when I export and run the mod normally, the game crashes whenever a key is pressed. Here is the error message: The game crashed whilst unexpected errorError: java.lang.NoSuchMethodError: net.minecraft.client.settings.KeyBinding.isPressed()Z Here is my keyinputhandler class: import net.minecraft.client.Minecraft; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent; public class KeyInputHandler { public Events eventsClass; public KeyInputHandler(Events eClass) { eventsClass = eClass; } @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent e) { if (KeyBinds.toggleMsgs.isPressed()) { eventsClass.showMsgs = !eventsClass.showMsgs; if (eventsClass.showMsgs) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation(EnumChatFormatting.GREEN + "Messages toggled: " + EnumChatFormatting.GOLD + "ON" + EnumChatFormatting.GREEN + "!")); } else { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation(EnumChatFormatting.GREEN + "Messages toggled: " + EnumChatFormatting.GOLD + "OFF" + EnumChatFormatting.GREEN + "!")); } } else if (KeyBinds.toggleGuild.isPressed()) { eventsClass.showGuild = !eventsClass.showGuild; if (eventsClass.showGuild) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation(EnumChatFormatting.GREEN + "Guild chat toggled: " + EnumChatFormatting.GOLD + "ON" + EnumChatFormatting.GREEN + "!")); } else { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation(EnumChatFormatting.GREEN + "Guild chat toggled: " + EnumChatFormatting.GOLD + "OFF" + EnumChatFormatting.GREEN + "!")); } } else if (KeyBinds.toggleParty.isPressed()) { eventsClass.showParty = !eventsClass.showParty; if (eventsClass.showParty) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation(EnumChatFormatting.GREEN + "Party chat toggled: " + EnumChatFormatting.GOLD + "ON" + EnumChatFormatting.GREEN + "!")); } else { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation(EnumChatFormatting.GREEN + "Party chat toggled: " + EnumChatFormatting.GOLD + "OFF" + EnumChatFormatting.GREEN + "!")); } } else if (KeyBinds.toggleAutoGG.isPressed()) { eventsClass.autoGG = !eventsClass.autoGG; if (eventsClass.autoGG) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation(EnumChatFormatting.GREEN + "Auto GG toggled: " + EnumChatFormatting.GOLD + "ON" + EnumChatFormatting.GREEN + "!")); } else { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation(EnumChatFormatting.GREEN + "Auto GG toggled: " + EnumChatFormatting.GOLD + "OFF" + EnumChatFormatting.GREEN + "!")); } } } } Any insight would be helpful!
  2. After registering the event in a separate class all is working. Thanks for the help!
  3. Hello! As a start to a mod that I hope will remove specific chat events, I decided to attempt to remove all server chat by cancelling every "ClientChatReceivedEvent" event. Here is that source: @SubscribeEvent public void ClientChatReceivedEvent(ClientChatReceivedEvent e) { e.setCanceled(true); } However, when I run the mod, there is no visible effect. Anyone know why this might happen?
×
×
  • Create New...

Important Information

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