Posted May 1, 20169 yr Hey so I'm able to use player.getItemInUse() when I run it in single player. But when I connect to a server the server crashes when the code is run. This code is only allowed to run server side and I saw another forum post that said this cant be run server side. If I cant then how do I get what item the player has out?
May 1, 20169 yr In 1.8.9, EntityPlayer#getItemInUse is client-only. You'll need to use reflection to get the value of EntityPlayer#itemInUse instead. In 1.9, EntityLivingBase#getActiveItemStack (the replacement for EntityPlayer#getItemInUse ) is usable from both sides. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
May 1, 20169 yr Pre-1.9, you could also generally assume that the ItemStack returned from #getHeldItem is the one currently in use - it will always be the case for vanilla, and probably for about 99% of mods (even ones like BG2 that add dual-wielding because they purposefully coded it that way). http://i.imgur.com/NdrFdld.png[/img]
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.