mooL Posted July 25, 2016 Posted July 25, 2016 is there a method like onItemRightClick but only runs when im not looking at a block? Quote
mooL Posted July 25, 2016 Author Posted July 25, 2016 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 } } Quote
mooL Posted July 25, 2016 Author Posted July 25, 2016 Look up a tutorial on how to use forge events. wow thanks for answering my short question... Quote
coolAlias Posted July 26, 2016 Posted July 26, 2016 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. Quote http://i.imgur.com/NdrFdld.png[/img]
jeffryfisher Posted July 27, 2016 Posted July 27, 2016 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. Quote 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.
Recommended Posts
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.