Added full Ctrl-Functionality.
This commit is contained in:
@@ -127,7 +127,7 @@ public class ContainerManager {
|
||||
*/
|
||||
public void clickOnCraftingOutput(boolean isCraftingGUI) {
|
||||
|
||||
// TODO: Put current Item away
|
||||
// TODO: Put current Item away
|
||||
|
||||
if (isCraftingGUI) {
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ public class CraftingKeys {
|
||||
ContainerManager con = new ContainerManager(guiCrafting.inventorySlots);
|
||||
|
||||
// Moving item to crafting table
|
||||
if (keyDown != -1 && currentHoveredSlot != null) {
|
||||
if (keyDown > 0 && currentHoveredSlot != null) {
|
||||
|
||||
// Shift = Move all
|
||||
if (guiCrafting.isShiftKeyDown()) {
|
||||
@@ -107,21 +107,36 @@ public class CraftingKeys {
|
||||
|
||||
}
|
||||
|
||||
if (keyDown == -2) {
|
||||
|
||||
// TODO: Space = Move all back
|
||||
Helper.debugPrint("onTick(): [TODO] Move all items back or drop them.");
|
||||
|
||||
}
|
||||
|
||||
// Strg = Take the output
|
||||
if (guiCrafting.isCtrlKeyDown()) {
|
||||
|
||||
if (guiCrafting.isShiftKeyDown()) {
|
||||
|
||||
// TODO: Strg + Shift = Empty Crafting Table
|
||||
Helper.debugPrint("onTick(): [TODO] Move all items back or drop them.");
|
||||
//Strg + Shift = Move all (resp. faster!)
|
||||
con.clickOnCraftingOutput(true);
|
||||
|
||||
} else {
|
||||
|
||||
// Send mouse click on crafting output
|
||||
con.clickOnCraftingOutput(true);
|
||||
// Send mouse click on crafting output (accept also
|
||||
// holding)
|
||||
int ticksdown = Helper.getStrgTimesDown(true);
|
||||
if (ticksdown == 2 || ticksdown % 15 == 0 || (ticksdown > 60 && ticksdown % 8 == 0)) {
|
||||
con.clickOnCraftingOutput(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// Reset Strg
|
||||
Helper.getStrgTimesDown(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -144,7 +144,8 @@ public class Helper {
|
||||
/**
|
||||
* Reads the current Keyboard-Input and converts it to a Inventory-Slot.
|
||||
*
|
||||
* @return A Inventory-Slot (based on CraftingGUI)
|
||||
* @return A Inventory-Slot (based on CraftingGUI), -1 for wrong input, -2
|
||||
* for space
|
||||
*/
|
||||
public static int craftingKeyDownToSlotNumber() {
|
||||
|
||||
@@ -170,8 +171,10 @@ public class Helper {
|
||||
returnValue = 8;
|
||||
} else if (Keyboard.isKeyDown(Keyboard.KEY_C)) {
|
||||
returnValue = 9;
|
||||
} else if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {
|
||||
returnValue = -2;
|
||||
}
|
||||
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -199,4 +202,25 @@ public class Helper {
|
||||
return returnValue;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the times strg was pressed before reseting
|
||||
*/
|
||||
private static int strgTimesDown = 0;
|
||||
|
||||
/**
|
||||
* Return the times Strg was pressed before reseting
|
||||
*
|
||||
* @param strgDown
|
||||
* false, if reset
|
||||
* @return A number of tick strg was down before
|
||||
*/
|
||||
public static int getStrgTimesDown(boolean strgDown) {
|
||||
|
||||
if (!strgDown)
|
||||
strgTimesDown = 0;
|
||||
|
||||
return ++strgTimesDown;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,3 +3,4 @@ package de.skate702.craftingkeys;
|
||||
public class Settings {
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public class CraftingKeysClientProxy extends CraftingKeysProxy {
|
||||
|
||||
@Override
|
||||
public void registerRenderers() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,7 @@ public class CraftingKeysProxy {
|
||||
public void registerRenderers() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The Minecraft call to send a mouse click to a GUI. [Based on INVTW]
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user