How to switch hotbar slots via script?
Solved
ScriptAPI
-
@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)); } }
-