• Terraria is 10 years old! Join the celebration with contests, prizes, and chats with the dev team here
  • PC NEWS: update is out! More info here. Report bugs here
  • CONSOLE 1.4 NEWS: The current plan is to have Terraria: Journey's End out for Xbox and PlayStation in Q3 2021 (Jul-Sep). Switch will follow shortly afterwards. More info here. Stay up to date with console news here
  • MOBILE NEWS: Stay up to date with the latest mobile news here. Report mobile bugs here

tAPI Alternate item use on right-click?


Skeletron Prime
I'm trying to make a sword that behaves like a normal sword on left-click, but consumes mana and shoots a projectile on right-click. However, it seems that the only hook in tAPI that calls on right-click is under ModInterface, and I have no idea how to make use of that in context of a specific item. How would I go about implementing this function?


You can catch right click everywhere by monitoring Main.mouseRight (true when right button is down), and Main.players[Main.myPlayer].heldItem provides a reference to currently selected item.
Top Bottom