Finished Refactoring. That was a lot of work. Everything is fine now. Missing: More Logger output, Packet Handling. Than we are in beta-state =D
This commit is contained in:
@@ -2,6 +2,7 @@ package de.skate702.craftingkeys.manager;
|
||||
|
||||
import de.skate702.craftingkeys.config.Config;
|
||||
import de.skate702.craftingkeys.util.InputUtil;
|
||||
import de.skate702.craftingkeys.util.Logger;
|
||||
import de.skate702.craftingkeys.util.Util;
|
||||
import net.minecraft.client.gui.inventory.GuiCrafting;
|
||||
import net.minecraft.inventory.Container;
|
||||
@@ -32,52 +33,68 @@ public class CraftingManager extends ContainerManager {
|
||||
if (isDropKeyDown()) {
|
||||
|
||||
for (int i = 1; i < 10; i++) {
|
||||
putStackToNextEmptySlot(i, true, false);
|
||||
moveStackToInventory(i);
|
||||
}
|
||||
|
||||
} else if (isInteractionKeyDown()) {
|
||||
|
||||
if (isStackKeyDown()) {
|
||||
// TODO: Get for all
|
||||
System.out.println("Blabla");
|
||||
|
||||
int oldStackSize = -1;
|
||||
clickOnCraftingOutput();
|
||||
|
||||
while (Util.client.thePlayer.inventory.getItemStack() != null &&
|
||||
oldStackSize != Util.client.thePlayer.inventory.getItemStack().stackSize) {
|
||||
|
||||
oldStackSize = Util.client.thePlayer.inventory.getItemStack().stackSize;
|
||||
clickOnCraftingOutput();
|
||||
}
|
||||
|
||||
} else {
|
||||
clickOnCraftingOutput(); // TODO: Change that shit!
|
||||
clickOnCraftingOutput();
|
||||
}
|
||||
|
||||
} else if (slotIndex > 0 && currentHoveredSlot != null) {
|
||||
|
||||
if (isStackKeyDown()) {
|
||||
moveAll(currentHoveredSlot.slotNumber, slotIndex);
|
||||
moveStackToInventory(-1);
|
||||
} else {
|
||||
move(currentHoveredSlot.slotNumber, slotIndex, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int specificKeyDownToSlotIndex() {
|
||||
|
||||
if (Keyboard.isKeyDown(Config.getKeyTopLeft())) {
|
||||
if (Keyboard.isKeyDown(Config.getKeyTopLeft()) ||
|
||||
Config.isNumPadEnabled() && Keyboard.isKeyDown(71)) {
|
||||
return 1;
|
||||
} else if (Keyboard.isKeyDown(Config.getkeyTopCenter())) {
|
||||
} else if (Keyboard.isKeyDown(Config.getkeyTopCenter()) ||
|
||||
Config.isNumPadEnabled() && Keyboard.isKeyDown(72)) {
|
||||
return 2;
|
||||
} else if (Keyboard.isKeyDown(Config.getKeyTopRight())) {
|
||||
} else if (Keyboard.isKeyDown(Config.getKeyTopRight()) ||
|
||||
Config.isNumPadEnabled() && Keyboard.isKeyDown(73)) {
|
||||
return 3;
|
||||
} else if (Keyboard.isKeyDown(Config.getKeyCenterLeft())) {
|
||||
} else if (Keyboard.isKeyDown(Config.getKeyCenterLeft()) ||
|
||||
Config.isNumPadEnabled() && Keyboard.isKeyDown(75)) {
|
||||
return 4;
|
||||
} else if (Keyboard.isKeyDown(Config.getKeyCenterCenter())) {
|
||||
} else if (Keyboard.isKeyDown(Config.getKeyCenterCenter()) ||
|
||||
Config.isNumPadEnabled() && Keyboard.isKeyDown(76)) {
|
||||
return 5;
|
||||
} else if (Keyboard.isKeyDown(Config.getKeyCenterRight())) {
|
||||
} else if (Keyboard.isKeyDown(Config.getKeyCenterRight()) ||
|
||||
Config.isNumPadEnabled() && Keyboard.isKeyDown(77)) {
|
||||
return 6;
|
||||
} else if (Keyboard.isKeyDown(Config.getKeyLowerLeft())) {
|
||||
} else if (Keyboard.isKeyDown(Config.getKeyLowerLeft()) ||
|
||||
Config.isNumPadEnabled() && Keyboard.isKeyDown(79)) {
|
||||
return 7;
|
||||
} else if (Keyboard.isKeyDown(Config.getKeyLowerCenter())) {
|
||||
} else if (Keyboard.isKeyDown(Config.getKeyLowerCenter()) ||
|
||||
Config.isNumPadEnabled() && Keyboard.isKeyDown(80)) {
|
||||
return 8;
|
||||
} else if (Keyboard.isKeyDown(Config.getKeyLowerRight())) {
|
||||
} else if (Keyboard.isKeyDown(Config.getKeyLowerRight()) ||
|
||||
Config.isNumPadEnabled() && Keyboard.isKeyDown(81)) {
|
||||
return 9;
|
||||
} else if (Keyboard.isKeyDown(Config.getKeyInteract())) {
|
||||
return -101;
|
||||
@@ -89,17 +106,19 @@ public class CraftingManager extends ContainerManager {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getInventoryStartIndex() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a click on the crafting output (craftingGUI or Inventory)
|
||||
*/
|
||||
public void clickOnCraftingOutput() {
|
||||
|
||||
//putItemAway(); // TODO!
|
||||
private void clickOnCraftingOutput() {
|
||||
|
||||
// Click on crafting output
|
||||
System.out.println("clickOnCraftingOutput(): Clicked on Crafing Output.");
|
||||
Logger.info("clickOnCraftingOutput()", "Clicked on Crafing Output.");
|
||||
leftClick(0);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user