How to switch hotbar slots via script?
Solved
ScriptAPI
-
Is there a list of things like mc.gameSettings.keyBindUseItem.pressed where i can
look up some things because i cant find anything on google and i dont always want to ask in the Forum.And i really want to become better at scripting but as already mentioned i cant find
these things i want to look up . Any tips ? -
@bygraf said in How to switch hotbar slots via script?:
Is there a list of things like mc.gameSettings.keyBindUseItem.pressed
https://scriptapi.liquidbounce.net/net/minecraft/client/settings/GameSettings.html
How to switch hotbar slots via scriptapi?
mc.thePlayer.sendQueue.addToSendQueue(new C09PacketHeldItemChange(slot));
-
-
-
And this is how you should actually switch the slots on both sides.
mc.thePlayer.inventory.currentItem = x; mc.playerController.updateController();
because updateController does this:
public void updateController() { this.syncCurrentPlayItem(); if (this.netClientHandler.getNetworkManager().isChannelOpen()) { this.netClientHandler.getNetworkManager().processReceivedPackets(); } else { this.netClientHandler.getNetworkManager().checkDisconnected(); } } private void syncCurrentPlayItem() { int i = this.mc.thePlayer.inventory.currentItem; if (i != this.currentPlayerItem) { this.currentPlayerItem = i; this.netClientHandler.addToSendQueue(new C09PacketHeldItemChange(this.currentPlayerItem)); } }
-