Posted January 1, 20214 yr I am trying to change the players currently selected hotbar slot. I found minecraft.thePlayer.inventory.changeCurrentItem(x) however, this only selects the next or previous slot. I am very new to this, sorry if I missed something obvious. Thanks.
January 1, 20214 yr Author Oh, I just found it on this thread Is there a way to do what I'm asking in 1.16?
November 23, 20213 yr On 1/1/2021 at 8:17 PM, fenris said: nvmd I found a different method Can I ask what method you found?
January 17, 20232 yr To do this in minecraft 1.16.5 it is very simple (note it should work for 16.4 as well, you might have to change some of the class names to match yours). Minecraft.getInstance().player.inventory.currentItem = 8; You can set 8 to whatever slot you want. For some reason minecraft adds 1 or takes away 1 with everything that has to do with inventorys so make sure you test it properly.
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.