Posted November 26, 20177 yr so func onUpdate(ItemStack, World, Entity, int, boolean) takes this parameters, but I want to look if player is holding item in offhand, but there's only Entity, not EntityPlayer, what do I do? Edit: Let me explain, I want to do entity.replaceItemInInventory() but int variable that im gettin is actually same for offhand and mainhand, also armor slots are 1-4, as well as inventory slots. Edited November 26, 20177 yr by LavX64
November 26, 20177 yr if (entityIn instanceof EntityPlayer) Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
November 27, 20177 yr Author 18 hours ago, Draco18s said: if (entityIn instanceof EntityPlayer) I solved my problem by casting ((EntityPlayer)entityIn)
November 29, 20177 yr You better use the code Draco posted before you cast the Entity to EntityPlayer, because if the Entity isn't an EntityPlayer and you try to cast it to EntityPlayer, bad things will happen.
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.