Jump to content

crazykid080

Members
  • Posts

    13
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

crazykid080's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I still need help with getting the command to fire, there is no errors being shown package com.crazykid080.ClearChat.client.handler; import net.minecraft.client.gui.GuiIngame; import net.minecraft.client.gui.GuiNewChat; import com.crazykid080.ClearChat.client.settings.Keybindings; import com.crazykid080.ClearChat.reference.Key; import com.crazykid080.ClearChat.utility.LogHelper; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.InputEvent; public class KeyInputEventHandler { private static Key getPressedKeyBinding(){ if (Keybindings.clear.isPressed()){ return Key.CLEAR; }else{ return null; } } @SubscribeEvent public void handleKeyInputEvent(InputEvent.KeyInputEvent event){ Key pressedKey = getPressedKeyBinding(); LogHelper.debug(pressedKey); if (pressedKey != null){ if(pressedKey.equals(Key.CLEAR)){ deleteChatLine(1); LogHelper.info("fired"); }else{ } } } private void deleteChatLine(int p_146242_1_2) { } }
  2. You never did a nullpointer check seeing whether there was not any buttons being pressed. my dad helped me with that
  3. well I have fixed it, but now I need to find out how to get the code working I have it like this package com.crazykid080.ClearChat.client.handler; import net.minecraft.client.gui.GuiIngame; import net.minecraft.client.gui.GuiNewChat; import com.crazykid080.ClearChat.client.settings.Keybindings; import com.crazykid080.ClearChat.reference.Key; import com.crazykid080.ClearChat.utility.LogHelper; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.InputEvent; public class KeyInputEventHandler { private static Key getPressedKeyBinding(){ if (Keybindings.clear.isPressed()){ return Key.CLEAR; }else{ return null; } } int field_146253_i = 1; int p_146242_1_ = 1; @SubscribeEvent public void handleKeyInputEvent(InputEvent.KeyInputEvent event){ Key pressedKey = getPressedKeyBinding(); LogHelper.info(pressedKey); if (pressedKey != null){ if(pressedKey.equals(Key.CLEAR)){ LogHelper.fatal("IT WORKED"); GuiIngame gui = getChatGUI(); GuiNewChat newChat = gui.getChatGUI(); newChat.deleteChatLine(p_146242_1_); }else{ } } } private GuiIngame getChatGUI() { return null; } }
  4. removed anything not an error report/stack trace
  5. ok, realized that the if statement wasn't firing, so after I changed it, it crashed me, am I doing something wrong in the code? package com.crazykid080.ClearChat.client.handler; import net.minecraft.client.gui.GuiNewChat; import com.crazykid080.ClearChat.client.settings.Keybindings; import com.crazykid080.ClearChat.reference.Key; import com.crazykid080.ClearChat.utility.LogHelper; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.InputEvent; public class KeyInputEventHandler { private static Key getPressedKeyBinding(){ if (Keybindings.clear.isPressed()){ return Key.CLEAR; }else{ return null; } } public int field_146253_i = 1; public int p_146242_1_ = 1; void deleteChatLine(){ } void clearChatMessages(){ } @SubscribeEvent public void handleKeyInputEvent(InputEvent.KeyInputEvent event){ LogHelper.info(getPressedKeyBinding()); if(getPressedKeyBinding().equals(Key.CLEAR)){ LogHelper.fatal("IT WORKED"); //deleteChatLine(); //clearChatMessages(); }else{ } } }
  6. Well I figured out how to implement it non-statically, but now I'm having trouble checking if its the correct keybinding and why it's not being called code: private static Key getPressedKeyBinding(){ if (Keybindings.clear.isPressed()){ return Key.CLEAR; }else{ return null; } } public int field_146253_i = 1; public int p_146242_1_ = 1; void deleteChatLine(){ } @SubscribeEvent public void handleKeyInputEvent(InputEvent.KeyInputEvent event){ LogHelper.debug(getPressedKeyBinding()); if(getPressedKeyBinding() != null){ deleteChatLine(); }else{ } } }
  7. ok, then how do I fix it?
  8. how so? I see no relevant static declarations for that method
  9. that did help and I found a better method for what I want but after I implemented the method it needed, it still said that I am implementing a static reference, the declaration for this method is: public void deleteChatLine(int p_146242_1_) { Iterator iterator = this.field_146253_i.iterator(); ChatLine chatline; while (iterator.hasNext()) { chatline = (ChatLine)iterator.next(); if (chatline.getChatLineID() == p_146242_1_) { iterator.remove(); } } and I have my code set up like this: private static Key getPressedKeyBinding(){ if (Keybindings.clear.isPressed()){ return Key.CLEAR; }else{ return null; } } @SubscribeEvent public void handleKeyInputEvent(InputEvent.KeyInputEvent event){ LogHelper.info(getPressedKeyBinding()); if(Keybindings.clear.isPressed()){ GuiNewChat.deleteChatLine(1); } } }
  10. ok, how am I supposed to set up the instance? I looked at the class where the declaration is and I am confused, I tried multiple ways of setting up the instance but none seem to work
  11. having trouble with the GuiNewChat, It is saying that I'm making a static reference to a non static method Here is how my key input event handler is set up right now public class KeyInputEventHandler { private static Key getPressedKeyBinding(){ if (Keybindings.clear.isPressed()){ return Key.CLEAR; }else{ return null; } } @SubscribeEvent public void handleKeyInputEvent(InputEvent.KeyInputEvent event){ LogHelper.info(getPressedKeyBinding()); if(Keybindings.clear.isPressed()){ GuiNewChat.refreshChat(); } } }
  12. What the hell dude... of course he can. Take a look at GuiNewChat, it has methods to remove from text. As for KeyBindings... there are enough tutorials. ok, thanks, I'll try it
  13. I'm making a mod for removing the most recent line in chat from the client, what I don't know is: 1 where to execute the full command for the key binding 2 what the code is to remove the most recent line of code
×
×
  • Create New...

Important Information

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