Posted August 25, 201312 yr Hello all, so I am trying to get the hot bar slot selected by a player. I noticed there was an NBT Tag for this, but it is always returning 0. Note: I am trying to get the slot number of the slot that the user currently has their hotbar on. Not the item in the slot. (Should return a number 0- My code: EntityPlayer player = e.entityPlayer; NBTTagCompound nbt = player.getEntityData(); int selSlot = nbt.getInteger("SelectedItemSlot") + 1; Thanks in advance.
August 26, 201312 yr player.getEntityData is something else. It returns an NBTTagCompound to be used by mods to store extra data into an entity. What you want is player.inventory.currentItem. And aside from contrary belief, that IS the right variable. I have used it in a spell API...... So yes, it does work I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
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.