Posted July 25, 20169 yr is there a method like onItemRightClick but only runs when im not looking at a block?
July 25, 20169 yr Author Sounds like you want PlayerInteractEvent. so i looked at the class file of it, im not too sure how to use it. would this be correct? public PlayerInteractEvent(EntityPlayer player, Action action, BlockPos pos, EnumFacing face, World world){ if (action == RIGHT_CLICK_AIR) { //code } }
July 25, 20169 yr Author Look up a tutorial on how to use forge events. wow thanks for answering my short question...
July 26, 20169 yr I have a vague memory of #onItemUse being the method called when you right-click on a block, and #onItemRightClick being called only when you clicked in the air... but it's been more than 6 months since I've messed with it, so I could be completely mis-remembering that. But, if it's not your Item class but someone else's (e.g. vanilla item), then yeah, diesieben is right - use PlayerInteractEvent. There are lots of event tutorials online that cover how to do it in detail, more detail than anyone would want to type here. http://i.imgur.com/NdrFdld.png[/img]
July 27, 20169 yr Food items can be used without acting upon a block, so what path do they take? Using the debugger, try to trace the execution path of a vanilla food item being eaten. The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
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.