Posted January 11, 201312 yr Is there a reason EntityPlayer.getItemInUse() is flagged @SideOnly(Side.CLIENT) ? Removing @SideOnly(Side.CLIENT) doesn't appear to cause any problems (very limited testing) Testing on both the built-in LAN server and stand alone dedicated server (through Eclipse) returned the correct item every time. If it has to stay client side only, does anyone know of a server side equivalent?
January 11, 201312 yr Why do you need to have getItemInUse? There may be an alternate solution. "you seem to be THE best modder I've seen imo." ~spynathan ლ(́◉◞౪◟◉‵ლ
January 11, 201312 yr Author I'm checking if the item is a food, and stopping the player from eating. EDIT: Found a workaround Using PlayerInteractEvent, I check for right click events, get the current item, see if its a food, cancel the event accordingly. It also solves the problem of the cake blocks avoiding my previous checks. stops the block from being used but players still get the food value.
January 11, 201312 yr Also think about this, what item would a server be holding??? "you seem to be THE best modder I've seen imo." ~spynathan ლ(́◉◞౪◟◉‵ლ
January 11, 201312 yr Author I was using the server side instance of the player (checking in LivingUpdateEvent) but getItemInUse is locked to the client (even though unlocked it works on the server) PlayerInteractEvent works better, it doesn't need getItemInUse and the check doesn't happen as often.
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.