Fixed: Moving a held item to hotbar slot.

This commit is contained in:
Alexander Albers
2015-11-02 13:51:21 +01:00
parent f08cc9b591
commit af0baf959c
2 changed files with 9 additions and 3 deletions
@@ -32,7 +32,9 @@ public abstract class ContainerManager {
protected void handleNumKey() { protected void handleNumKey() {
int hotbarStartIndex = 0; // see: http://wiki.vg/Inventory
// hotbar-slots are always the last 9 slots of the currently opened inventory.
int hotbarStartIndex = Util.client.thePlayer.openContainer.getInventory().size() - 9 - 1;
if (Keyboard.isKeyDown(Keyboard.KEY_1)) { if (Keyboard.isKeyDown(Keyboard.KEY_1)) {
leftClick(hotbarStartIndex + 1); leftClick(hotbarStartIndex + 1);
@@ -55,7 +57,12 @@ public abstract class ContainerManager {
} else { } else {
return; return;
} }
moveStackToInventory(-1); moveStackToInventory(-1);
// Minecraft handles the Keyboard-keys as well, that's why we need to clear them first
// see: GuiContainer#keyTyped(char,int); -> checkHotbarKeys
while (Keyboard.next()) {
}
} }
/** /**
@@ -85,8 +85,7 @@ public class CraftingManager extends ContainerManager {
// Handle NumKey-moving // Handle NumKey-moving
} else if (Util.client.thePlayer.inventory.getItemStack() != null) { } else if (Util.client.thePlayer.inventory.getItemStack() != null) {
Logger.warn("acceptKey()", "NumKey-Moving does not work yet. Will probably work never."); handleNumKey();
//handleNumKey();
} }
} }
} }