Keybind attack

Started by turtlelord88 on Sat, 01/16/2016 - 23:09

Topic category: Advanced modding

Last seen on 20:53, 17. Jan 2016
Joined Jan 2016
User points:


  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Keybind attack
Sat, 01/16/2016 - 23:15 (edited)

I am trying to make a mod that uses a keybind(Preferably K). So far i have gotten keybinds to work for me, but i want to make the mod either switch the current item with a sword, if its in the inventory, and use the sword as if you are attacking with it. The the sword would hopefully go back to its original spot in the inventory and you can go one with your minecraftian life :P Basically if you are mining and you see a zombie coming at you, you can press K and the sword will appear, switch with the pickaxe, attack, then switch back. Another option is to throw a splash potion of instant damage in front but that is a last resort as i don't want to have to take damage when i press K on a mob. Or you can use the standard keybind and execute a command that is /effect (all entities that didn't use the keybind "k") 7 1 This would give the instant damage effect like above except possibly a simpler way of doing this.

Thanks a lot if you can find an answer to this. otherwise thanks for at least trying...

Edited by turtlelord88 on Sat, 01/16/2016 - 23:15